Make virtualenv dir configurable and break long lines
This commit is contained in:
parent
231c16df25
commit
fcaf8a0cdc
@ -5,7 +5,7 @@ if (NOT DOXYGEN)
|
|||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
add_custom_target(doc
|
add_custom_target(doc
|
||||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build.py ${FMT_VERSION})
|
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build.py ${FMT_VERSION} SOURCES build.py)
|
||||||
|
|
||||||
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/
|
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/
|
||||||
DESTINATION share/doc/fmt OPTIONAL)
|
DESTINATION share/doc/fmt OPTIONAL)
|
||||||
|
20
doc/build.py
20
doc/build.py
@ -13,13 +13,12 @@ def pip_install(package, commit=None, **kwargs):
|
|||||||
print('Installing {}'.format(package))
|
print('Installing {}'.format(package))
|
||||||
check_call(['pip', 'install', package])
|
check_call(['pip', 'install', package])
|
||||||
|
|
||||||
def create_build_env():
|
def create_build_env(dirname='virtualenv'):
|
||||||
# Create virtualenv.
|
# Create virtualenv.
|
||||||
virtualenv_dir = 'virtualenv'
|
check_call(['virtualenv', dirname])
|
||||||
check_call(['virtualenv', virtualenv_dir])
|
|
||||||
import sysconfig
|
import sysconfig
|
||||||
scripts_dir = os.path.basename(sysconfig.get_path('scripts'))
|
scripts_dir = os.path.basename(sysconfig.get_path('scripts'))
|
||||||
activate_this_file = os.path.join(virtualenv_dir, scripts_dir,
|
activate_this_file = os.path.join(dirname, scripts_dir,
|
||||||
'activate_this.py')
|
'activate_this.py')
|
||||||
with open(activate_this_file) as f:
|
with open(activate_this_file) as f:
|
||||||
exec(f.read(), dict(__file__=activate_this_file))
|
exec(f.read(), dict(__file__=activate_this_file))
|
||||||
@ -48,7 +47,8 @@ def create_build_env():
|
|||||||
|
|
||||||
def build_docs(version='dev', **kwargs):
|
def build_docs(version='dev', **kwargs):
|
||||||
doc_dir = kwargs.get('doc_dir', os.path.dirname(os.path.realpath(__file__)))
|
doc_dir = kwargs.get('doc_dir', os.path.dirname(os.path.realpath(__file__)))
|
||||||
include_dir = kwargs.get('include_dir', os.path.join(os.path.dirname(doc_dir), 'fmt'))
|
include_dir = kwargs.get('include_dir',
|
||||||
|
os.path.join(os.path.dirname(doc_dir), 'fmt'))
|
||||||
# Build docs.
|
# Build docs.
|
||||||
cmd = ['doxygen', '-']
|
cmd = ['doxygen', '-']
|
||||||
p = Popen(cmd, stdin=PIPE)
|
p = Popen(cmd, stdin=PIPE)
|
||||||
@ -77,10 +77,11 @@ def build_docs(version='dev', **kwargs):
|
|||||||
'''.format(include_dir).encode('UTF-8'))
|
'''.format(include_dir).encode('UTF-8'))
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
raise CalledProcessError(p.returncode, cmd)
|
raise CalledProcessError(p.returncode, cmd)
|
||||||
|
doxyxml_dir = os.path.join(os.getcwd(), 'doxyxml')
|
||||||
check_call(['sphinx-build',
|
check_call(['sphinx-build',
|
||||||
'-Dbreathe_projects.format=' + os.path.join(os.getcwd(), 'doxyxml'),
|
'-Dbreathe_projects.format=' + doxyxml_dir,
|
||||||
'-Dversion=' + version, '-Drelease=' + version, '-Aversion=' + version,
|
'-Dversion=' + version, '-Drelease=' + version,
|
||||||
'-b', 'html', doc_dir, 'html'])
|
'-Aversion=' + version, '-b', 'html', doc_dir, 'html'])
|
||||||
try:
|
try:
|
||||||
check_call(['lessc', #'--clean-css',
|
check_call(['lessc', #'--clean-css',
|
||||||
'--include-path=' + os.path.join(doc_dir, 'bootstrap'),
|
'--include-path=' + os.path.join(doc_dir, 'bootstrap'),
|
||||||
@ -89,7 +90,8 @@ def build_docs(version='dev', **kwargs):
|
|||||||
except OSError as e:
|
except OSError as e:
|
||||||
if e.errno != errno.ENOENT:
|
if e.errno != errno.ENOENT:
|
||||||
raise
|
raise
|
||||||
print('lessc not found; make sure that Less (http://lesscss.org/) is installed')
|
print('lessc not found; make sure that Less (http://lesscss.org/) ' +
|
||||||
|
'is installed')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
return 'html'
|
return 'html'
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user