Mercurial > parpg-core
changeset 202:7747b0f73694
Removed waf scripts
author | KarstenBock@gmx.net |
---|---|
date | Thu, 12 Jan 2012 18:01:28 +0100 |
parents | c0915e63a557 |
children | 92bb014104ee |
files | waf.py waf_paths.py wscript |
diffstat | 3 files changed, 0 insertions(+), 246 deletions(-) [+] |
line wrap: on
line diff
--- a/waf_paths.py Thu Dec 15 21:14:13 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,144 +0,0 @@ -#! /usr/bin/env python -# encoding: utf-8 -import os -import platform -import re - -from waflib import Utils, Options, Context, Logs, Errors - -try: - from collections import OrderedDict -except ImportError: - # Python 2.6 doesn't have an OrderedDict, so we'll provide one. - from ordereddict import OrderedDict - -prefix_values = OrderedDict( - [ - ('prefix', ['installation prefix', '/usr/local']), - ('exec_prefix', - ['installation prefix for platform-dependent binary files', - '${PREFIX}']) - ] -) - -option_values = OrderedDict( - [ - ('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 platform.system() == 'Windows': - prefix_values['prefix'][1] = '${PROGRAMFILES}/${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' - del option_values['oldincludedir'] - del option_values['mandir'] - -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"' - ) - help_template = '{0} [Default: %default]' - for prefix_name in prefix_values.keys(): - # Remove any of the core WAF options if they conflict with our options. - if opt.parser.get_option(prefix_name): - opt.parser.remove_option(prefix_name) - help, default = prefix_values[prefix_name] - option_name = '--' + prefix_name - inst_dir.add_option(option_name, help=help_template.format(help), - default=default, dest=prefix_name) - - # Move the --destdir option to the inst_dir group for consistency. - destdir_option = opt.parser.get_option('destdir') - if destdir_option: - opt.parser.remove_option('destdir') - inst_dir.add_option(destdir_option) - - predef_dirs = opt.add_option_group( - 'Pre-defined installation directories', - '' - ) - for name in option_values: - help, default = option_values[name] - option_name = '--' + name - predef_dirs.add_option(option_name, help=help_template.format(help), - default=default, dest=name) - -def configure(conf): - def set_env_paths(path_values): - errors_raised = False - index = 0 - for option_name in path_values.keys(): - help, default = path_values[option_name] - upper_option_name = option_name.upper() - try: - env[upper_option_name] = Utils.subst_vars( - getattr(conf.options, option_name), - env, - ) - except TypeError: - errors_raised = True - env['INSTALL_PATHS'].append(upper_option_name) - if errors_raised: - failed_path_names = [name for name in option_values if - upper_option_name not in env] - else: - failed_path_names = [] - return failed_path_names - - env = conf.env - if platform.system() == 'Windows': - try: - env['PROGRAMFILES'] = os.environ['PROGRAMFILES'] - except KeyError: - Logs.warn('PROGRAMFILES environmental variable is not set') - if re.search(r'\$\{PROGRAMFILES\}', conf.options.prefix): - Logs.error( - 'unable to find path to Program Files direcotry, please ' - 'set the PROGRAMFILES environmental variable or ' - 'override installation prefix with --prefix' - ) - if 'APPNAME' not in env: - env['APPNAME'] = Context.g_module.APPNAME - env['INSTALL_PATHS'] = [] - failed_path_names = [] - failed_path_names.extend(set_env_paths(prefix_values)) - failed_path_names.extend(set_env_paths(option_values)) - if failed_path_names: - error_message = 'failed to expand install paths {0!r}' - raise Errors.ConfigurationError( - error_message.format(failed_path_names) - )
--- a/wscript Thu Dec 15 21:14:13 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +0,0 @@ -#!/usr/bin/env python -# encoding: utf-8 -import os -import platform - -APPNAME = 'parpg' -VERSION = '0.2.0' - -def options(opt): - opt.load('waf_paths python') - - ext_dep = opt.add_option_group( - 'External dependencies', - '', - ) - ext_dep.add_option( - '--fifepath', - help='Path to where the fife Python package is located', - default='', - dest='fifepath', - ) - -def configure(cnf): - cnf.load('waf_paths python') - if platform.system() == 'Windows': - min_python_version = (2, 7) - else: - min_python_version = (2, 6) - cnf.check_python_version(min_python_version) - - if cnf.options.fifepath: - cnf.env['FIFEPATH'] = os.path.abspath( - os.path.expanduser(cnf.options.fifepath) - ) - else: - cnf.env['FIFEPATH'] = cnf.env['PYTHONDIR'] - -def build(bld): - subst_vars = _get_subst_vars(bld) - - if platform.system() == 'Windows': - launcher_template = bld.path.find_node('bin/parpg.bat.in') - launcher = bld.path.find_or_declare('parpg.bat') - else: - launcher_template = bld.path.find_node('bin/parpg.sh.in') - launcher = bld.path.find_or_declare('parpg') - args = dict( - features='subst', - source=launcher_template, - target=launcher, - install_path='${BINDIR}', - chmod=0755, - ) - args.update(subst_vars) - bld(**args) - - bld( - features='py', - source=bld.path.ant_glob('src/parpg/**/*.py', dir=True), - install_from='src', - ) - - args = dict( - features='subst', - source=bld.path.find_node('parpg.cfg.in'), - target=bld.path.find_or_declare('parpg.cfg'), - install_path='${SYSCONFDIR}', - chmod=0644, - ) - args.update(subst_vars) - bld(**args) - - bld.install_files( - files=bld.path.find_node('data').ant_glob('**/*'), - dest='${DATADIR}', - relative_trick=True, - cwd=bld.path.find_node('data'), - chmod=0644, - ) - -def _get_subst_vars(cnf): - # Set up substitution variables for the launcher and configuration files. - subst_vars = {} - install_path_names = cnf.env['INSTALL_PATHS'] - for path_name in install_path_names + ['PYTHONDIR']: - subst_vars[path_name] = cnf.env[path_name] - # If the destdir option is used we'll have to manually prefix any path - # variables with it since env doesn't get updated. - # NOTE M. George Hansen 2011-06-09: This should probably be done - # automatically. Maybe we should patch WAF and contribute it the WAF - # project. - destdir = cnf.options.destdir - if destdir: - for key, path in subst_vars.items(): - # If this is an absolute path, prefix it with the destdir. - if os.path.isabs(path): - subst_vars[key] = os.path.join( - destdir, - os.path.splitdrive(path)[1].lstrip('/\\'), - ) - subst_vars['FIFEPATH'] = cnf.env['FIFEPATH'] - return subst_vars \ No newline at end of file