Mercurial > parpg-core
comparison 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 |
comparison
equal
deleted
inserted
replaced
11:4706e0194af3 | 12:d60f1dab8469 |
---|---|
233 'directory where pure Python modules and packages should be installed', | 233 'directory where pure Python modules and packages should be installed', |
234 PY_PACKAGES_DIR_DEFAULT, | 234 PY_PACKAGES_DIR_DEFAULT, |
235 is_abs_path, | 235 is_abs_path, |
236 ), | 236 ), |
237 PathVariable( | 237 PathVariable( |
238 'INCLUDE_DIR', | |
239 'directory where C/C++ header files should be installed', | |
240 INCLUDE_DIR_DEFAULT, | |
241 is_abs_path, | |
242 ), | |
243 PathVariable( | |
244 'PY_HEADERS_DIR', | 238 'PY_HEADERS_DIR', |
245 'directory where Python.h can be found', | 239 'directory where Python.h can be found', |
246 PY_HEADERS_DIR_DEFAULT, | 240 PY_HEADERS_DIR_DEFAULT, |
247 ), | 241 ), |
248 PathVariable( | 242 PathVariable( |
259 ) | 253 ) |
260 | 254 |
261 python_version_tuple = platform.python_version_tuple() | 255 python_version_tuple = platform.python_version_tuple() |
262 | 256 |
263 environment = Environment( | 257 environment = Environment( |
264 tools=['default', 'cpython', 'copyrecurse', 'textfile', 'packaging'], | 258 tools=['default', 'cpython', 'textfile', 'packaging'], |
265 variables=variables, | 259 variables=variables, |
266 PROJECT_NAME='parpg', | 260 PROJECT_NAME='parpg', |
267 PROJECT_VERSION_MAJOR=0, | 261 PROJECT_VERSION_MAJOR=0, |
268 PROJECT_VERSION_MINOR=2, | 262 PROJECT_VERSION_MINOR=2, |
269 PROJECT_VERSION_PATCH=0, | 263 PROJECT_VERSION_PATCH=0, |
276 PY_VERSION_PATCH=python_version_tuple[2], | 270 PY_VERSION_PATCH=python_version_tuple[2], |
277 PY_VERSION_SHORT='${PY_VERSION_MAJOR}.${PY_VERSION_MINOR}', | 271 PY_VERSION_SHORT='${PY_VERSION_MAJOR}.${PY_VERSION_MINOR}', |
278 PY_VERSION_LONG='${PY_VERSION_MAJOR}.${PY_VERSION_MINOR}.' | 272 PY_VERSION_LONG='${PY_VERSION_MAJOR}.${PY_VERSION_MINOR}.' |
279 '${PY_VERSION_PATCH}', | 273 '${PY_VERSION_PATCH}', |
280 PY_LIB_NAME=PY_LIB_NAME, | 274 PY_LIB_NAME=PY_LIB_NAME, |
281 BUILD_DIR='build', | 275 BUILD_DIR=Dir('build'), |
282 ) | 276 ) |
283 if environment['DEBUG']: | 277 if environment['DEBUG']: |
284 if platform_name == 'Windows': | 278 if platform_name == 'Windows': |
285 environment['CCPDBFLAGS'] = '/Z7 /Od' | 279 environment['CCPDBFLAGS'] = '/Z7 /Od' |
286 environment.AppendUnique(LINKFLAGS='/DEBUG') | 280 environment.AppendUnique(LINKFLAGS='/DEBUG') |
287 else: | 281 else: |
288 environment.AppendUnique(CCFLAGS=['-gdwarf-2', '-g3']) | 282 environment.AppendUnique(CCFLAGS=['-gdwarf-2', '-g3']) |
289 | 283 |
290 Help(variables.GenerateHelpText(environment)) | 284 Help(variables.GenerateHelpText(environment)) |
291 | 285 |
292 config_dict = [('@{0}@'.format(key), environment.Dictionary()[key]) for key in | 286 local_config_dict = { |
293 ('PREFIX', 'LIB_DIR', 'PY_PACKAGES_DIR', 'BIN_DIR', | 287 '@PREFIX@': '${BUILD_DIR.abspath}', |
294 'SYS_CONF_DIR', 'DATA_DIR', 'PYTHON')] | 288 '@LIB_DIR@': '${BUILD_DIR.abspath}', |
295 | 289 '@PY_PACKAGES_DIR@': '${BUILD_DIR.abspath}', |
296 copy_py_packages = environment.Install( | 290 '@BIN_DIR@': '${BUILD_DIR.abspath}', |
291 '@SYS_CONF_DIR@': '${BUILD_DIR.abspath}', | |
292 '@DATA_DIR@': '${BUILD_DIR.abspath}/data', | |
293 '@PYTHON@': '$PYTHON', | |
294 } | |
295 system_config_dict = [('@{0}@'.format(key), environment.Dictionary()[key]) for | |
296 key in ('PREFIX', 'LIB_DIR', 'PY_PACKAGES_DIR', | |
297 'BIN_DIR', 'SYS_CONF_DIR', 'DATA_DIR', 'PYTHON')] | |
298 | |
299 build_py_packages = environment.Install( | |
297 '$BUILD_DIR', | 300 '$BUILD_DIR', |
298 'src/parpg', | 301 'src/parpg', |
299 ) | 302 ) |
300 install_py_packages = environment.InstallPython( | 303 #build_py_packages = environment.InstallPython( |
304 # '$BUILD_DIR/parpg', | |
305 # py_sources, | |
306 # PYTHON_COMPILE=GetOption('compile'), | |
307 #) | |
308 py_packages = environment.InstallPython( | |
301 '$PY_PACKAGES_DIR', | 309 '$PY_PACKAGES_DIR', |
302 copy_py_packages, | 310 build_py_packages, |
303 PYTHON_COMPILE=GetOption('compile'), | 311 PYTHON_COMPILE=GetOption('compile'), |
304 ) | 312 ) |
305 | 313 |
306 copy_data = environment.CopyRecurse( | 314 data_subdirs = Glob('data/*') |
307 '$BUILD_DIR', | 315 build_data = environment.Install( |
308 'data', | 316 '$BUILD_DIR/data', |
309 ) | 317 data_subdirs, |
310 | 318 ) |
311 subst_config_file = environment.Substfile( | 319 # FIXME M. George Hansen 2011-06-05: Chmod should make dirs 0755 and files |
320 # 0644. | |
321 #environment.AddPostAction(build_data, Chmod(build_data, 0755)) | |
322 data = environment.Install( | |
323 '$DATA_DIR', | |
324 build_data, | |
325 ) | |
326 build_config_file = environment.Substfile( | |
312 '$BUILD_DIR/parpg.cfg', | 327 '$BUILD_DIR/parpg.cfg', |
313 'parpg.cfg.in', | 328 'parpg.cfg.in', |
314 SUBST_DICT=config_dict, | 329 SUBST_DICT=local_config_dict, |
315 ) | 330 ) |
316 install_config_files = environment.InstallChmod( | 331 environment.AddPostAction(build_config_file, Chmod(build_config_file, 0644)) |
317 '$SYS_CONF_DIR', | 332 config_file = environment.Substfile( |
318 subst_config_file, | 333 '$SYS_CONF_DIR/parpg.cfg', |
319 mode=0755, | 334 'parpg.cfg.in', |
320 ) | 335 SUBST_DICT=system_config_dict, |
321 Requires(install_config_files, subst_config_file) | 336 ) |
337 environment.AddPostAction(config_file, Chmod(config_file, 0644)) | |
322 | 338 |
323 if platform_name == 'Windows': | 339 if platform_name == 'Windows': |
340 launcher_source = 'parpg.bat' | |
324 launcher_name = 'parpg.bat' | 341 launcher_name = 'parpg.bat' |
325 else: | 342 else: |
326 launcher_name = 'parpg.sh' | 343 launcher_source = 'parpg.sh' |
344 launcher_name = 'parpg' | |
327 # FIXME M. George Hansen 2011-05-20: Do any other sequences need to be escaped? | 345 # FIXME M. George Hansen 2011-05-20: Do any other sequences need to be escaped? |
328 launcher = environment.SubstfileEscape( | 346 build_launcher = environment.SubstfileEscape( |
329 'build/$LAUNCHER_NAME', | 347 '$BUILD_DIR/$LAUNCHER_SOURCE', |
330 'bin/${LAUNCHER_NAME}.in', | 348 'bin/${LAUNCHER_SOURCE}.in', |
349 LAUNCHER_SOURCE=launcher_source, | |
331 LAUNCHER_NAME=launcher_name, | 350 LAUNCHER_NAME=launcher_name, |
332 SUBST_DICT=config_dict, | 351 SUBST_DICT=system_config_dict, |
333 ESCAPE_SEQUENCES={'\\': r'\\\\', '"': r'\\"'}, | 352 ESCAPE_SEQUENCES={'\\': r'\\\\', '"': r'\\"'}, |
334 ) | 353 ) |
335 if platform_name == 'Windows': | 354 environment.AddPostAction(build_launcher, Chmod(build_launcher, 0755)) |
336 install_launcher = environment.InstallExecutable( | 355 launcher = environment.InstallAs( |
337 '$BIN_DIR', | 356 '$BIN_DIR/$LAUNCHER_NAME', |
338 launcher, | 357 build_launcher, |
339 ) | 358 ) |
340 else: | |
341 # Remove the .sh suffix, since it isn't needed on unix platforms. | |
342 install_launcher = environment.InstallAs( | |
343 '$BIN_DIR/parpg', | |
344 launcher, | |
345 ) | |
346 | 359 |
347 # TODO M. George Hansen 2011-05-12: Implement package builder. | 360 # TODO M. George Hansen 2011-05-12: Implement package builder. |
348 #package = environment.Package( | 361 #package = environment.Package( |
349 # NAME='parpg', | 362 # NAME='parpg', |
350 # VERSION='0.2.0', | 363 # VERSION='0.2.0', |
353 # SUMMARY='', | 366 # SUMMARY='', |
354 # DESCRIPTION='', | 367 # DESCRIPTION='', |
355 # X_RPM_GROUP='Application/parpg', | 368 # X_RPM_GROUP='Application/parpg', |
356 #) | 369 #) |
357 | 370 |
358 build = Alias('build', [launcher, subst_config_file, copy_py_packages, | 371 build = Alias( |
359 copy_data]) | 372 'build', |
360 install = Alias('install', [build, install_launcher, install_py_packages, | 373 [build_launcher, build_config_file, build_py_packages, build_data], |
361 install_config_files]) | 374 ) |
375 install = Alias( | |
376 'install', | |
377 [build, launcher, config_file, py_packages, data], | |
378 ) | |
362 | 379 |
363 Default(build) | 380 Default(build) |