summaryrefslogtreecommitdiffstats
path: root/doc/SConscript
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2020-03-10 02:29:14 (GMT)
committerWilliam Deegan <bill@baddogconsulting.com>2020-04-09 20:47:31 (GMT)
commitf1538fb9000a343d87676ce110076b7cc197cb0e (patch)
treecbe4f80919fb64584f6ba3b37041438b575fcdb9 /doc/SConscript
parentf293a449ea7f9d036a85e4d880a2ba7da4751c6a (diff)
downloadSCons-f1538fb9000a343d87676ce110076b7cc197cb0e.zip
SCons-f1538fb9000a343d87676ce110076b7cc197cb0e.tar.gz
SCons-f1538fb9000a343d87676ce110076b7cc197cb0e.tar.bz2
add SKIP_DOC= variable to enable disabling buildign documents. Moved epydoc setup into site_scons/epydoc.py
Diffstat (limited to 'doc/SConscript')
-rw-r--r--doc/SConscript174
1 files changed, 54 insertions, 120 deletions
diff --git a/doc/SConscript b/doc/SConscript
index 8f6d1cd..580f4ca 100644
--- a/doc/SConscript
+++ b/doc/SConscript
@@ -54,6 +54,11 @@ if not fop and not xep:
print("doc: No PDF renderer found (fop|xep)!")
skip_doc = True
+
+skip_doc_arg = ARGUMENTS.get('SKIP_DOC')
+if skip_doc_arg is not None:
+ skip_doc = skip_doc_arg in ['True', '1', 'true']
+
#
# --- Configure build
#
@@ -62,7 +67,6 @@ env = env.Clone()
build = os.path.join(build_dir, 'doc')
-epydoc_cli = whereis('epydoc')
gs = whereis('gs')
lynx = whereis('lynx')
@@ -494,127 +498,57 @@ else:
tar_list.extend([css_file])
Local(css_file)
-if not epydoc_cli:
- try:
- import epydoc
- except ImportError:
- epydoc = None
+if not skip_doc:
+ if not epydoc_cli and not epydoc:
+ print("doc: epydoc not found, skipping building API documentation.")
else:
- # adding Epydoc builder using imported module
- def epydoc_builder_action(target, source, env):
- """
- Take a list of `source` files and build docs for them in
- `target` dir.
-
- `target` and `source` are lists.
-
- Uses OUTDIR and EPYDOCFLAGS environment variables.
-
- http://www.scons.org/doc/2.0.1/HTML/scons-user/x3594.html
- """
-
- # the epydoc build process is the following:
- # 1. build documentation index
- # 2. feed doc index to writer for docs
-
- from epydoc.docbuilder import build_doc_index
- from epydoc.docwriter.html import HTMLWriter
- from epydoc.docwriter.latex import LatexWriter
-
- # first arg is a list where can be names of python package dirs,
- # python files, object names or objects itself
- docindex = build_doc_index([str(src) for src in source])
- if docindex is None:
- return -1
-
- if env['EPYDOCFLAGS'] == '--html':
- html_writer = HTMLWriter(docindex,
- docformat='restructuredText',
- prj_name='SCons',
- prj_url='http://www.scons.org/')
- try:
- html_writer.write(env['OUTDIR'])
- except OSError: # If directory cannot be created or any file cannot
- # be created or written to.
- return -2
-
- """
- # PDF support requires external Linux utilites, so it's not crossplatform.
- # Leaving for now.
- # http://epydoc.svn.sourceforge.net/viewvc/epydoc/trunk/epydoc/src/epydoc/cli.py
-
- elif env['EPYDOCFLAGS'] == '--pdf':
- pdf_writer = LatexWriter(docindex,
- docformat='restructuredText',
- prj_name='SCons',
- prj_url='http://www.scons.org/')
- """
- return 0
-
- epydoc_commands = [
- Delete('$OUTDIR'),
- epydoc_builder_action,
- Touch('$TARGET'),
- ]
-
-else: # epydoc_cli is found
- epydoc_commands = [
- Delete('$OUTDIR'),
- '$EPYDOC $EPYDOCFLAGS --debug --output $OUTDIR --docformat=restructuredText --name SCons --url http://www.scons.org/ $SOURCES',
- Touch('$TARGET'),
- ]
-
-
-if not epydoc_cli and not epydoc:
- print("doc: epydoc not found, skipping building API documentation.")
-else:
- # XXX Should be in common with reading the same thing in
- # the SConstruct file.
- # bootstrap.py runs outside of SCons, so need to process the path
- e = Dir(os.path.join('#src', 'engine')).rstr()
- sources = bootstrap.parseManifestLines(e, os.path.join(e, 'MANIFEST.in'))
+ # XXX Should be in common with reading the same thing in
+ # the SConstruct file.
+ # bootstrap.py runs outside of SCons, so need to process the path
+ e = Dir(os.path.join('#src', 'engine')).rstr()
+ sources = bootstrap.parseManifestLines(e, os.path.join(e, 'MANIFEST.in'))
- # Omit some files:
- #
- # Don't omit Platform as we need Platform.virtualenv for the examples to be run
- # sources = [x for x in sources if x.find('Platform') == -1]
- sources = [x for x in sources if x.find('Tool') == -1]
- sources = [x for x in sources if x.find('Options') == -1]
-
- e = os.path.join(build, '..', 'scons', 'engine')
- sources = [os.path.join(e, x) for x in sources]
-
- htmldir = os.path.join(build, 'HTML', 'scons-api')
- env.Command('${OUTDIR}/index.html', sources, epydoc_commands,
- EPYDOC=epydoc_cli, EPYDOCFLAGS='--html', OUTDIR=htmldir)
- tar_deps.append(htmldir)
- tar_list.append(htmldir)
-
- if sys.platform == 'darwin' or not epydoc_cli:
- print("doc: command line epydoc is not found, skipping PDF/PS/Tex output")
- else:
- # PDF and PostScript and TeX are built from the
- # same invocation.
- api_dir = os.path.join(build, 'scons-api')
- api_pdf = os.path.join(api_dir, 'api.pdf')
- api_ps = os.path.join(api_dir, 'api.ps')
- api_tex = os.path.join(api_dir, 'api.tex')
- api_targets = [api_pdf, api_ps, api_tex]
- env.Command(api_targets, sources, epydoc_commands,
- EPYDOC=epydoc_cli, EPYDOCFLAGS='--pdf', OUTDIR=api_dir)
- Local(api_targets)
-
- pdf_install = os.path.join(build, 'PDF', 'scons-api.pdf')
- env.InstallAs(pdf_install, api_pdf)
- tar_deps.append(pdf_install)
- tar_list.append(pdf_install)
- Local(pdf_install)
-
- ps_install = os.path.join(build, 'PS', 'scons-api.ps')
- env.InstallAs(ps_install, api_ps)
- tar_deps.append(ps_install)
- tar_list.append(ps_install)
- Local(ps_install)
+ # Omit some files:
+ #
+ # Don't omit Platform as we need Platform.virtualenv for the examples to be run
+ # sources = [x for x in sources if x.find('Platform') == -1]
+ sources = [x for x in sources if x.find('Tool') == -1]
+ sources = [x for x in sources if x.find('Options') == -1]
+
+ e = os.path.join(build, '..', 'scons', 'engine')
+ sources = [os.path.join(e, x) for x in sources]
+
+ htmldir = os.path.join(build, 'HTML', 'scons-api')
+ env.Command('${OUTDIR}/index.html', sources, epydoc_commands,
+ EPYDOC=epydoc_cli, EPYDOCFLAGS='--html', OUTDIR=htmldir)
+ tar_deps.append(htmldir)
+ tar_list.append(htmldir)
+
+ if sys.platform == 'darwin' or not epydoc_cli:
+ print("doc: command line epydoc is not found, skipping PDF/PS/Tex output")
+ else:
+ # PDF and PostScript and TeX are built from the
+ # same invocation.
+ api_dir = os.path.join(build, 'scons-api')
+ api_pdf = os.path.join(api_dir, 'api.pdf')
+ api_ps = os.path.join(api_dir, 'api.ps')
+ api_tex = os.path.join(api_dir, 'api.tex')
+ api_targets = [api_pdf, api_ps, api_tex]
+ env.Command(api_targets, sources, epydoc_commands,
+ EPYDOC=epydoc_cli, EPYDOCFLAGS='--pdf', OUTDIR=api_dir)
+ Local(api_targets)
+
+ pdf_install = os.path.join(build, 'PDF', 'scons-api.pdf')
+ env.InstallAs(pdf_install, api_pdf)
+ tar_deps.append(pdf_install)
+ tar_list.append(pdf_install)
+ Local(pdf_install)
+
+ ps_install = os.path.join(build, 'PS', 'scons-api.ps')
+ env.InstallAs(ps_install, api_ps)
+ tar_deps.append(ps_install)
+ tar_list.append(ps_install)
+ Local(ps_install)
#
# Now actually create the tar file of the documentation,