annotate SConstruct @ 5:33684971cdb1

Replaced the shell script launcher with a cross-platform C executable. * Replaced the Unix-only shell script launcher with a cross-platform compiled executable written in C. * Added several new configuration variables to the SConsctruct script which allows the user to specify where their Python site-packages and executable are located; * Cleaned up the SConstruct script and made it easier to grok.
author M. George Hansen <technopolitica@gmail.com>
date Tue, 17 May 2011 14:18:25 -0700
parents e2a8e3805b04
children dd4ed4945411
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
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
6 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
7 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
8 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
9
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
10 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
11 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
12 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
13 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
14 return targets
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
15
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
16 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
17 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
18
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
19 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
20 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
21 source = [source]
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
22 targets = []
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
23 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
24 entry.disambiguate()
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
25 if entry.isdir():
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
26 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
27 elif entry.isfile():
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
28 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
29 else:
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
30 # 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
31 # 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
32 error_message = \
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
33 '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
34 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
35 targets.append(target)
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 InstallPyPackages(env, dest, source, compile=True):
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
39 # Remove all existing *.pyc and *.pyo files for a sanitary install
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
40 # environment.
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
41 def _remove_compiled_modules(path):
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
42 for dir_path, dir_names, file_names in os.walk(path):
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
43 for file_name in fnmatch.filter(file_names, '*.py[co]'):
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
44 file_path = os.path.join(dir_path, file_name)
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
45 os.remove(file_path)
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
46
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
47 def _add_targets(path):
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
48 for dir_path, dir_names, file_names in os.walk(path):
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
49 for file_name in fnmatch.filter(file_names, '*.py[co]'):
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
50 file_path = os.path.join(dir_path, file_name)
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
51 env.Clean(path, file_path)
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
52 source_file_path = file_path.rstrip('oc')
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
53 env.Depends(file_path, source_file_path)
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
54
5
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
55 if not isinstance(source, Sequence) or isinstance(source, StringType):
2
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
56 source = [source]
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
57 for dir in source:
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
58 _remove_compiled_modules(str(dir))
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
59 if compile:
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
60 compileall.compile_dir(str(dir), ddir=str(dest), force=True)
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
61 _add_targets(str(dir))
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
62 targets = env.InstallReadOnly(dest, source)
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
63 return targets
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
64
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
65 AddMethod(Environment, InstallChmod)
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
66 AddMethod(Environment, InstallExecutable)
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
67 AddMethod(Environment, InstallReadOnly)
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
68 AddMethod(Environment, InstallPyPackages)
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
69
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
70 EnsurePythonVersion(2, 6)
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
71
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
72 AddOption(
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
73 '--stand-alone',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
74 dest='stand_alone',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
75 action='store_true',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
76 default=False,
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
77 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
78 'various system folders'
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
79 )
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
80 AddOption(
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
81 '--no-compile',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
82 dest='compile',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
83 action='store_false',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
84 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
85 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
86 )
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
87 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
88
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
89 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
90 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
91 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
92 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
93 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
94
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
95 variables = Variables()
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
96 # 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
97 # 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
98
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
99 # 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
100 # 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
101 # 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
102 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
103 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
104 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
105 PREFIX_DEFAULT = '/opt'
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
106 else:
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
107 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
108 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
109 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
110 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
111 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
112 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
113 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
114 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
115 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
116 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
117 # 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
118 # 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
119 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
120 'dist-packages'
2
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
121 else:
5
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
122 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
123 'site-packages'
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
124 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
125 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
126 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
127 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
128 try:
5
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
129 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
130 except KeyError:
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
131 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
132 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
133 '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
134 'folder'
2
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
135 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
136 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
137 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
138 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
139 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
140 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
141 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
142 PY_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
143 # 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
144 # 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
145 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
146 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
147 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
148 else:
5
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
149 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
150 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
151 PY_HEADERS_DIR_DEFAULT = os.path.join(python_prefix, 'include')
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
152 try:
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
153 PY_LIB_DIR_DEFAULT = os.environ['SYSTEMROOT']
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
154 except KeyError:
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
155 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
156 error_message = '%SYSTEMROOT% environmental variable is not set, ' \
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
157 'unable to determine path to Windows system folder'
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
158 raise SConfWarning(error_message)
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
159 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
160
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
161 # Platform-independant variables:
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
162 variables.AddVariables(
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
163 PathVariable(
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
164 'PREFIX',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
165 '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
166 'be installed',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
167 PREFIX_DEFAULT,
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
168 is_abs_path,
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
169 ),
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
170 PathVariable(
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
171 'EXEC_PREFIX',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
172 '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
173 '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
174 '$PREFIX',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
175 is_abs_path,
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
176 ),
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
177 PathVariable(
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
178 'BIN_DIR',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
179 '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
180 BIN_DIR_DEFAULT,
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
181 is_abs_path,
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
182 ),
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
183 PathVariable(
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
184 'DATA_ROOT_DIR',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
185 '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
186 'should be installed',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
187 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
188 is_abs_path,
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
189 ),
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
190 PathVariable(
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
191 'DATA_DIR',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
192 '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
193 'should be installed',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
194 '$DATA_ROOT_DIR',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
195 is_abs_path,
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
196 ),
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
197 PathVariable(
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
198 'SYS_CONF_DIR',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
199 '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
200 'installed',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
201 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
202 is_abs_path,
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
203 ),
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
204 PathVariable(
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
205 'INCLUDE_DIR',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
206 '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
207 INCLUDE_DIR_DEFAULT,
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
208 is_abs_path,
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
209 ),
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
210 PathVariable(
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
211 'DOC_DIR',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
212 '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
213 DOC_DIR_DEFAULT,
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
214 is_abs_path,
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
215 ),
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
216 PathVariable(
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
217 'LIB_DIR',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
218 '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
219 '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
220 LIB_DIR_DEFAULT,
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
221 is_abs_path,
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
222 ),
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
223 PathVariable(
5
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
224 '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
225 '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
226 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
227 is_abs_path,
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
228 ),
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
229 PathVariable(
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
230 'INCLUDE_DIR',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
231 '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
232 INCLUDE_DIR_DEFAULT,
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
233 is_abs_path,
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
234 ),
5
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
235 PathVariable(
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
236 '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
237 '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
238 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
239 ),
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
240 PathVariable(
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
241 '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
242 '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
243 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
244 ),
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
245 BoolVariable(
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
246 'DEBUG',
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
247 '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
248 'symbols',
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
249 False,
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
250 ),
2
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
251 )
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
252
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
253 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
254 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
255
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
256 environment = Environment(
5
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
257 tools=['default', 'cc', 'textfile', 'packaging'],
2
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
258 variables=variables,
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
259 PROJECT_NAME='parpg',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
260 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
261 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
262 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
263 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
264 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
265 '${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
266 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
267 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
268 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
269 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
270 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
271 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
272 '${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
273 PY_LIB_NAME=PY_LIB_NAME,
2
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
274 PY_PACKAGES=[],
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
275 CONFIG_FILES=[],
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
276 DATA_FILES=[],
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
277 EXECUTABLES=[],
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
278 )
5
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
279 if environment['DEBUG']:
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
280 environment.AppendUnique(CCFLAGS=['-gdwarf-2', '-g3'])
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
281
2
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
282 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
283
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
284 config_dict = [('@{0}@'.format(key), environment.Dictionary()[key]) for key in
5
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
285 ('PREFIX', 'LIB_DIR', 'PY_PACKAGES_DIR', 'BIN_DIR',
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
286 '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
287
5
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
288 install_py_packages = environment.InstallPyPackages(
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
289 '$PY_PACKAGES_DIR',
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
290 'src/parpg',
2
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
291 compile=GetOption('compile'),
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
292 )
5
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
293
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
294 subst_config_file = environment.Substfile(
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
295 'system.cfg.in',
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
296 SUBST_DICT=config_dict
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
297 )
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
298 install_config_files = environment.InstallChmod(
2
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
299 '$SYS_CONF_DIR',
5
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
300 subst_config_file,
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
301 mode=0755
2
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
302 )
5
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
303 Requires(install_config_files, subst_config_file)
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
304
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
305 install_data = environment.InstallReadOnly(
2
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
306 '$DATA_DIR',
5
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
307 Glob('data/*'),
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
308 )
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
309
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
310 executable_source = environment.Substfile(
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
311 'bin/parpg.c.in',
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
312 SUBST_DICT=config_dict,
2
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
313 )
5
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
314 build_executable = environment.Program(
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
315 executable_source,
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
316 LIBS=['$PY_LIB_NAME'],
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
317 LIBPATH='$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
318 CPPPATH=['$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
319 )
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
320 # FIXME M. George Hansen 2011-05-17: Should the executable target be hard-coded
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
321 # like this?
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
322 install_executable = environment.InstallExecutable(
2
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
323 '$BIN_DIR',
5
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
324 'bin/parpg',
2
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
325 )
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
326
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
327 # 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
328 #package = environment.Package(
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
329 # NAME='parpg',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
330 # 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
331 # PACKAGEVERSION=0,
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
332 # LICENSE='gpl',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
333 # SUMMARY='',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
334 # DESCRIPTION='',
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
335 # 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
336 #)
e2a8e3805b04 Made parpg-core the main repository to pull from and build.
M. George Hansen <technopolitica@gmail.com>
parents:
diff changeset
337
5
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
338 build = Alias('build', [build_executable])
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
339 install = Alias('install', [build, install_executable, install_py_packages,
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
340 install_config_files, install_data])
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
341
33684971cdb1 Replaced the shell script launcher with a cross-platform C executable.
M. George Hansen <technopolitica@gmail.com>
parents: 2
diff changeset
342 Default(install)