annotate SConstruct @ 12:d60f1dab8469

Fixed resource path dependencies issue that caused PARPG to crash on start. * PARPG should now run without issue (system installation not tested). * Utilized FIFE's VFS module to remove path dependencies from most PARPG modules. * The new parpg.vfs module is a singleton with a single global variable, VFS, which is a reference to the global VFS instance. Although a singleton is not ideal it should be replaced once PARPG's core code is refactored. * The parpg.vfs singleton is initialized in the parpg.applicaiton.PARPGApplication class with the absolute path to the data directory via the parpg.settings module and corresponding configuration file. * A new DataPath entry was added to the default system configuration file template under the [parpg] section to support the new parpg.vfs module. * Updated the parpg-assets subrepo to revision 3 to fix some dialog file format issues (for details see commit message for parpg-assets). * Fixed a few bugs in the parpg.dialogueparsers.YAMLDialogueParser class related to exception handling.
author M. George Hansen <technopolitica@gmail.com>
date Mon, 06 Jun 2011 15:56:14 -1000
parents 4706e0194af3
children de378945b839
rev   line source
2
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
1 import sys
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
2 import os
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
3 import platform
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
4 import compileall
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
5 import fnmatch
11
4706e0194af3 Various improvements to the build process including support for self-contained builds.
M. George Hansen <technopolitica@gmail.com>
parents: 6
diff changeset
6 from copy import copy
2
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
7 from collections import Sequence
5
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
8 from types import StringType
2
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
9 from multiprocessing import cpu_count
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
10
6
dd4ed4945411 Ported binary launcher to Windows.
M. George Hansen
parents: 5
diff changeset
11 from SCons.Util import is_Sequence, is_Dict
11
4706e0194af3 Various improvements to the build process including support for self-contained builds.
M. George Hansen <technopolitica@gmail.com>
parents: 6
diff changeset
12 from SCons.Tool.install import copyFunc
4706e0194af3 Various improvements to the build process including support for self-contained builds.
M. George Hansen <technopolitica@gmail.com>
parents: 6
diff changeset
13
4706e0194af3 Various improvements to the build process including support for self-contained builds.
M. George Hansen <technopolitica@gmail.com>
parents: 6
diff changeset
14 #def recursive_glob(topdir_path, include_pattern='*', exclude_pattern=''):
4706e0194af3 Various improvements to the build process including support for self-contained builds.
M. George Hansen <technopolitica@gmail.com>
parents: 6
diff changeset
15 # """
4706e0194af3 Various improvements to the build process including support for self-contained builds.
M. George Hansen <technopolitica@gmail.com>
parents: 6
diff changeset
16 # Locate all files matching supplied filename pattern in and below
4706e0194af3 Various improvements to the build process including support for self-contained builds.
M. George Hansen <technopolitica@gmail.com>
parents: 6
diff changeset
17 # supplied root directory.
4706e0194af3 Various improvements to the build process including support for self-contained builds.
M. George Hansen <technopolitica@gmail.com>
parents: 6
diff changeset
18 # """
4706e0194af3 Various improvements to the build process including support for self-contained builds.
M. George Hansen <technopolitica@gmail.com>
parents: 6
diff changeset
19 # for dir_path, subdir_names, file_names in \
4706e0194af3 Various improvements to the build process including support for self-contained builds.
M. George Hansen <technopolitica@gmail.com>
parents: 6
diff changeset
20 # os.walk(os.path.abspath(topdir_path)):
4706e0194af3 Various improvements to the build process including support for self-contained builds.
M. George Hansen <technopolitica@gmail.com>
parents: 6
diff changeset
21 # for file_name in fnmatch.filter(file_names, include_pattern):
4706e0194af3 Various improvements to the build process including support for self-contained builds.
M. George Hansen <technopolitica@gmail.com>
parents: 6
diff changeset
22 # if not fnmatch.fnmatch(file_name, exclude_pattern):
4706e0194af3 Various improvements to the build process including support for self-contained builds.
M. George Hansen <technopolitica@gmail.com>
parents: 6
diff changeset
23 # file_path = os.path.join(dir_path, file_name)
4706e0194af3 Various improvements to the build process including support for self-contained builds.
M. George Hansen <technopolitica@gmail.com>
parents: 6
diff changeset
24 # yield File(file_path)
4706e0194af3 Various improvements to the build process including support for self-contained builds.
M. George Hansen <technopolitica@gmail.com>
parents: 6
diff changeset
25 # for subdir_name in copy(subdir_names):
4706e0194af3 Various improvements to the build process including support for self-contained builds.
M. George Hansen <technopolitica@gmail.com>
parents: 6
diff changeset
26 # if not fnmatch.fnmatch(subdir_name, include_pattern) or \
4706e0194af3 Various improvements to the build process including support for self-contained builds.
M. George Hansen <technopolitica@gmail.com>
parents: 6
diff changeset
27 # fnmatch.fnmatch(subdir_name, exclude_pattern):
4706e0194af3 Various improvements to the build process including support for self-contained builds.
M. George Hansen <technopolitica@gmail.com>
parents: 6
diff changeset
28 # subdir_names.remove(subdir_name)
4706e0194af3 Various improvements to the build process including support for self-contained builds.
M. George Hansen <technopolitica@gmail.com>
parents: 6
diff changeset
29 # else:
4706e0194af3 Various improvements to the build process including support for self-contained builds.
M. George Hansen <technopolitica@gmail.com>
parents: 6
diff changeset
30 # subdir_path = os.path.join(dir_path, subdir_name)
6
dd4ed4945411 Ported binary launcher to Windows.
M. George Hansen
parents: 5
diff changeset
31
2
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
32 def InstallChmod(env, dest, source, mode):
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
33 targets = env.Install(dest, source)
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
34 for target in targets:
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
35 env.AddPostAction(target, Chmod(target, mode))
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
36 return targets
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
37
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
38 def InstallExecutable(env, dest, source):
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
39 return env.InstallChmod(dest, source, mode=0755)
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
40
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
41 def InstallReadOnly(env, dest, source):
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
42 if not isinstance(source, Sequence):
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
43 source = [source]
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
44 targets = []
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
45 for entry in map(Entry, source):
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
46 entry.disambiguate()
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
47 if entry.isdir():
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
48 target = env.InstallChmod(dest, entry, mode=0755)
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
49 elif entry.isfile():
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
50 target = env.InstallChmod(dest, entry, mode=0644)
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
51 else:
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
52 # Something really weird happened and entry is not a Dir or a
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
53 # File... (Note: Yes this can happen!)
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
54 error_message = \
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
55 'expected entry to be a Dir or a File, but got {0!r}'
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
56 raise ValueError(error_message.format(entry))
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
57 targets.append(target)
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
58 return targets
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
59
6
dd4ed4945411 Ported binary launcher to Windows.
M. George Hansen
parents: 5
diff changeset
60 def SubstfileEscape(env, *args, **kwargs):
dd4ed4945411 Ported binary launcher to Windows.
M. George Hansen
parents: 5
diff changeset
61 subst_dict = kwargs.get('SUBST_DICT') or env.get('SUBST_DICT')
dd4ed4945411 Ported binary launcher to Windows.
M. George Hansen
parents: 5
diff changeset
62 escape_sequences = kwargs.get('ESCAPE_SEQUENCES') or env.get('ESCAPE_SEQUENCES')
dd4ed4945411 Ported binary launcher to Windows.
M. George Hansen
parents: 5
diff changeset
63 if subst_dict is not None and escape_sequences is not None:
dd4ed4945411 Ported binary launcher to Windows.
M. George Hansen
parents: 5
diff changeset
64 if not is_Dict(subst_dict) and is_Sequence(subst_dict):
dd4ed4945411 Ported binary launcher to Windows.
M. George Hansen
parents: 5
diff changeset
65 subst_dict = dict(subst_dict)
dd4ed4945411 Ported binary launcher to Windows.
M. George Hansen
parents: 5
diff changeset
66 else:
dd4ed4945411 Ported binary launcher to Windows.
M. George Hansen
parents: 5
diff changeset
67 error_message = 'SUBST_DICT must be dict or sequence'
dd4ed4945411 Ported binary launcher to Windows.
M. George Hansen
parents: 5
diff changeset
68 raise SCons.Errors.UserError(error_message)
dd4ed4945411 Ported binary launcher to Windows.
M. George Hansen
parents: 5
diff changeset
69 escaped_subst_dict = {}
dd4ed4945411 Ported binary launcher to Windows.
M. George Hansen
parents: 5
diff changeset
70 for key, value in subst_dict.items():
dd4ed4945411 Ported binary launcher to Windows.
M. George Hansen
parents: 5
diff changeset
71 escaped_value = value
dd4ed4945411 Ported binary launcher to Windows.
M. George Hansen
parents: 5
diff changeset
72 for seq, escaped_seq in escape_sequences.items():
dd4ed4945411 Ported binary launcher to Windows.
M. George Hansen
parents: 5
diff changeset
73 escaped_value = escaped_value.replace(seq, escaped_seq)
dd4ed4945411 Ported binary launcher to Windows.
M. George Hansen
parents: 5
diff changeset
74 escaped_subst_dict[key] = escaped_value
dd4ed4945411 Ported binary launcher to Windows.
M. George Hansen
parents: 5
diff changeset
75 kwargs['SUBST_DICT'] = escaped_subst_dict
dd4ed4945411 Ported binary launcher to Windows.
M. George Hansen
parents: 5
diff changeset
76
dd4ed4945411 Ported binary launcher to Windows.
M. George Hansen
parents: 5
diff changeset
77 target = env.Substfile(*args, **kwargs)
dd4ed4945411 Ported binary launcher to Windows.
M. George Hansen
parents: 5
diff changeset
78 return target
dd4ed4945411 Ported binary launcher to Windows.
M. George Hansen
parents: 5
diff changeset
79
2
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
80 AddMethod(Environment, InstallChmod)
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
81 AddMethod(Environment, InstallExecutable)
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
82 AddMethod(Environment, InstallReadOnly)
6
dd4ed4945411 Ported binary launcher to Windows.
M. George Hansen
parents: 5
diff changeset
83 AddMethod(Environment, SubstfileEscape)
2
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
84
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
85 EnsurePythonVersion(2, 6)
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
86
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
87 AddOption(
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
88 '--stand-alone',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
89 dest='stand_alone',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
90 action='store_true',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
91 default=False,
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
92 help='install the entire program under installation prefix instead of in '
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
93 'various system folders'
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
94 )
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
95 AddOption(
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
96 '--no-compile',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
97 dest='compile',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
98 action='store_false',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
99 default=True,
5
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
100 help='don\'t compile any Python modules into .pyc files before installing',
2
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
101 )
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
102 SetOption('num_jobs', cpu_count())
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
103
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
104 def is_abs_path(key, val, env):
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
105 if not os.path.isabs(val):
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
106 error_message = '${key} must be an absolute path'
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
107 raise ValueError(error_message.format(key=key))
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
108 env[key] = os.path.normpath(val)
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
109
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
110 variables = Variables()
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
111 # NOTE M. George Hansen 2011-05-13: Path variables are based on the GNU
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
112 # standards as defined at http://www.gnu.org/prep/standards/html_node/Directory-Variables.html
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
113
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
114 # Platform-specific variable defaults.
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
115 # FIXME M. George Hansen 2011-05-12: Define the MacOS-specific
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
116 # environmental variables (and check version...)
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
117 platform_name = platform.system()
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
118 if platform_name in ['Linux', 'MacOS']:
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
119 if GetOption('stand_alone'):
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
120 PREFIX_DEFAULT = '/opt'
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
121 else:
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
122 PREFIX_DEFAULT = '/usr/local'
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
123 BIN_DIR_DEFAULT = '$EXEC_PREFIX/bin'
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
124 DATA_ROOT_DIR_DEFAULT = '$PREFIX/share/$PROJECT_NAME'
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
125 SYS_CONF_DIR_DEFAULT = '$PREFIX/etc/$PROJECT_NAME'
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
126 INCLUDE_DIR_DEFAULT = '$PREFIX/include/$PROJECT_NAME'
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
127 DOC_DIR_DEFAULT = '$DATA_ROOT_DIR/doc/$PROJECT_NAME'
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
128 LIB_DIR_DEFAULT = '$EXEC_PREFIX/lib'
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
129 dist_name, dist_version, dist_id = \
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
130 platform.linux_distribution(full_distribution_name=False)
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
131 if dist_name in ['debian', 'Ubuntu']:
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
132 # Debian uses dist-packages instead of site-packages for Python
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
133 # versions > 2.5.
5
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
134 PY_PACKAGES_DIR_DEFAULT = '$EXEC_PREFIX/lib/python$PY_VERSION_SHORT/' \
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
135 'dist-packages'
2
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
136 else:
5
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
137 PY_PACKAGES_DIR_DEFAULT = '$EXEC_PREFIX/lib/python$PY_VERSION_SHORT/' \
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
138 'site-packages'
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
139 PY_HEADERS_DIR_DEFAULT = '/usr/include/python$PY_VERSION_SHORT'
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
140 PY_LIB_DIR_DEFAULT = '/usr/lib'
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
141 PY_LIB_NAME = 'python$PY_VERSION_SHORT'
2
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
142 elif platform_name == 'Windows':
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
143 try:
5
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
144 PREFIX_DEFAULT = os.environ['PROGRAMFILES'] + r'\$PROGRAM_NAME'
2
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
145 except KeyError:
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
146 PREFIX_DEFAULT = ''
5
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
147 error_message = '%PROGRAMFILES% environmental variable is not ' \
2
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
148 'set, unable to determine path to Program Files ' \
5
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
149 'folder'
2
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
150 raise SConfWarning(error_message)
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
151 BIN_DIR_DEFAULT = '$EXEC_PREFIX'
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
152 DATA_ROOT_DIR_DEFAULT = '$PREFIX/data'
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
153 SYS_CONF_DIR_DEFAULT = '$PREFIX/config'
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
154 INCLUDE_DIR_DEFAULT = '$PREFIX/include'
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
155 DOC_DIR_DEFAULT = '$PREFIX/doc/'
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
156 LIB_DIR_DEFAULT = '$EXEC_PREFIX/lib'
5
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
157 # FIXME M. George Hansen 2011-05-12: Does sys.prefix include the
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
158 # PythonX.Y part on Windows?
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
159 python_prefix = sys.prefix
2
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
160 if GetOption('stand_alone'):
5
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
161 PY_PACKAGES_DIR_DEFAULT = '$PREFIX/lib'
2
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
162 else:
5
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
163 PY_PACKAGES_DIR_DEFAULT = \
2
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
164 os.path.join(python_prefix, 'Lib', 'site-packages')
5
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
165 PY_HEADERS_DIR_DEFAULT = os.path.join(python_prefix, 'include')
6
dd4ed4945411 Ported binary launcher to Windows.
M. George Hansen
parents: 5
diff changeset
166 PY_LIB_DIR_DEFAULT = os.path.join(python_prefix, 'libs')
5
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
167 PY_LIB_NAME = 'python$PY_VERSION_MAJOR$PY_VERSION_MINOR'
2
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
168
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
169 # Platform-independant variables:
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
170 variables.AddVariables(
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
171 PathVariable(
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
172 'PREFIX',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
173 'directory under which most or all of the program components should '
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
174 'be installed',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
175 PREFIX_DEFAULT,
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
176 is_abs_path,
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
177 ),
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
178 PathVariable(
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
179 'EXEC_PREFIX',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
180 'directory under which machine-specific compiled libraries and '
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
181 'objects should be installed',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
182 '$PREFIX',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
183 is_abs_path,
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
184 ),
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
185 PathVariable(
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
186 'BIN_DIR',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
187 'directory where program executables should be installed',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
188 BIN_DIR_DEFAULT,
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
189 is_abs_path,
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
190 ),
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
191 PathVariable(
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
192 'DATA_ROOT_DIR',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
193 'directory under which read-only, architecture-independant data files '
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
194 'should be installed',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
195 DATA_ROOT_DIR_DEFAULT,
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
196 is_abs_path,
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
197 ),
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
198 PathVariable(
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
199 'DATA_DIR',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
200 'directory where read-only, architecture-independant data files '
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
201 'should be installed',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
202 '$DATA_ROOT_DIR',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
203 is_abs_path,
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
204 ),
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
205 PathVariable(
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
206 'SYS_CONF_DIR',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
207 'directory where read-only, machine-specific data files should be '
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
208 'installed',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
209 SYS_CONF_DIR_DEFAULT,
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
210 is_abs_path,
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
211 ),
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
212 PathVariable(
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
213 'INCLUDE_DIR',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
214 'directory where C/C++ header files should be installed',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
215 INCLUDE_DIR_DEFAULT,
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
216 is_abs_path,
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
217 ),
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
218 PathVariable(
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
219 'DOC_DIR',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
220 'directory where program documentation should be installed',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
221 DOC_DIR_DEFAULT,
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
222 is_abs_path,
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
223 ),
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
224 PathVariable(
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
225 'LIB_DIR',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
226 'directory where platform-dependant, compiled library and object '
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
227 'files should be installed',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
228 LIB_DIR_DEFAULT,
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
229 is_abs_path,
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
230 ),
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
231 PathVariable(
5
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
232 'PY_PACKAGES_DIR',
2
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
233 'directory where pure Python modules and packages should be installed',
5
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
234 PY_PACKAGES_DIR_DEFAULT,
2
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
235 is_abs_path,
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
236 ),
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
237 PathVariable(
5
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
238 'PY_HEADERS_DIR',
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
239 'directory where Python.h can be found',
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
240 PY_HEADERS_DIR_DEFAULT,
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
241 ),
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
242 PathVariable(
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
243 'PY_LIB_DIR',
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
244 'directory where the Python shared library can be found',
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
245 PY_LIB_DIR_DEFAULT,
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
246 ),
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
247 BoolVariable(
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
248 'DEBUG',
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
249 'if True, compile the program launcher executable with debugging '
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
250 'symbols',
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
251 False,
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
252 ),
2
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
253 )
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
254
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
255 python_version_tuple = platform.python_version_tuple()
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
256
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
257 environment = Environment(
12
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
258 tools=['default', 'cpython', 'textfile', 'packaging'],
2
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
259 variables=variables,
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
260 PROJECT_NAME='parpg',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
261 PROJECT_VERSION_MAJOR=0,
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
262 PROJECT_VERSION_MINOR=2,
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
263 PROJECT_VERSION_PATCH=0,
5
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
264 PROJECT_VERSION_SHORT='${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MAJOR}',
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
265 PROJECT_VERSION_LONG='${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.'
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
266 '${PROJECT_VERSION_PATCH}',
2
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
267 PYTHON=sys.executable,
5
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
268 PY_VERSION_MAJOR=python_version_tuple[0],
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
269 PY_VERSION_MINOR=python_version_tuple[1],
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
270 PY_VERSION_PATCH=python_version_tuple[2],
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
271 PY_VERSION_SHORT='${PY_VERSION_MAJOR}.${PY_VERSION_MINOR}',
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
272 PY_VERSION_LONG='${PY_VERSION_MAJOR}.${PY_VERSION_MINOR}.'
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
273 '${PY_VERSION_PATCH}',
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
274 PY_LIB_NAME=PY_LIB_NAME,
12
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
275 BUILD_DIR=Dir('build'),
2
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
276 )
5
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
277 if environment['DEBUG']:
6
dd4ed4945411 Ported binary launcher to Windows.
M. George Hansen
parents: 5
diff changeset
278 if platform_name == 'Windows':
dd4ed4945411 Ported binary launcher to Windows.
M. George Hansen
parents: 5
diff changeset
279 environment['CCPDBFLAGS'] = '/Z7 /Od'
dd4ed4945411 Ported binary launcher to Windows.
M. George Hansen
parents: 5
diff changeset
280 environment.AppendUnique(LINKFLAGS='/DEBUG')
dd4ed4945411 Ported binary launcher to Windows.
M. George Hansen
parents: 5
diff changeset
281 else:
dd4ed4945411 Ported binary launcher to Windows.
M. George Hansen
parents: 5
diff changeset
282 environment.AppendUnique(CCFLAGS=['-gdwarf-2', '-g3'])
5
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
283
2
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
284 Help(variables.GenerateHelpText(environment))
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
285
12
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
286 local_config_dict = {
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
287 '@PREFIX@': '${BUILD_DIR.abspath}',
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
288 '@LIB_DIR@': '${BUILD_DIR.abspath}',
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
289 '@PY_PACKAGES_DIR@': '${BUILD_DIR.abspath}',
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
290 '@BIN_DIR@': '${BUILD_DIR.abspath}',
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
291 '@SYS_CONF_DIR@': '${BUILD_DIR.abspath}',
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
292 '@DATA_DIR@': '${BUILD_DIR.abspath}/data',
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
293 '@PYTHON@': '$PYTHON',
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
294 }
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
295 system_config_dict = [('@{0}@'.format(key), environment.Dictionary()[key]) for
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
296 key in ('PREFIX', 'LIB_DIR', 'PY_PACKAGES_DIR',
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
297 'BIN_DIR', 'SYS_CONF_DIR', 'DATA_DIR', 'PYTHON')]
2
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
298
12
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
299 build_py_packages = environment.Install(
11
4706e0194af3 Various improvements to the build process including support for self-contained builds.
M. George Hansen <technopolitica@gmail.com>
parents: 6
diff changeset
300 '$BUILD_DIR',
4706e0194af3 Various improvements to the build process including support for self-contained builds.
M. George Hansen <technopolitica@gmail.com>
parents: 6
diff changeset
301 'src/parpg',
4706e0194af3 Various improvements to the build process including support for self-contained builds.
M. George Hansen <technopolitica@gmail.com>
parents: 6
diff changeset
302 )
12
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
303 #build_py_packages = environment.InstallPython(
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
304 # '$BUILD_DIR/parpg',
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
305 # py_sources,
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
306 # PYTHON_COMPILE=GetOption('compile'),
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
307 #)
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
308 py_packages = environment.InstallPython(
5
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
309 '$PY_PACKAGES_DIR',
12
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
310 build_py_packages,
11
4706e0194af3 Various improvements to the build process including support for self-contained builds.
M. George Hansen <technopolitica@gmail.com>
parents: 6
diff changeset
311 PYTHON_COMPILE=GetOption('compile'),
4706e0194af3 Various improvements to the build process including support for self-contained builds.
M. George Hansen <technopolitica@gmail.com>
parents: 6
diff changeset
312 )
4706e0194af3 Various improvements to the build process including support for self-contained builds.
M. George Hansen <technopolitica@gmail.com>
parents: 6
diff changeset
313
12
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
314 data_subdirs = Glob('data/*')
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
315 build_data = environment.Install(
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
316 '$BUILD_DIR/data',
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
317 data_subdirs,
2
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
318 )
12
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
319 # FIXME M. George Hansen 2011-06-05: Chmod should make dirs 0755 and files
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
320 # 0644.
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
321 #environment.AddPostAction(build_data, Chmod(build_data, 0755))
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
322 data = environment.Install(
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
323 '$DATA_DIR',
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
324 build_data,
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
325 )
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
326 build_config_file = environment.Substfile(
11
4706e0194af3 Various improvements to the build process including support for self-contained builds.
M. George Hansen <technopolitica@gmail.com>
parents: 6
diff changeset
327 '$BUILD_DIR/parpg.cfg',
4706e0194af3 Various improvements to the build process including support for self-contained builds.
M. George Hansen <technopolitica@gmail.com>
parents: 6
diff changeset
328 'parpg.cfg.in',
12
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
329 SUBST_DICT=local_config_dict,
5
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
330 )
12
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
331 environment.AddPostAction(build_config_file, Chmod(build_config_file, 0644))
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
332 config_file = environment.Substfile(
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
333 '$SYS_CONF_DIR/parpg.cfg',
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
334 'parpg.cfg.in',
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
335 SUBST_DICT=system_config_dict,
2
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
336 )
12
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
337 environment.AddPostAction(config_file, Chmod(config_file, 0644))
5
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
338
11
4706e0194af3 Various improvements to the build process including support for self-contained builds.
M. George Hansen <technopolitica@gmail.com>
parents: 6
diff changeset
339 if platform_name == 'Windows':
12
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
340 launcher_source = 'parpg.bat'
11
4706e0194af3 Various improvements to the build process including support for self-contained builds.
M. George Hansen <technopolitica@gmail.com>
parents: 6
diff changeset
341 launcher_name = 'parpg.bat'
4706e0194af3 Various improvements to the build process including support for self-contained builds.
M. George Hansen <technopolitica@gmail.com>
parents: 6
diff changeset
342 else:
12
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
343 launcher_source = 'parpg.sh'
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
344 launcher_name = 'parpg'
11
4706e0194af3 Various improvements to the build process including support for self-contained builds.
M. George Hansen <technopolitica@gmail.com>
parents: 6
diff changeset
345 # FIXME M. George Hansen 2011-05-20: Do any other sequences need to be escaped?
12
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
346 build_launcher = environment.SubstfileEscape(
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
347 '$BUILD_DIR/$LAUNCHER_SOURCE',
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
348 'bin/${LAUNCHER_SOURCE}.in',
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
349 LAUNCHER_SOURCE=launcher_source,
11
4706e0194af3 Various improvements to the build process including support for self-contained builds.
M. George Hansen <technopolitica@gmail.com>
parents: 6
diff changeset
350 LAUNCHER_NAME=launcher_name,
12
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
351 SUBST_DICT=system_config_dict,
6
dd4ed4945411 Ported binary launcher to Windows.
M. George Hansen
parents: 5
diff changeset
352 ESCAPE_SEQUENCES={'\\': r'\\\\', '"': r'\\"'},
2
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
353 )
12
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
354 environment.AddPostAction(build_launcher, Chmod(build_launcher, 0755))
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
355 launcher = environment.InstallAs(
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
356 '$BIN_DIR/$LAUNCHER_NAME',
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
357 build_launcher,
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
358 )
2
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
359
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
360 # TODO M. George Hansen 2011-05-12: Implement package builder.
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
361 #package = environment.Package(
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
362 # NAME='parpg',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
363 # VERSION='0.2.0',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
364 # PACKAGEVERSION=0,
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
365 # LICENSE='gpl',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
366 # SUMMARY='',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
367 # DESCRIPTION='',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
368 # X_RPM_GROUP='Application/parpg',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
369 #)
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
370
12
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
371 build = Alias(
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
372 'build',
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
373 [build_launcher, build_config_file, build_py_packages, build_data],
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
374 )
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
375 install = Alias(
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
376 'install',
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
377 [build, launcher, config_file, py_packages, data],
d60f1dab8469 Fixed resource path dependencies issue that caused PARPG to crash on start.
M. George Hansen <technopolitica@gmail.com>
parents: 11
diff changeset
378 )
5
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
379
11
4706e0194af3 Various improvements to the build process including support for self-contained builds.
M. George Hansen <technopolitica@gmail.com>
parents: 6
diff changeset
380 Default(build)