Merge pull request #4655 from bdbaddog/fix_new_ninja_package
[scons.git] / test / Variables / help.py
blobe0addb19d26739219ca62a02c6c98edf4455098d
1 #!/usr/bin/env python
3 # MIT License
5 # Copyright The SCons Foundation
7 # Permission is hereby granted, free of charge, to any person obtaining
8 # a copy of this software and associated documentation files (the
9 # "Software"), to deal in the Software without restriction, including
10 # without limitation the rights to use, copy, modify, merge, publish,
11 # distribute, sublicense, and/or sell copies of the Software, and to
12 # permit persons to whom the Software is furnished to do so, subject to
13 # the following conditions:
15 # The above copyright notice and this permission notice shall be included
16 # in all copies or substantial portions of the Software.
18 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
19 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
20 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 """
27 Test the Variables help messages.
28 """
30 import os
32 import TestSCons
34 str_True = str(True)
35 str_False = str(False)
37 test = TestSCons.TestSCons()
39 workpath = test.workpath()
40 qtpath = os.path.join(workpath, 'qt')
41 libpath = os.path.join(qtpath, 'lib')
42 libdirvar = os.path.join('$qtdir', 'lib')
44 test.subdir(qtpath)
45 test.subdir(libpath)
47 test.write('SConstruct', """
48 from SCons.Variables import (
49 BoolVariable,
50 EnumVariable,
51 ListVariable,
52 PackageVariable,
53 PathVariable,
56 list_of_libs = Split('x11 gl qt ical')
57 qtdir = r'%(qtpath)s'
59 opts = Variables(args=ARGUMENTS)
60 opts.AddVariables(
61 BoolVariable('warnings', 'compilation with -Wall and similiar', True),
62 BoolVariable('profile', 'create profiling informations', False),
63 EnumVariable(
64 'debug',
65 'debug output and symbols',
66 'no',
67 allowed_values=('yes', 'no', 'full'),
68 map={},
69 ignorecase=0,
70 ), # case sensitive
71 EnumVariable(
72 'guilib',
73 'gui lib to use',
74 'gtk',
75 allowed_values=('motif', 'gtk', 'kde'),
76 map={},
77 ignorecase=1,
78 ), # case insensitive
79 EnumVariable(
80 'some',
81 'some option',
82 'xaver',
83 allowed_values=('xaver', 'eins'),
84 map={},
85 ignorecase=2,
86 ), # make lowercase
87 ListVariable(
88 'shared', 'libraries to build as shared libraries', 'all', names=list_of_libs
90 PackageVariable('x11', 'use X11 installed here (yes = search some places)', 'yes'),
91 PathVariable('qtdir', 'where the root of Qt is installed', qtdir),
92 PathVariable('qt_libraries', 'where the Qt library is installed', r'%(libdirvar)s'),
95 _ = DefaultEnvironment(tools=[])
96 env = Environment(variables=opts, tools=[])
97 Help(opts.GenerateHelpText(env))
99 print(env['warnings'])
100 print(env['profile'])
102 Default(env.Alias('dummy', None))
103 """ % locals())
105 test.run(arguments='-h',
106 stdout = """\
107 scons: Reading SConscript files ...
108 %(str_True)s
109 %(str_False)s
110 scons: done reading SConscript files.
112 warnings: compilation with -Wall and similiar (yes|no)
113 default: True
114 actual: %(str_True)s
116 profile: create profiling informations (yes|no)
117 default: False
118 actual: %(str_False)s
120 debug: debug output and symbols (yes|no|full)
121 default: no
122 actual: no
124 guilib: gui lib to use (motif|gtk|kde)
125 default: gtk
126 actual: gtk
128 some: some option (xaver|eins)
129 default: xaver
130 actual: xaver
132 shared: libraries to build as shared libraries
133 (all|none|comma-separated list of names)
134 allowed names: x11 gl qt ical
135 default: all
136 actual: x11 gl qt ical
138 x11: use X11 installed here (yes = search some places)
139 ( yes | no | /path/to/x11 )
140 default: yes
141 actual: %(str_True)s
143 qtdir: where the root of Qt is installed ( /path/to/qtdir )
144 default: %(qtpath)s
145 actual: %(qtpath)s
147 qt_libraries: where the Qt library is installed ( /path/to/qt_libraries )
148 default: %(libdirvar)s
149 actual: %(libpath)s
151 Use scons -H for help about SCons built-in command-line options.
152 """ % locals())
154 test.pass_test()
156 # Local Variables:
157 # tab-width:4
158 # indent-tabs-mode:nil
159 # End:
160 # vim: set expandtab tabstop=4 shiftwidth=4: