5 # Permission is hereby granted, free of charge, to any person obtaining
6 # a copy of this software and associated documentation files (the
7 # "Software"), to deal in the Software without restriction, including
8 # without limitation the rights to use, copy, modify, merge, publish,
9 # distribute, sublicense, and/or sell copies of the Software, and to
10 # permit persons to whom the Software is furnished to do so, subject to
11 # the following conditions:
13 # The above copyright notice and this permission notice shall be included
14 # in all copies or substantial portions of the Software.
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
17 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
18 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 __revision__
= "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
32 _python_
= TestSCons
._python
_
34 test
= TestSCons
.TestSCons()
38 test
.write('mygs.py', r
"""
42 cmd_opts, args = getopt.getopt(sys.argv[1:], 's:x', [])
44 for opt, arg in cmd_opts:
46 if arg[:11] == 'OutputFile=':
47 out_file = open(arg[11:], 'w')
49 opt_string = opt_string + ' ' + opt
50 infile = open(args[0], 'r')
51 out_file.write(opt_string + "\n")
52 for l in infile.readlines():
58 test
.write('SConstruct', """
59 env = Environment(GS = r'%(_python_)s mygs.py', GSFLAGS = '-x',
61 env.PDF(target = 'test1.pdf', source = 'test1.ps')
64 test
.write('test1.ps', """\
69 test
.run(arguments
= '.', stderr
= None)
71 test
.must_match('test1.pdf', " -x\nThis is a .ps test.\n", mode
='r')
75 if sys
.platform
== 'win32':
76 gs_executable
= 'gswin32c'
77 elif sys
.platform
== 'os2':
78 gs_executable
= 'gsos2'
81 gs
= test
.where_is(gs_executable
)
85 test
.file_fixture('wrapper.py')
87 test
.write('SConstruct', """\
89 ENV = { 'PATH' : os.environ['PATH'] }
90 foo = Environment(ENV = ENV)
91 foo.Append(GSFLAGS = '-q')
92 foo.PDF(target = 'foo.pdf', source = 'foo.ps')
97 100 100 moveto /Times-Roman findfont 24 scalefont (Hello, world!) show showpage
100 test
.write('foo.ps', input)
102 test
.run(arguments
= 'foo.pdf', stderr
= None)
104 test
.fail_test(not os
.path
.exists(test
.workpath('foo.pdf')))
110 # indent-tabs-mode:nil
112 # vim: set expandtab tabstop=4 shiftwidth=4: