Mercurial > parpg-core
view waf_paths.py @ 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 | 15107282d9eb |
children | 07ff8cf8a0f1 |
line wrap: on
line source
#! /usr/bin/env python # encoding: utf-8 import sys from waflib import Utils, Options, Context option_values = { 'bindir' : ('user executables', '${EXEC_PREFIX}/bin'), 'sbindir' : ('system admin executables', '${EXEC_PREFIX}/sbin'), 'libexecdir' : ('program executables', '${EXEC_PREFIX}/libexec'), 'sharedstatedir': ('modifiable architecture-independent data', '${PREFIX}/com'), 'localstatedir' : ('modifiable single-machine data', '${PREFIX}/var'), 'libdir' : ('object code libraries', '${EXEC_PREFIX}/lib'), 'includedir' : ('C header files', '${PREFIX}/include'), 'oldincludedir' : ('C header files for non-gcc', '/usr/include'), 'datarootdir' : ('read-only arch.-independent data root', '${PREFIX}/share'), # datadir and sysconfdir definitions deviate from GNU standards by # appending the ${APPNAME}, but it makes the install script simpler since # we don't have to redefine install paths on Windows. 'datadir' : ('read-only architecture-independent data', '${DATAROOTDIR}/${APPNAME}'), 'sysconfdir' : ('read-only single-machine data', '${PREFIX}/etc/${APPNAME}'), 'infodir' : ('info documentation', '${DATAROOTDIR}/info'), 'localedir' : ('locale-dependent data', '${DATAROOTDIR}/locale'), 'mandir' : ('man documentation', '${DATAROOTDIR}/man'), 'docdir' : ('documentation root', '${DATAROOTDIR}/doc/${APPNAME}'), 'htmldir' : ('html documentation', '${DOCDIR}'), 'dvidir' : ('dvi documentation', '${DOCDIR}'), 'pdfdir' : ('pdf documentation', '${DOCDIR}'), 'psdir' : ('ps documentation', '${DOCDIR}'), } if sys.platform == 'Windows': option_values['PREFIX'][1] = '${PROGRAM_FILES}/${APPNAME}' option_values['BINDIR'][1] = '${EXEC_PREFIX}' option_values['SYSCONFDIR'][1] = '${PREFIX}' option_values['DATAROOTDIR'][1] = '${PREFIX}' option_values['DATADIR'][1] = '${DATAROOTDIR}/data' option_values['DOCDIR'][1] = '${DATAROOTDIR}/doc' def get_param(varname, default): return getattr(Options.options, varname, '') or default def configure(conf): env = conf.env env['LIBDIR'] = [] env['BINDIR'] = [] env['EXEC_PREFIX'] = get_param('EXEC_PREFIX', env['PREFIX']) env['APPNAME'] = getattr(Context.g_module, 'APPNAME') env['INSTALL_PATHS'] = ['PREFIX', 'EXEC_PREFIX'] complete = False iter = 0 while not complete and iter < len(option_values) + 1: iter += 1 complete = True for name in option_values: help, default = option_values[name] name = name.upper() if not env[name]: try: env[name] = Utils.subst_vars(get_param(name, default), env) except TypeError: complete = False env['INSTALL_PATHS'].append(name) if not complete: lst = [name for name in option_values if not env[name.upper()]] raise Errors.WafError('Variable substitution failure %r' % lst) def options(opt): inst_dir = opt.add_option_group( 'Installation directories', 'By default, "waf install" will install all files into their ' 'appropriate directories under ${PREFIX}. The installation prefix can ' 'be specified using the "--prefix" option, for example ' '"--prefix=$HOME"' ) for k in ('--prefix', '--destdir'): option = opt.parser.get_option(k) if option: opt.parser.remove_option(k) inst_dir.add_option(option) inst_dir.add_option( '--exec-prefix', help='installation prefix [Default: ${PREFIX}]', default=inst_dir.defaults['prefix'], dest='EXEC_PREFIX', ) dirs_options = opt.add_option_group( 'Pre-defined installation directories', '' ) for name in option_values: help, default = option_values[name] option_name = '--' + name str_help = '{0} [Default: %default]'.format(help) dirs_options.add_option(option_name, help=str_help, default=default, dest=name.upper())