annotate wscript @ 201:c0915e63a557

Added "Say" action.
author KarstenBock@gmx.net
date Thu, 15 Dec 2011 21:14:13 +0100
parents a2b1966ebe5a
children
rev   line source
16
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
1 #!/usr/bin/env python
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
2 # encoding: utf-8
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
3 import os
20
07ff8cf8a0f1 Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents: 18
diff changeset
4 import platform
16
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
5
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
6 APPNAME = 'parpg'
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
7 VERSION = '0.2.0'
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
8
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
9 def options(opt):
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
10 opt.load('waf_paths python')
18
2e2d6d9009a3 Added a --fifepath option to the WAF build script.
M. George Hansen <technopolitica@gmail.com>
parents: 16
diff changeset
11
2e2d6d9009a3 Added a --fifepath option to the WAF build script.
M. George Hansen <technopolitica@gmail.com>
parents: 16
diff changeset
12 ext_dep = opt.add_option_group(
2e2d6d9009a3 Added a --fifepath option to the WAF build script.
M. George Hansen <technopolitica@gmail.com>
parents: 16
diff changeset
13 'External dependencies',
2e2d6d9009a3 Added a --fifepath option to the WAF build script.
M. George Hansen <technopolitica@gmail.com>
parents: 16
diff changeset
14 '',
2e2d6d9009a3 Added a --fifepath option to the WAF build script.
M. George Hansen <technopolitica@gmail.com>
parents: 16
diff changeset
15 )
2e2d6d9009a3 Added a --fifepath option to the WAF build script.
M. George Hansen <technopolitica@gmail.com>
parents: 16
diff changeset
16 ext_dep.add_option(
2e2d6d9009a3 Added a --fifepath option to the WAF build script.
M. George Hansen <technopolitica@gmail.com>
parents: 16
diff changeset
17 '--fifepath',
2e2d6d9009a3 Added a --fifepath option to the WAF build script.
M. George Hansen <technopolitica@gmail.com>
parents: 16
diff changeset
18 help='Path to where the fife Python package is located',
2e2d6d9009a3 Added a --fifepath option to the WAF build script.
M. George Hansen <technopolitica@gmail.com>
parents: 16
diff changeset
19 default='',
2e2d6d9009a3 Added a --fifepath option to the WAF build script.
M. George Hansen <technopolitica@gmail.com>
parents: 16
diff changeset
20 dest='fifepath',
2e2d6d9009a3 Added a --fifepath option to the WAF build script.
M. George Hansen <technopolitica@gmail.com>
parents: 16
diff changeset
21 )
16
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
22
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
23 def configure(cnf):
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
24 cnf.load('waf_paths python')
21
feceb6130570 Fixed crash in WAF configure target.
M. George Hansen <technopolitica@gmail.com>
parents: 20
diff changeset
25 if platform.system() == 'Windows':
16
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
26 min_python_version = (2, 7)
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
27 else:
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
28 min_python_version = (2, 6)
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
29 cnf.check_python_version(min_python_version)
18
2e2d6d9009a3 Added a --fifepath option to the WAF build script.
M. George Hansen <technopolitica@gmail.com>
parents: 16
diff changeset
30
22
a2b1966ebe5a Fixed bug in wscript that caused FIFEPATH to be set to the wrong default.
M. George Hansen <technopolitica@gmail.com>
parents: 21
diff changeset
31 if cnf.options.fifepath:
20
07ff8cf8a0f1 Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents: 18
diff changeset
32 cnf.env['FIFEPATH'] = os.path.abspath(
07ff8cf8a0f1 Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents: 18
diff changeset
33 os.path.expanduser(cnf.options.fifepath)
07ff8cf8a0f1 Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents: 18
diff changeset
34 )
07ff8cf8a0f1 Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents: 18
diff changeset
35 else:
07ff8cf8a0f1 Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents: 18
diff changeset
36 cnf.env['FIFEPATH'] = cnf.env['PYTHONDIR']
16
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
37
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
38 def build(bld):
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
39 subst_vars = _get_subst_vars(bld)
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
40
20
07ff8cf8a0f1 Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents: 18
diff changeset
41 if platform.system() == 'Windows':
07ff8cf8a0f1 Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents: 18
diff changeset
42 launcher_template = bld.path.find_node('bin/parpg.bat.in')
07ff8cf8a0f1 Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents: 18
diff changeset
43 launcher = bld.path.find_or_declare('parpg.bat')
16
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
44 else:
20
07ff8cf8a0f1 Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents: 18
diff changeset
45 launcher_template = bld.path.find_node('bin/parpg.sh.in')
07ff8cf8a0f1 Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents: 18
diff changeset
46 launcher = bld.path.find_or_declare('parpg')
16
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
47 args = dict(
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
48 features='subst',
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
49 source=launcher_template,
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
50 target=launcher,
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
51 install_path='${BINDIR}',
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
52 chmod=0755,
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
53 )
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
54 args.update(subst_vars)
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
55 bld(**args)
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
56
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
57 bld(
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
58 features='py',
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
59 source=bld.path.ant_glob('src/parpg/**/*.py', dir=True),
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
60 install_from='src',
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
61 )
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
62
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
63 args = dict(
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
64 features='subst',
20
07ff8cf8a0f1 Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents: 18
diff changeset
65 source=bld.path.find_node('parpg.cfg.in'),
07ff8cf8a0f1 Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents: 18
diff changeset
66 target=bld.path.find_or_declare('parpg.cfg'),
16
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
67 install_path='${SYSCONFDIR}',
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
68 chmod=0644,
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
69 )
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
70 args.update(subst_vars)
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
71 bld(**args)
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
72
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
73 bld.install_files(
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
74 files=bld.path.find_node('data').ant_glob('**/*'),
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
75 dest='${DATADIR}',
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
76 relative_trick=True,
20
07ff8cf8a0f1 Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents: 18
diff changeset
77 cwd=bld.path.find_node('data'),
16
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
78 chmod=0644,
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
79 )
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
80
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
81 def _get_subst_vars(cnf):
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
82 # Set up substitution variables for the launcher and configuration files.
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
83 subst_vars = {}
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
84 install_path_names = cnf.env['INSTALL_PATHS']
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
85 for path_name in install_path_names + ['PYTHONDIR']:
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
86 subst_vars[path_name] = cnf.env[path_name]
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
87 # If the destdir option is used we'll have to manually prefix any path
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
88 # variables with it since env doesn't get updated.
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
89 # NOTE M. George Hansen 2011-06-09: This should probably be done
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
90 # automatically. Maybe we should patch WAF and contribute it the WAF
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
91 # project.
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
92 destdir = cnf.options.destdir
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
93 if destdir:
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
94 for key, path in subst_vars.items():
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
95 # If this is an absolute path, prefix it with the destdir.
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
96 if os.path.isabs(path):
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
97 subst_vars[key] = os.path.join(
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
98 destdir,
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
99 os.path.splitdrive(path)[1].lstrip('/\\'),
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
100 )
18
2e2d6d9009a3 Added a --fifepath option to the WAF build script.
M. George Hansen <technopolitica@gmail.com>
parents: 16
diff changeset
101 subst_vars['FIFEPATH'] = cnf.env['FIFEPATH']
16
927f2cf75357 Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
102 return subst_vars