created function removeOrphans() and removeUnknownDoctypes()
and the function runbuild() ugly name; which is called from all three of the
main work functions, build(), publish() and script()
abstract the error-handling away from the one-large run() function into each
of the functions (show_doctypes, show_statustypes, detail, summary, etc.)
add the function publish(), which will call build() and ensure success before
running any of the publishing
In preparation for supporting a separate --builddir (allowing minimal
disruption of real output directory during rebuild) factor all output
directory handling logic into the main processor object (BaseDoctype).
Simplify the generate() method.
Centralize all pre-build logic in hook_build_prepare().
Remove all hook logic from the OutputDirectory.
the logic for making sure to chdir() into the build directory has been
sequestered into doctypes/common.py (and output.py); additionally, it is
smarter to put the resource copying logic, there, as well
in preparation for supporting a build-directory, moving the os.chdir() and the
copying of image files into tldp/doctypes/common.py and adding a few hooks in
the main logic for building
This patch prepares the way for simplifying the topological sort solution for
the classes which implement the document building logic. Formerly, each
doctype class had to import networx itself and the @depends decorator stuffed
the dependencies into a graph in the class variable.
Now, each method tracks its dependencies (same decorator trick), but the
topological sort is not computed until just before running the job. This is
more flexible, more obvious, simpler and features less code replication.
The next commit or two will convert the remaining doctype classes to use this
techinque.
adding support for the --script option
shortening the names in the script since it was getting fairly redundant to
keep typing tldp.outputs.Output*, tldp.inventory.Inventory and
tldp.sources.Source*
important to validate the document before processing it;
Note! Adding this feature flushed out a number of sketchy corners of a few of
our documents, but almost everything validated already.
before, the build() function lacked the logic to retain, and return that there
was a failure during the building of one of the documents; it now returns
a 1, which is passed directly to sys.exit(), if any single build fails
The Python names for the document types are upper-cased and probably not
predictably named for the end user; allow a case-insensitive match when trying
to turn off building or listing for a particular document type.
each function was creating its own inventory; this is not necessary
also, if a user wants only to build a single document, it is not necessary to
scan the entire source and output directory (small, but perceptible speedup to
the end user)
better checking of the various different possible argument types, since an
argument can be a filename, a status_class or a stem
a source document is defined as either a file with a known ending (e.g. .xml,
.sgml) or a directory name containing a file with the directory name plus a
known extension
create a small function (arg_issourcedoc), which takes a filename and returns
that filename if it is (possibly) a source document or, if it is a directory,
finds the main file in the directory which represents the main document
user can pass in a dict(); os.environ always contains string values, though,
so make sure that the dict() looks like what would be returned from os.environ
it is smarter to perform the non-destructive check first, rather than blowing
away the output directory and then reporting that it is impossible to rebuild
the document output tree