comparison wscript @ 18:2e2d6d9009a3

Added a --fifepath option to the WAF build script. * Use the '--fifepath=<path/to/fife>' option to override the default search path and directly import the FIFE Python module from <path/to/fife>. * Modified the parpg.main module to support the new --fifepath option and ensure that the FIFE Python module pointed to by the --fifepath option is imported, regardless of whether multiple FIFE modules are already in the default search path.
author M. George Hansen <technopolitica@gmail.com>
date Fri, 10 Jun 2011 11:29:38 -1000
parents 927f2cf75357
children 07ff8cf8a0f1
comparison
equal deleted inserted replaced
17:15107282d9eb 18:2e2d6d9009a3
6 APPNAME = 'parpg' 6 APPNAME = 'parpg'
7 VERSION = '0.2.0' 7 VERSION = '0.2.0'
8 8
9 def options(opt): 9 def options(opt):
10 opt.load('waf_paths python') 10 opt.load('waf_paths python')
11
12 ext_dep = opt.add_option_group(
13 'External dependencies',
14 '',
15 )
16 ext_dep.add_option(
17 '--fifepath',
18 help='Path to where the fife Python package is located',
19 default='',
20 dest='fifepath',
21 )
11 22
12 def configure(cnf): 23 def configure(cnf):
13 cnf.load('waf_paths python') 24 cnf.load('waf_paths python')
14 if sys.platform == 'Windows': 25 if sys.platform == 'Windows':
15 min_python_version = (2, 7) 26 min_python_version = (2, 7)
16 else: 27 else:
17 min_python_version = (2, 6) 28 min_python_version = (2, 6)
18 cnf.check_python_version(min_python_version) 29 cnf.check_python_version(min_python_version)
30
31 cnf.env['FIFEPATH'] = \
32 os.path.abspath(os.path.expanduser(cnf.options.fifepath)) or \
33 cnf.env['PYTHONDIR']
19 34
20 def build(bld): 35 def build(bld):
21 subst_vars = _get_subst_vars(bld) 36 subst_vars = _get_subst_vars(bld)
22 37
23 if sys.platform == 'Windows': 38 if sys.platform == 'Windows':
77 if os.path.isabs(path): 92 if os.path.isabs(path):
78 subst_vars[key] = os.path.join( 93 subst_vars[key] = os.path.join(
79 destdir, 94 destdir,
80 os.path.splitdrive(path)[1].lstrip('/\\'), 95 os.path.splitdrive(path)[1].lstrip('/\\'),
81 ) 96 )
97 subst_vars['FIFEPATH'] = cnf.env['FIFEPATH']
82 return subst_vars 98 return subst_vars