diff options
author | Dirk Baechle <dl9obn@darc.de> | 2013-10-08 10:54:45 (GMT) |
---|---|---|
committer | Dirk Baechle <dl9obn@darc.de> | 2013-10-08 10:54:45 (GMT) |
commit | 3bebac3d0e8f24065ecda4abb2a2dad7b1d57164 (patch) | |
tree | b2755eb58dbe9893e1d091b292b3a486fa6d7679 /src/engine/SCons/Tool/gs.py | |
parent | 32676cbecfa28980b77426da56bfc1b8429ccb7d (diff) | |
download | SCons-3bebac3d0e8f24065ecda4abb2a2dad7b1d57164.zip SCons-3bebac3d0e8f24065ecda4abb2a2dad7b1d57164.tar.gz SCons-3bebac3d0e8f24065ecda4abb2a2dad7b1d57164.tar.bz2 |
- added an explicit Gs() Builder to the gs.py Tool
- updated documentation accordingly and added a (very) simple test
Diffstat (limited to 'src/engine/SCons/Tool/gs.py')
-rw-r--r-- | src/engine/SCons/Tool/gs.py | 31 |
1 files changed, 21 insertions, 10 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' |