You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
2.9 KiB

6 years ago
  1. """SCons.Tool.pdf
  2. Common PDF Builder definition for various other Tool modules that use it.
  3. Add an explicit action to run epstopdf to convert .eps files to .pdf
  4. """
  5. #
  6. # Copyright (c) 2001 - 2017 The SCons Foundation
  7. #
  8. # Permission is hereby granted, free of charge, to any person obtaining
  9. # a copy of this software and associated documentation files (the
  10. # "Software"), to deal in the Software without restriction, including
  11. # without limitation the rights to use, copy, modify, merge, publish,
  12. # distribute, sublicense, and/or sell copies of the Software, and to
  13. # permit persons to whom the Software is furnished to do so, subject to
  14. # the following conditions:
  15. #
  16. # The above copyright notice and this permission notice shall be included
  17. # in all copies or substantial portions of the Software.
  18. #
  19. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
  20. # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  21. # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  22. # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  23. # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  24. # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  25. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  26. #
  27. __revision__ = "src/engine/SCons/Tool/pdf.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog"
  28. import SCons.Builder
  29. import SCons.Tool
  30. PDFBuilder = None
  31. EpsPdfAction = SCons.Action.Action('$EPSTOPDFCOM', '$EPSTOPDFCOMSTR')
  32. def generate(env):
  33. try:
  34. env['BUILDERS']['PDF']
  35. except KeyError:
  36. global PDFBuilder
  37. if PDFBuilder is None:
  38. PDFBuilder = SCons.Builder.Builder(action = {},
  39. source_scanner = SCons.Tool.PDFLaTeXScanner,
  40. prefix = '$PDFPREFIX',
  41. suffix = '$PDFSUFFIX',
  42. emitter = {},
  43. source_ext_match = None,
  44. single_source=True)
  45. env['BUILDERS']['PDF'] = PDFBuilder
  46. env['PDFPREFIX'] = ''
  47. env['PDFSUFFIX'] = '.pdf'
  48. # put the epstopdf builder in this routine so we can add it after
  49. # the pdftex builder so that one is the default for no source suffix
  50. def generate2(env):
  51. bld = env['BUILDERS']['PDF']
  52. #bld.add_action('.ps', EpsPdfAction) # this is covered by direct Ghostcript action in gs.py
  53. bld.add_action('.eps', EpsPdfAction)
  54. env['EPSTOPDF'] = 'epstopdf'
  55. env['EPSTOPDFFLAGS'] = SCons.Util.CLVar('')
  56. env['EPSTOPDFCOM'] = '$EPSTOPDF $EPSTOPDFFLAGS ${SOURCE} --outfile=${TARGET}'
  57. def exists(env):
  58. # This only puts a skeleton Builder in place, so if someone
  59. # references this Tool directly, it's always "available."
  60. return 1
  61. # Local Variables:
  62. # tab-width:4
  63. # indent-tabs-mode:nil
  64. # End:
  65. # vim: set expandtab tabstop=4 shiftwidth=4: