summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bin/SConsDoc.py6
-rw-r--r--doc/SConscript96
-rw-r--r--doc/man/scons-time.xml3
-rw-r--r--doc/man/scons.xml3
-rw-r--r--doc/man/sconsign.xml3
5 files changed, 75 insertions, 36 deletions
diff --git a/bin/SConsDoc.py b/bin/SConsDoc.py
index e1c2b0b..e435b4a 100644
--- a/bin/SConsDoc.py
+++ b/bin/SConsDoc.py
@@ -127,8 +127,7 @@ except:
try:
import lxml
except:
- print("Failed to import either libxml2/libxslt or lxml")
- sys.exit(1)
+ raise ImportError("Failed to import either libxml2/libxslt or lxml")
has_etree = False
if not has_libxml2:
@@ -154,8 +153,7 @@ if not has_etree:
# normal ElementTree install
import elementtree.ElementTree as etree
except ImportError:
- print("Failed to import ElementTree from any known place")
- sys.exit(1)
+ raise ImportError("Failed to import ElementTree from any known place")
re_entity = re.compile("\&([^;]+);")
re_entity_header = re.compile("<!DOCTYPE\s+sconsdoc\s+[^\]]+\]>")
diff --git a/doc/SConscript b/doc/SConscript
index 7880ba3..35eb380 100644
--- a/doc/SConscript
+++ b/doc/SConscript
@@ -28,25 +28,43 @@ import os.path
import re
import sys
import glob
-import SConsDoc
-import SConsExamples
+
import bootstrap
Import('build_dir', 'env', 'whereis', 'revaction')
-env = env.Clone()
+#
+# -- Check prerequisites for building the documentation ---
+#
+skip_doc = False
-build = os.path.join(build_dir, 'doc')
+try:
+ import SConsDoc
+ import SConsExamples
+except ImportError as exc:
+ print("doc: SConsDoc failed to import, the error was:")
+ print(" ImportError: %s" % exc)
+ print(" Please make sure that python-libxml2 or python-lxml is installed.")
+ skip_doc = True
fop = whereis('fop')
xep = whereis('xep')
+
+if not fop and not xep:
+ print "doc: No PDF renderer found (fop|xep)!"
+ skip_doc = True
+
+#
+# --- Configure build
+#
+env = env.Clone()
+
+build = os.path.join(build_dir, 'doc')
+
epydoc_cli = whereis('epydoc')
gs = whereis('gs')
lynx = whereis('lynx')
-#
-#
-#
dist_doc_tar_gz = '$DISTDIR/scons-doc-${VERSION}.tar.gz'
tar_deps = []
@@ -55,7 +73,9 @@ tar_list = []
orig_env = env
env = orig_env.Clone(SCONS_PY = File('#src/script/scons.py').rfile())
-
+#
+# --- Helpers ---
+#
def writeVersionXml(verfile, date, ver, rev):
""" Helper function: Write a version.xml file. """
try:
@@ -75,28 +95,49 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT.
<!ENTITY buildrevision "%s">
""" % (date, ver, rev))
+
+# The names of the target files for the MAN pages
+man_page_list = ['scons.1','scons-time.1','sconsign.1']
+
+# Template for the MAN page texts when we can't properly
+# create them because the skip_doc flag is set (required
+# modules/tools aren't installed in the current system)
+man_replace_tpl = """.TH "%(uctitle)s" "1" "%(today)s" "SCons %(version)s" "SCons %(version)s"
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.nh
+.ad l
+.SH "NOTE"
+%(title)s \- This is a replacement file, stemming from an incomplete
+packaging process without the required doc modules installed. Please
+update the system and try running bootstrap.py again.
+"""
+
#
-# Check whether we have all tools installed for
-# building the documentation.
+# --- Processing ---
#
-skip_doc = False
-try:
- import libxml2
- import libxslt
-except:
- try:
- import lxml
- except:
- print "doc: Neither libxml2 nor lxml Python bindings found!"
- print " Please install one of the packages python-libxml2 or python-lxml."
- skip_doc = True
-
-if not fop and not xep:
- print "doc: No PDF renderer found (fop|xep)!"
- skip_doc = True
-
if skip_doc:
print "doc: ...skipping building User Guide."
+ print " ...creating fake MAN pages."
+
+ # Since the top-level SConstruct requires the MAN
+ # pages to exist for the basic packaging, we create simple
+ # stub texts here as replacement...
+ scdir = os.path.join(build, 'man')
+ if not os.path.isdir(scdir):
+ os.makedirs(scdir)
+
+ import datetime
+ today = datetime.date.today().strftime("%m/%d/%Y")
+ version = env.subst('$VERSION')
+ for m in man_page_list:
+ man, _ = os.path.splitext(m)
+ fman = open(os.path.join(scdir, m), "w")
+ fman.write(man_replace_tpl % {'uctitle' : man.upper().replace("-", "\\-"),
+ 'today' : today,
+ 'title' : man,
+ 'version' : version})
+ fman.close()
else:
if not lynx:
print "doc: Warning, lynx is not installed...created release packages won't be complete!"
@@ -275,9 +316,6 @@ else:
'man' : (['man','epub','text'], [], [])
}
- # The names of the target files for the MAN pages
- man_page_list = ['scons.1','scons-time.1','sconsign.1']
-
#
# We have to tell SCons to scan the top-level XML files which
# get included by the document XML files in the subdirectories.
diff --git a/doc/man/scons-time.xml b/doc/man/scons-time.xml
index a1ecadf..e0fa6b1 100644
--- a/doc/man/scons-time.xml
+++ b/doc/man/scons-time.xml
@@ -32,7 +32,8 @@
<refmeta>
<refentrytitle>SCONS-TIME</refentrytitle>
<manvolnum>1</manvolnum>
-<refmiscinfo class='source'>__MONTH_YEAR__</refmiscinfo>
+<refmiscinfo class='source'>SCons __VERSION__</refmiscinfo>
+<refmiscinfo class='manual'>SCons __VERSION__</refmiscinfo>
</refmeta>
<refnamediv id='name'>
<refname>scons-time</refname>
diff --git a/doc/man/scons.xml b/doc/man/scons.xml
index 55f2d63..08a942b 100644
--- a/doc/man/scons.xml
+++ b/doc/man/scons.xml
@@ -75,7 +75,8 @@
<refmeta>
<refentrytitle>SCONS</refentrytitle>
<manvolnum>1</manvolnum>
-<refmiscinfo class='source'>__MONTH_YEAR__</refmiscinfo>
+<refmiscinfo class='source'>SCons __VERSION__</refmiscinfo>
+<refmiscinfo class='manual'>SCons __VERSION__</refmiscinfo>
</refmeta>
<refnamediv id='name'>
<refname>scons</refname>
diff --git a/doc/man/sconsign.xml b/doc/man/sconsign.xml
index ca99db6..44a1e5f 100644
--- a/doc/man/sconsign.xml
+++ b/doc/man/sconsign.xml
@@ -32,7 +32,8 @@
<refmeta>
<refentrytitle>SCONSIGN</refentrytitle>
<manvolnum>1</manvolnum>
-<refmiscinfo class='source'>__MONTH_YEAR__</refmiscinfo>
+<refmiscinfo class='source'>SCons __VERSION__</refmiscinfo>
+<refmiscinfo class='manual'>SCons __VERSION__</refmiscinfo>
</refmeta>
<refnamediv id='name'>
<refname>sconsign</refname>