2015-10-17 08:05:58 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#!/usr/bin/env python
							 | 
						
					
						
							
								
									
										
										
										
											2015-04-10 08:39:09 -07:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# Build the documentation.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								from __future__ import print_function
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-16 08:28:58 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								import errno, os, shutil, sys, tempfile
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-13 08:45:49 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								from subprocess import check_call, check_output, CalledProcessError, Popen, PIPE
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-14 08:17:39 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								from distutils.version import LooseVersion
							 | 
						
					
						
							
								
									
										
										
										
											2015-04-10 08:39:09 -07:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-13 08:24:16 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								def pip_install(package, commit=None, **kwargs):
							 | 
						
					
						
							
								
									
										
										
										
											2015-04-10 08:39:09 -07:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  "Install package using pip."
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if commit:
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-13 08:24:16 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    check_version = kwargs.get('check_version', '')
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-14 08:31:54 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    #output = check_output(['pip', 'show', package.split('/')[1]])
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    #if check_version in output:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    #  print('{} already installed'.format(package))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    #  return
							 | 
						
					
						
							
								
									
										
										
										
											2015-04-10 08:39:09 -07:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    package = 'git+git://github.com/{0}.git@{1}'.format(package, commit)
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-13 08:45:49 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  print('Installing {}'.format(package))
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-14 06:52:07 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  check_call(['pip', 'install', '--upgrade', package])
							 | 
						
					
						
							
								
									
										
										
										
											2015-04-10 08:39:09 -07:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-11-23 08:10:02 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								def build_docs(version='dev'):
							 | 
						
					
						
							
								
									
										
										
										
											2015-04-10 08:39:09 -07:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  # Create virtualenv.
							 | 
						
					
						
							
								
									
										
										
										
											2015-05-20 08:06:12 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  doc_dir = os.path.dirname(os.path.realpath(__file__))
							 | 
						
					
						
							
								
									
										
										
										
											2015-06-22 06:40:21 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  virtualenv_dir = 'virtualenv'
							 | 
						
					
						
							
								
									
										
										
										
											2015-04-10 08:39:09 -07:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  check_call(['virtualenv', virtualenv_dir])
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-28 12:21:57 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  import sysconfig
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  scripts_dir = os.path.basename(sysconfig.get_path('scripts'))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  activate_this_file = os.path.join(virtualenv_dir, scripts_dir,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                    'activate_this.py')
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-17 08:05:58 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  with open(activate_this_file) as f:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    exec(f.read(), dict(__file__=activate_this_file))
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-14 08:31:54 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  # Upgrade pip because installation of sphinx with pip 1.1 available on Travis
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  # is broken (see #207) and it doesn't support the show command.
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-16 08:07:44 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  from pkg_resources import get_distribution, DistributionNotFound
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  pip_version = get_distribution('pip').version
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-15 08:09:19 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if LooseVersion(pip_version) < LooseVersion('1.5.4'):
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-15 06:41:16 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    print("Updating pip")
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-15 07:40:34 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    check_call(['pip', 'install', '--upgrade', 'pip'])
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-16 08:07:44 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  # Upgrade distribute because installation of sphinx with distribute 0.6.24
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  # available on Travis is broken (see #207).
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  try:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    distribute_version = get_distribution('distribute').version
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if LooseVersion(distribute_version) <= LooseVersion('0.6.24'):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      print("Updating distribute")
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      check_call(['pip', 'install', '--upgrade', 'distribute'])
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  except DistributionNotFound:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    pass
							 | 
						
					
						
							
								
									
										
										
										
											2015-05-19 08:13:13 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  # Install Sphinx and Breathe.
							 | 
						
					
						
							
								
									
										
										
										
											2016-04-28 07:00:22 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  pip_install('fmtlib/sphinx',
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-16 08:07:44 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								              '12dde8afdb0a7bb5576e2656692c3478c69d8cc3',
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-13 08:24:16 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								              check_version='1.4a0.dev-20151013')
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-21 16:08:50 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  pip_install('michaeljones/breathe',
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								              '1c9d7f80378a92cffa755084823a78bb38ee4acc')
							 | 
						
					
						
							
								
									
										
										
										
											2015-04-10 08:39:09 -07:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  # Build docs.
							 | 
						
					
						
							
								
									
										
										
										
											2015-05-20 08:06:12 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  cmd = ['doxygen', '-']
							 | 
						
					
						
							
								
									
										
										
										
											2015-06-22 06:40:21 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  p = Popen(cmd, stdin=PIPE)
							 | 
						
					
						
							
								
									
										
										
										
											2015-04-10 08:39:09 -07:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  p.communicate(input=r'''
							 | 
						
					
						
							
								
									
										
										
										
											2016-04-28 07:00:22 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      PROJECT_NAME      = fmt
							 | 
						
					
						
							
								
									
										
										
										
											2015-04-10 08:39:09 -07:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      GENERATE_LATEX    = NO
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      GENERATE_MAN      = NO
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      GENERATE_RTF      = NO
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      CASE_SENSE_NAMES  = NO
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      INPUT             = {0}/format.h
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      QUIET             = YES
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      JAVADOC_AUTOBRIEF = YES
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      AUTOLINK_SUPPORT  = NO
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      GENERATE_HTML     = NO
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      GENERATE_XML      = YES
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      XML_OUTPUT        = doxyxml
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      ALIASES           = "rst=\verbatim embed:rst"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      ALIASES          += "endrst=\endverbatim"
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-24 06:54:37 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      MACRO_EXPANSION   = YES
							 | 
						
					
						
							
								
									
										
										
										
											2015-04-10 08:39:09 -07:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      PREDEFINED        = _WIN32=1 \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                          FMT_USE_VARIADIC_TEMPLATES=1 \
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-13 00:35:22 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                          FMT_USE_RVALUE_REFERENCES=1 \
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-18 07:13:43 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                          FMT_USE_USER_DEFINED_LITERALS=1 \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                          FMT_API=
							 | 
						
					
						
							
								
									
										
										
										
											2015-04-10 08:39:09 -07:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      EXCLUDE_SYMBOLS   = fmt::internal::* StringValue write_str
							 | 
						
					
						
							
								
									
										
										
										
											2016-04-24 10:39:33 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    '''.format(os.path.join(os.path.dirname(doc_dir), 'fmt')).encode('UTF-8'))
							 | 
						
					
						
							
								
									
										
										
										
											2015-04-10 08:39:09 -07:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if p.returncode != 0:
							 | 
						
					
						
							
								
									
										
										
										
											2015-05-20 08:06:12 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    raise CalledProcessError(p.returncode, cmd)
							 | 
						
					
						
							
								
									
										
										
										
											2015-11-23 08:10:02 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  check_call(['sphinx-build',
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								              '-Dbreathe_projects.format=' + os.path.join(os.getcwd(), 'doxyxml'),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								              '-Dversion=' + version, '-Drelease=' + version, '-Aversion=' + version,
							 | 
						
					
						
							
								
									
										
										
										
											2015-06-22 06:40:21 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								              '-b', 'html', doc_dir, 'html'])
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-16 08:28:58 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  try:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    check_call(['lessc', '--clean-css',
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                '--include-path=' + os.path.join(doc_dir, 'bootstrap'),
							 | 
						
					
						
							
								
									
										
										
										
											2016-04-24 10:39:33 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                os.path.join(doc_dir, 'fmt.less'),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                'html/_static/fmt.css'])
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-17 08:05:58 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  except OSError as e:
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-16 08:28:58 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if e.errno != errno.ENOENT:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      raise
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    print('lessc not found; make sure that Less (http://lesscss.org/) is installed')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    sys.exit(1)
							 | 
						
					
						
							
								
									
										
										
										
											2015-06-22 06:40:21 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  return 'html'
							 | 
						
					
						
							
								
									
										
										
										
											2015-04-10 08:39:09 -07:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-05-20 08:06:12 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								if __name__ == '__main__':
							 | 
						
					
						
							
								
									
										
										
										
											2015-11-23 08:10:02 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  build_docs(sys.argv[1])
							 |