diff options
author | Gary Oberbrunner <garyo@oberbrunner.com> | 2013-11-10 19:55:24 (GMT) |
---|---|---|
committer | Gary Oberbrunner <garyo@oberbrunner.com> | 2013-11-10 19:55:24 (GMT) |
commit | 40b0c82446f7acba626424abcd55ecf157d2bdc7 (patch) | |
tree | b13805434b8db4150b113b93921066dc402a63aa /src | |
parent | a8261e0d41be63ca45462fb0f40e8ed1339cc22e (diff) | |
parent | ef9d8a0031b3ca6faabb0746eeb2a7da519fb805 (diff) | |
download | SCons-40b0c82446f7acba626424abcd55ecf157d2bdc7.zip SCons-40b0c82446f7acba626424abcd55ecf157d2bdc7.tar.gz SCons-40b0c82446f7acba626424abcd55ecf157d2bdc7.tar.bz2 |
Merged in dirkbaechle/scons (pull request #91)
Adding EPUB as output format for documentation
Diffstat (limited to 'src')
-rw-r--r-- | src/engine/SCons/Tool/gs.py | 31 | ||||
-rw-r--r-- | src/engine/SCons/Tool/gs.xml | 38 | ||||
-rw-r--r-- | src/engine/SCons/Tool/msginit.xml | 4 |
3 files changed, 54 insertions, 19 deletions
diff --git a/src/engine/SCons/Tool/gs.py b/src/engine/SCons/Tool/gs.py index ada169a..a8fddde 100644 --- a/src/engine/SCons/Tool/gs.py +++ b/src/engine/SCons/Tool/gs.py @@ -34,6 +34,7 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import SCons.Action +import SCons.Builder import SCons.Platform import SCons.Util @@ -52,17 +53,27 @@ GhostscriptAction = None def generate(env): """Add Builders and construction variables for Ghostscript to an Environment.""" - global GhostscriptAction - if GhostscriptAction is None: - GhostscriptAction = SCons.Action.Action('$GSCOM', '$GSCOMSTR') - - import pdf - pdf.generate(env) - - bld = env['BUILDERS']['PDF'] - bld.add_action('.ps', GhostscriptAction) - + # The following try-except block enables us to use the Tool + # in standalone mode (without the accompanying pdf.py), + # whenever we need an explicit call of gs via the Gs() + # Builder ... + try: + if GhostscriptAction is None: + GhostscriptAction = SCons.Action.Action('$GSCOM', '$GSCOMSTR') + + import pdf + pdf.generate(env) + + bld = env['BUILDERS']['PDF'] + bld.add_action('.ps', GhostscriptAction) + except ImportError, e: + pass + + gsbuilder = SCons.Builder.Builder(action = SCons.Action.Action('$GSCOM', '$GSCOMSTR'), + env = env) + env['BUILDERS']['Gs'] = gsbuilder + env['GS'] = gs env['GSFLAGS'] = SCons.Util.CLVar('-dNOPAUSE -dBATCH -sDEVICE=pdfwrite') env['GSCOM'] = '$GS $GSFLAGS -sOutputFile=$TARGET $SOURCES' diff --git a/src/engine/SCons/Tool/gs.xml b/src/engine/SCons/Tool/gs.xml index c34f004..3fe5165 100644 --- a/src/engine/SCons/Tool/gs.xml +++ b/src/engine/SCons/Tool/gs.xml @@ -26,7 +26,12 @@ See its __doc__ string for a discussion of the format. <tool name="gs"> <summary> <para> -Set construction variables for Ghostscript. +This Tool sets the required construction variables for working with +the Ghostscript command. It also registers an appropriate Action +with the PDF Builder (&b-link-PDF;), such that the conversion from +PS/EPS to PDF happens automatically for the TeX/LaTeX toolchain. +Finally, it adds an explicit Ghostscript Builder (&b-link-Gs;) to the +environment. </para> </summary> <sets> @@ -42,7 +47,7 @@ Set construction variables for Ghostscript. <cvar name="GS"> <summary> <para> -The Ghostscript program used to convert PostScript to PDF files. +The Ghostscript program used, e.g. to convert PostScript to PDF files. </para> </summary> </cvar> @@ -50,7 +55,8 @@ The Ghostscript program used to convert PostScript to PDF files. <cvar name="GSCOM"> <summary> <para> -The Ghostscript command line used to convert PostScript to PDF files. +The full Ghostscript command line used for the conversion process. Its default +value is <quote><literal>$GS $GSFLAGS -sOutputFile=$TARGET $SOURCES</literal></quote>. </para> </summary> </cvar> @@ -59,9 +65,8 @@ The Ghostscript command line used to convert PostScript to PDF files. <summary> <para> The string displayed when -Ghostscript is used to convert -a PostScript file to a PDF file. -If this is not set, then &cv-link-GSCOM; (the command line) is displayed. +Ghostscript is called for the conversion process. +If this is not set (the default), then &cv-link-GSCOM; (the command line) is displayed. </para> </summary> </cvar> @@ -69,10 +74,27 @@ If this is not set, then &cv-link-GSCOM; (the command line) is displayed. <cvar name="GSFLAGS"> <summary> <para> -General options passed to the Ghostscript program -when converting PostScript to PDF files. +General options passed to the Ghostscript program, +when converting PostScript to PDF files for example. Its default value +is <quote><literal>-dNOPAUSE -dBATCH -sDEVICE=pdfwrite</literal></quote> </para> </summary> </cvar> +<builder name="Gs"> +<summary> +<para> +A Builder for explicitly calling the <literal>gs</literal> executable. +Depending on the underlying OS, the different names <literal>gs</literal>, +<literal>gsos2</literal> and <literal>gswin32c</literal> +are tried. +</para> +<example_commands>env = Environment(tools=['gs']) +env.Gs('cover.jpg','scons-scons.pdf', + GSFLAGS='-dNOPAUSE -dBATCH -sDEVICE=jpeg -dFirstPage=1 -dLastPage=1 -q') + ) +</example_commands> +</summary> +</builder> + </sconsdoc>
\ No newline at end of file diff --git a/src/engine/SCons/Tool/msginit.xml b/src/engine/SCons/Tool/msginit.xml index 0f89020..7ce785c 100644 --- a/src/engine/SCons/Tool/msginit.xml +++ b/src/engine/SCons/Tool/msginit.xml @@ -216,8 +216,10 @@ See &t-link-msginit; tool and &b-link-POInit; builder. Internal ``macro''. Computes locale (language) name based on target filename (default: <literal>'${TARGET.filebase}' </literal>). </para> -</summary> +<para> See &t-link-msginit; tool and &b-link-POInit; builder. +</para> +</summary> </cvar> </sconsdoc>
\ No newline at end of file |