1 """engine.SCons.Options.PathOption
3 This file defines an option type for SCons implementing 'package
6 To be used whenever a 'package' may be enabled/disabled and the
7 package path may be specified.
12 x11=no (disables X11 support)
13 x11=yes (will search for the package installation dir)
14 x11=/usr/local/X11 (will check this path for existance)
16 To replace autoconf's --with-xxx=yyy
21 opts.Add(PathOption('qtdir',
22 'where the root of Qt is installed',
24 opts.Add(PathOption('qt_includes',
25 'where the Qt includes are installed',
27 opts.Add(PathOption('qt_libraries',
28 'where the Qt library is installed',
36 # Permission is hereby granted, free of charge, to any person obtaining
37 # a copy of this software and associated documentation files (the
38 # "Software"), to deal in the Software without restriction, including
39 # without limitation the rights to use, copy, modify, merge, publish,
40 # distribute, sublicense, and/or sell copies of the Software, and to
41 # permit persons to whom the Software is furnished to do so, subject to
42 # the following conditions:
44 # The above copyright notice and this permission notice shall be included
45 # in all copies or substantial portions of the Software.
47 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
48 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
49 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
50 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
51 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
52 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
53 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
56 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
58 __all__ = ('PathOption',)
64 def _validator(key, val, env):
67 # todo: write validator, check for path
68 if not os.path.exists(val):
69 raise SCons.Errors.UserError(
70 'Path does not exist for option %s: %s' % (key, val))
73 def PathOption(key, help, default):
74 # NB: searchfunc is currenty undocumented and unsupported
76 The input parameters describe a 'path list' option, thus they
77 are returned with the correct converter and validator appended. The
78 result is usable for input to opts.Add() .
80 A 'package list' option may either be 'all', 'none' or a list of
81 package names (seperated by space).
83 return (key, '%s ( /path/to/%s )' % (help, key), default,