# HG changeset patch # User M. George Hansen # Date 1306835180 25200 # Node ID 4706e0194af379316fc8ca9ed8bdbb5c5369f88c # Parent 5deaf494934aa1580ec6e772a82d25bfa4608651 Various improvements to the build process including support for self-contained builds. * Note that despite all of these changes PARPG still does not run because asset paths are not standardized, * Modified the SCons script so that by default running `scons` with no arguments creates a self-contained "build" under a build subdirectory to make in-source testing easier. To install PARPG, use `scons install` instead. * Got rid of the binary launcher and replaced it with a shell script for unix and a batch script for Windows (batch script is untested). The binary turned out to be too much trouble to maintain. * Modified the parpg.settings module and parpg.main entry script so that PARPG searches through several default search paths for configuration file(s). PARPG thus no longer crashes if it can't find a configuration file in any particular search path, but will crash it if can't find any configuration files. * Paths supplied to parpg.main are now appended as search paths for the configuration file(s). * Changed the default configuration file name to "parpg.cfg" to simplify searches. * Created the site_scons directory tree where SCons extensions and tools should be placed. * Created a new SCons builder, CopyRecurse, which can copy only certain files and folders from a directory tree using filters (files and folders that start with a leading dot "." e.g. ".svn" are ignored by default). * Added the CPython SCons tool (stands for Compile-Python - I didn't name it!), which provides the InstallPython builder for pre-compiling python sources before they are installed. However, it is currently broken and only installs the python sources. diff -r 5deaf494934a -r 4706e0194af3 .hgignore --- a/.hgignore Wed Jun 01 00:45:27 2011 -0700 +++ b/.hgignore Tue May 31 02:46:20 2011 -0700 @@ -1,3 +1,6 @@ glob:**.py[co] glob:.sconsign.dblite + +syntax: regexp +^build$ \ No newline at end of file diff -r 5deaf494934a -r 4706e0194af3 SConstruct --- a/SConstruct Wed Jun 01 00:45:27 2011 -0700 +++ b/SConstruct Tue May 31 02:46:20 2011 -0700 @@ -3,11 +3,31 @@ import platform import compileall import fnmatch +from copy import copy from collections import Sequence from types import StringType from multiprocessing import cpu_count from SCons.Util import is_Sequence, is_Dict +from SCons.Tool.install import copyFunc + +#def recursive_glob(topdir_path, include_pattern='*', exclude_pattern=''): +# """ +# Locate all files matching supplied filename pattern in and below +# supplied root directory. +# """ +# for dir_path, subdir_names, file_names in \ +# os.walk(os.path.abspath(topdir_path)): +# for file_name in fnmatch.filter(file_names, include_pattern): +# if not fnmatch.fnmatch(file_name, exclude_pattern): +# file_path = os.path.join(dir_path, file_name) +# yield File(file_path) +# for subdir_name in copy(subdir_names): +# if not fnmatch.fnmatch(subdir_name, include_pattern) or \ +# fnmatch.fnmatch(subdir_name, exclude_pattern): +# subdir_names.remove(subdir_name) +# else: +# subdir_path = os.path.join(dir_path, subdir_name) def InstallChmod(env, dest, source, mode): targets = env.Install(dest, source) @@ -37,33 +57,6 @@ targets.append(target) return targets -def InstallPyPackages(env, dest, source, compile=True): - # Remove all existing *.pyc and *.pyo files for a sanitary install - # environment. - def _remove_compiled_modules(path): - for dir_path, dir_names, file_names in os.walk(path): - for file_name in fnmatch.filter(file_names, '*.py[co]'): - file_path = os.path.join(dir_path, file_name) - os.remove(file_path) - - def _add_targets(path): - for dir_path, dir_names, file_names in os.walk(path): - for file_name in fnmatch.filter(file_names, '*.py[co]'): - file_path = os.path.join(dir_path, file_name) - env.Clean(path, file_path) - source_file_path = file_path.rstrip('oc') - env.Depends(file_path, source_file_path) - - if not isinstance(source, Sequence) or isinstance(source, StringType): - source = [source] - for dir in source: - _remove_compiled_modules(str(dir)) - if compile: - compileall.compile_dir(str(dir), ddir=str(dest), force=True) - _add_targets(str(dir)) - targets = env.InstallReadOnly(dest, source) - return targets - def SubstfileEscape(env, *args, **kwargs): subst_dict = kwargs.get('SUBST_DICT') or env.get('SUBST_DICT') escape_sequences = kwargs.get('ESCAPE_SEQUENCES') or env.get('ESCAPE_SEQUENCES') @@ -87,7 +80,6 @@ AddMethod(Environment, InstallChmod) AddMethod(Environment, InstallExecutable) AddMethod(Environment, InstallReadOnly) -AddMethod(Environment, InstallPyPackages) AddMethod(Environment, SubstfileEscape) EnsurePythonVersion(2, 6) @@ -269,7 +261,7 @@ python_version_tuple = platform.python_version_tuple() environment = Environment( - tools=['default', 'textfile', 'packaging'], + tools=['default', 'cpython', 'copyrecurse', 'textfile', 'packaging'], variables=variables, PROJECT_NAME='parpg', PROJECT_VERSION_MAJOR=0, @@ -286,10 +278,7 @@ PY_VERSION_LONG='${PY_VERSION_MAJOR}.${PY_VERSION_MINOR}.' '${PY_VERSION_PATCH}', PY_LIB_NAME=PY_LIB_NAME, - PY_PACKAGES=[], - CONFIG_FILES=[], - DATA_FILES=[], - EXECUTABLES=[], + BUILD_DIR='build', ) if environment['DEBUG']: if platform_name == 'Windows': @@ -304,49 +293,56 @@ ('PREFIX', 'LIB_DIR', 'PY_PACKAGES_DIR', 'BIN_DIR', 'SYS_CONF_DIR', 'DATA_DIR', 'PYTHON')] -install_py_packages = environment.InstallPyPackages( +copy_py_packages = environment.Install( + '$BUILD_DIR', + 'src/parpg', +) +install_py_packages = environment.InstallPython( '$PY_PACKAGES_DIR', - 'src/parpg', - compile=GetOption('compile'), + copy_py_packages, + PYTHON_COMPILE=GetOption('compile'), +) + +copy_data = environment.CopyRecurse( + '$BUILD_DIR', + 'data', ) subst_config_file = environment.Substfile( - 'system.cfg.in', - SUBST_DICT=config_dict + '$BUILD_DIR/parpg.cfg', + 'parpg.cfg.in', + SUBST_DICT=config_dict, ) install_config_files = environment.InstallChmod( '$SYS_CONF_DIR', subst_config_file, - mode=0755 + mode=0755, ) Requires(install_config_files, subst_config_file) -install_data = environment.InstallReadOnly( - '$DATA_DIR', - Glob('data/*'), -) - -# FIXME M. George Hansen 2011-05-20: Do any other sequences need to be escaped -# in a C string? -executable_source = environment.SubstfileEscape( - 'bin/parpg.c.in', +if platform_name == 'Windows': + launcher_name = 'parpg.bat' +else: + launcher_name = 'parpg.sh' +# FIXME M. George Hansen 2011-05-20: Do any other sequences need to be escaped? +launcher = environment.SubstfileEscape( + 'build/$LAUNCHER_NAME', + 'bin/${LAUNCHER_NAME}.in', + LAUNCHER_NAME=launcher_name, SUBST_DICT=config_dict, ESCAPE_SEQUENCES={'\\': r'\\\\', '"': r'\\"'}, ) -build_executable = environment.Program( - executable_source, - LIBS=['$PY_LIB_NAME'], - LIBPATH='$PY_LIB_DIR', - CPPPATH=['$PY_HEADERS_DIR'], -) -# Clean up any files created by the MSVC compiler on Windows. if platform_name == 'Windows': - environment.Clean(build_executable, 'bin/parpg.ilk') - environment.Clean(build_executable, 'bin/parpg.pdb') -install_executable = environment.InstallExecutable( - '$BIN_DIR', - build_executable, -) + install_launcher = environment.InstallExecutable( + '$BIN_DIR', + launcher, + ) +else: + # Remove the .sh suffix, since it isn't needed on unix platforms. + install_launcher = environment.InstallAs( + '$BIN_DIR/parpg', + launcher, + ) # TODO M. George Hansen 2011-05-12: Implement package builder. #package = environment.Package( @@ -359,8 +355,9 @@ # X_RPM_GROUP='Application/parpg', #) -build = Alias('build', [build_executable]) -install = Alias('install', [build, install_executable, install_py_packages, - install_config_files, install_data]) +build = Alias('build', [launcher, subst_config_file, copy_py_packages, + copy_data]) +install = Alias('install', [build, install_launcher, install_py_packages, + install_config_files]) -Default(install) +Default(build) diff -r 5deaf494934a -r 4706e0194af3 bin/parpg.bat.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/parpg.bat.in Tue May 31 02:46:20 2011 -0700 @@ -0,0 +1,5 @@ +@ECHO OFF + +SET PYTHONPATH=%PYTHONPATH%;"@PY_PACKAGES_DIR@" +CD %~dp0 +START "@PYTHON@" -m parpg.main "@SYS_CONF_DIR@" %* \ No newline at end of file diff -r 5deaf494934a -r 4706e0194af3 bin/parpg.c.in --- a/bin/parpg.c.in Wed Jun 01 00:45:27 2011 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,106 +0,0 @@ -#include -#include -#include -#ifdef _WIN32 -# include -#else -# include -# include -#endif - -#define ARRAY_LEN(ARRAY) (sizeof(ARRAY) / sizeof *(ARRAY)) - -#define CONCAT_ARRAYS(TYPE, ARRAY_A, ARRAY_B) \ - (TYPE*)concatArrays((const void** const)(ARRAY_A), \ - ARRAY_LEN(ARRAY_A) * sizeof(TYPE), (const void** const)(ARRAY_B), \ - ARRAY_LEN(ARRAY_B) * sizeof(TYPE), sizeof(TYPE)) - -void* -concatArrays(const void* const arrayA, const size_t sizeA, - const void* const arrayB, const size_t sizeB, const size_t sizeType) { - char* const concatenatedArray = malloc(sizeType * (sizeA + sizeB)); - memcpy(concatenatedArray, arrayA, sizeA * sizeType); - memcpy(concatenatedArray + sizeA * sizeType, arrayB, sizeB * sizeType); - return concatenatedArray; -} - -char* -joinStr(const char* const strA, const char* const strB, - const char* const separator) { - const int lenA = strlen(strA); - const int lenB = strlen(strB); - const int lenSeparator = strlen(separator); - char* const concatenatedStr = malloc(lenA + lenB + lenSeparator + 1); - memcpy(concatenatedStr, strA, lenA); - memcpy(concatenatedStr + lenA, separator, lenSeparator); - memcpy(concatenatedStr + lenA + lenSeparator, strB, lenB + 1); - return concatenatedStr; -} - -int -spawnParpgProcess(char* const pythonExecutable, char* const configDir, - const int argc, char* const argv[]) { - const int sizeCharPtr = sizeof(char*); - const int nBaseArgs = 4; - char** const baseArgs = malloc(nBaseArgs * sizeCharPtr); - const int nAdditionalArgs = argc - 1; - char** const additionalArgs = - (char**)malloc(nAdditionalArgs * sizeCharPtr); - const int nArgs = nBaseArgs + nAdditionalArgs; - char* const oldPythonPath = getenv("PYTHONPATH"); - char* newPythonPath; - // Use calloc so that the last element is NULL. - char** const env = calloc(2, sizeCharPtr); - int exitStatus; - // Use calloc so that the last element is NULL. - char** const args = (char**)calloc(nArgs + 1, sizeCharPtr); - int i; - - baseArgs[0] = pythonExecutable; - baseArgs[1] = "-m"; - baseArgs[2] = "parpg.main"; - baseArgs[3] = configDir; - if (nAdditionalArgs > 0) { - for (i = 1; i < argc; i++) { - additionalArgs[i - 1] = argv[i]; - } - memcpy(args, CONCAT_ARRAYS(char*, baseArgs, additionalArgs), - nArgs * sizeCharPtr); - } else { - // Use memcpy so that the last NULL element in args is preserved. - memcpy(args, baseArgs, nArgs * sizeCharPtr); - } - if (oldPythonPath != 0) { - newPythonPath = joinStr(oldPythonPath, "@PY_PACKAGES_DIR@", ":"); - } else { - newPythonPath = "@PY_PACKAGES_DIR@"; - } - env[0] = joinStr("PYTHONPATH=", newPythonPath, ""); -#ifdef _WIN32 -# ifdef _MSC_VER // MSVC deprecated POSIX spawn functions. - exitStatus = _spawnve(_P_WAIT, pythonExecutable, args, env); -# else - exitStatus = spawnve(P_WAIT, pythonExecutable, args, env); -# endif -#else - exitStatus = execve(pythonExecutable, args, env); -#endif - free(baseArgs); - free(additionalArgs); - free(env); - free(args); - return exitStatus; -} - -int -main(int argc, char* argv[]) { - const int exitStatus = spawnParpgProcess("@PYTHON@", "@SYS_CONF_DIR@", - argc, argv); - if (exitStatus < 0) { - perror("failed to execute subprocess"); - exit(EXIT_FAILURE); - } else { - exit(EXIT_SUCCESS); - } -} - diff -r 5deaf494934a -r 4706e0194af3 bin/parpg.sh.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/parpg.sh.in Tue May 31 02:46:20 2011 -0700 @@ -0,0 +1,5 @@ +#!/bin/sh + +export PYTHONPATH=${PYTHONPATH}:"@PY_PACKAGES_DIR@" +cd $(dirname $0) +"@PYTHON@" -m parpg.main "@SYS_CONF_DIR@" $@ \ No newline at end of file diff -r 5deaf494934a -r 4706e0194af3 parpg.cfg.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/parpg.cfg.in Tue May 31 02:46:20 2011 -0700 @@ -0,0 +1,122 @@ +[fife] +# Options marked with ? are untested/unknown + +# Game window's title (string) DO NOT EDIT! +WindowTitle = PARPG Techdemo 2 + +# Icon to use for the game window's border (filename) DO NOT EDIT! +WindowIcon = window_icon.png + +# Video driver to use. (?) +VideoDriver = "" + +# Backend to use for graphics (OpenGL|SDL) +RenderBackend = OpenGL + +# Run the game in fullscreen mode or not. (True|False) +FullScreen = False + +# Screen Resolution's width. Not used if FullScreen is set to False (800|1024|etc) +ScreenWidth = 800 + +# Screen Resolution's height. Not used if FullScreen is set to False (600|768|etc) +ScreenHeight = 600 + +# Screen DPI? (?) +BitsPerPixel = 0 + +# ? (?) +SDLRemoveFakeAlpha = 1 + +# Subdirectory to load icons from (path) +IconsPath = icons + +# ? ([R, G, B]) +ColorKey = [250, 0, 250] + +# ? (True|False) +ColorKeyEnabled = False + +# Turn on sound effects and music (True|False) +EnableSound = True + +# Initial volume of sound effects and music (0.0-100.0?) +InitialVolume = 5.0 + +# Characters to use to render fonts. DO NOT EDIT! +FontGlyphs = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,!?-+/():;%&`'*#=[]"" + +# Subdirectory to load fronts from (path) +FontsPath = fonts + +# Font to load when game starts +#TODO: make it so that the font name is supplied instead of the filename +Font = oldtypewriter.ttf + +# Size of in-game fonts +DefaultFontSize = 12 + +# ? (?) +LogModules = [controller] + +# ? (?) +PychanDebug = False + +# use Psyco Acceperation (True|False) +UsePsyco = False + +# ? (?) +ProfilingOn = False + +# Lighting Model to use (0-2) +Lighting = 0 + +[parpg] + +# System subdirectory to load maps from (path) +MapsPath = maps + +# YAML file that contains the available maps (filename) +MapsFile = maps.yaml + +# Map to load when game starts (filename) +Map = Mall + +# ? (filename) +AllAgentsFile = all_agents.yaml + +# System subdirectory to load objects from (path) +ObjectsPath = objects + +# YAML file that contains the database of availabel objects (filename) +ObjectDatabaseFile = object_database.yaml + +# System subdirectory to load dialogues from (path) +DialoguesPath = dialogues + +# System subdirectory to load quests from (path) +QuestsPath = quests + +# System subdirectory where gui files are loaded from (path) +GuiPath = gui + +# System subdirectory where cursors are loaded from (path) +CursorPath = cursors + +# File to use for default cursor (filename) +CursorDefault = cursor_plain.png + +# File to use for up cursor (filename) +CursorUp = cursor_up.png + +# File to use for right cursor (filename) +CursorRight = cursor_right.png + +# File to use for down cursor (filename) +CursorDown = cursor_down.png + +# File to use for left cursor (filename) +CursorLeft = cursor_left.png + +# Player walk speed (digit) +PCSpeed = 3 diff -r 5deaf494934a -r 4706e0194af3 site_scons/site_tools/__init__.py diff -r 5deaf494934a -r 4706e0194af3 site_scons/site_tools/copyrecurse/CopyRecurseAction.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/site_scons/site_tools/copyrecurse/CopyRecurseAction.py Tue May 31 02:46:20 2011 -0700 @@ -0,0 +1,12 @@ +from .copytree import copytree + +def copyRecurseAction(target, source, env): + try: + include_pattern = env['INCLUDE_PATTERN'] + except KeyError: + include_pattern = '*' + try: + exclude_pattern = env['EXCLUDE_PATTERN'] + except KeyError: + exclude_pattern = '.*' + copytree(str(source[0]), str(target[0]), include_pattern, exclude_pattern) \ No newline at end of file diff -r 5deaf494934a -r 4706e0194af3 site_scons/site_tools/copyrecurse/__init__.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/site_scons/site_tools/copyrecurse/__init__.py Tue May 31 02:46:20 2011 -0700 @@ -0,0 +1,20 @@ +import os + +from .CopyRecurseAction import copyRecurseAction + +def emit(target, source, env): + target = [env.fs.Entry(os.path.join(str(target[0]), str(source[0])))] + return target, source + +def generate(env): + CopyRecurseBuilder = env.Builder( + action=copyRecurseAction, + emitter=emit, + source_factory=env.fs.Entry, + target_factory=env.fs.Dir, + multi=1, + ) + env.Append(BUILDERS={'CopyRecurse': CopyRecurseBuilder}) + +def exists(env): + return True diff -r 5deaf494934a -r 4706e0194af3 site_scons/site_tools/copyrecurse/copytree.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/site_scons/site_tools/copyrecurse/copytree.py Tue May 31 02:46:20 2011 -0700 @@ -0,0 +1,58 @@ +import os.path +import shutil +import fnmatch + +def copytree(src, dest, include_pattern='*', exclude_pattern='.*', + symlinks=False): + """My own copyTree which does not fail if the directory exists. + + Recursively copy a directory tree using copy2(). + + If the optional symlinks flag is true, symbolic links in the + source tree result in symbolic links in the destination tree; if + it is false, the contents of the files pointed to by symbolic + links are copied. + + Behavior is meant to be identical to GNU 'cp -R'. + """ + def copyItems(src, dest, include_pattern='*', exclude_pattern='.*', + symlinks=False): + """Function that does all the work. + + It is necessary to handle the two 'cp' cases: + - destination does exist + - destination does not exist + + See 'cp -R' documentation for more details + """ + for item in os.listdir(src): + if not fnmatch.fnmatch(item, include_pattern) or \ + fnmatch.fnmatch(item, exclude_pattern): + # Thow out anything that isn't matched by our include filter + # or that is matched by our exclude filter. + continue + srcPath = os.path.join(src, item) + if os.path.isdir(srcPath): + srcBasename = os.path.basename(srcPath) + destDirPath = os.path.join(dest, srcBasename) + if not os.path.exists(destDirPath): + os.makedirs(destDirPath) + copyItems(srcPath, destDirPath, include_pattern, + exclude_pattern) + elif os.path.islink(item) and symlinks: + linkto = os.readlink(item) + os.symlink(linkto, dest) + else: + shutil.copy2(srcPath, dest) + + # case 'cp -R src/ dest/' where dest/ already exists + if os.path.exists(dest): + destPath = os.path.join(dest, os.path.basename(src)) + if not os.path.exists(destPath): + os.makedirs(destPath) + # case 'cp -R src/ dest/' where dest/ does not exist + else: + os.makedirs(dest) + destPath = dest + # actually copy the files + copyItems(src, destPath, include_pattern, exclude_pattern) \ No newline at end of file diff -r 5deaf494934a -r 4706e0194af3 site_scons/site_tools/cpython/__init__.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/site_scons/site_tools/cpython/__init__.py Tue May 31 02:46:20 2011 -0700 @@ -0,0 +1,189 @@ +"""SCons.Tool.cpython + +Tool-specific initialization for Python binary builder. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001-7,2010 The SCons Foundation +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "src/engine/SCons/Tool/python.py 3263 2008/07/31 13:50:51 MatiGruca" + +import os +try: + import py_compile +except ImportError: + raise SCons.Errors.InternalError, "Couldn't import py_compile module" +try: + import compileall +except ImportError: + raise SCons.Errors.InternalError, "Couldn't import compileall module" +import glob + +import SCons.Action +import SCons.Builder +import SCons.Errors +import SCons.Node +from SCons.Tool.install import installFunc, add_targets_to_INSTALLED_FILES +from SCons.Tool.install import copyFunc + +########################################################################## +# Create Python builder +def createPythonBuilder(env): + """ + This is a utility function that creates the InstallPython + Builder in an Environment if it's not there already. + + If it's there already, we return the existing one. + + This builder is based on Install/InstallAs methods. It makes use + of those builder's functions: installFunc(), and + add_targets_to_INSTALLED_FILES()). + """ + + try: + InstallPythonBuilder = env['BUILDERS']['InstallPython'] + except KeyError: + installpython_action = SCons.Action.Action(installFunc, '$PYTHON_PYCOMSTR') + InstallPythonBuilder = SCons.Builder.Builder( + action=installpython_action, + src_suffix='$PYTHON_SUFFIX', + target_factory=env.fs.Entry, + source_factory=env.fs.Entry, + multi=1, + emitter=[add_targets_to_INSTALLED_FILES], + name='InstallPythonBuilder' + ) + + return InstallPythonBuilder + +def InstallPython(env, target=None, source=None): + """ + InstallPython creates .pyc or .pyo files for .py source files + and adds them to the list of targets along with the source files. + They are later copied to the destination (target) directory. + + InstallPython takes a target (destination) directory as its first + argument and a list of source files/directories as a second argument. + + InstallPython returns the list of target files to copy to the + target directory. + """ + try: + target_nodes = env.arg2nodes(target, env.fs.Dir) + except TypeError: + raise SCons.Errors.UserError, "Target `%s' of Install() is a file, but should be a directory. Perhaps you have the InstallPython() arguments backwards?" % str(dir) + + source_nodes = env.arg2nodes(source, env.fs.Entry) + targets = [] + + # import `compileall` module only if there is a dir in sources list + dir_in_sources = any(entry.isdir() for entry in sources) + + compile_py = env['PYTHON_COMPILE'] + optimize = env['PYTHON_OPTIMIZE'] + if optimize: + PYTHON_TARGETSUFFIX = 'o' + else: + PYTHON_TARGETSUFFIX = 'c' + + for target_node in target_nodes: + for source_node in source_nodes: + # add *.py and *.pyc files from a directory to tgt list + if source_node.isdir() and compile_py: + compileall.compile_dir(str(source_node), maxlevels=0, quiet=True) + glob_path = os.path.join(source_node.path, '*.py') + py_and_pycs = glob.glob(glob_path) + glob.glob(glob_path + 'c') + for file_name in py_and_pycs: + target = env.Entry('.'+os.sep+filename, dnode) + targets.extend(apply(PythonInstallBuilder, (env, target, filename), kw)) + # add *.py and *.pyo files from a directory to tgt list + elif isinstance(src, SCons.Node.FS.Dir): + to_compile = [] + py_files = glob.glob(src.path + os.sep + '*.py') + for py_file in py_files: + to_compile.append(py_file) + target_path = '.' + os.sep + py_file + + # add '.py' file to tgt list + py_src = env.fs.Entry(py_file) + py_tgt = env.fs.Entry(target_path, dnode) + tgt.extend(apply(PIB, (env, py_tgt, py_src), kw)) + + # add '.pyo' file to tgt list + pyo_src = env.fs.Entry(py_file + CPYTHON_TARGETSUFFIX) + pyo_tgt = env.fs.Entry(target_path + CPYTHON_TARGETSUFFIX, dnode) + tgt.extend(apply(PIB, (env, pyo_tgt, pyo_src), kw)) + act = SCons.Action.CommandAction('@$CPYTHON_PYCOM %s' % (' '.join(to_compile))) + act([], [], env) + # add single '.py' and '.pyc' or '.pyo' file to tgt list + else: + # add '.py' file to tgt list + target = env.fs.Entry('.'+os.sep+src.path, dnode) + tgt.extend(apply(PIB, (env, target, src), kw)) + + # .pyc or .pyo source and target files + pyco_src = env.fs.Entry(src.path + CPYTHON_TARGETSUFFIX) + pyco_tgt = env.fs.Entry(target.path + CPYTHON_TARGETSUFFIX) + + if compile_pyc: + py_compile.compile(src.path) + else: + act = SCons.Action.CommandAction('@$CPYTHON_PYCOM %s' % (src.path)) + act([], [], env) + + # add '.pyc' or '.pyo' file to tgt list + tgt.extend(apply(PIB, (env, pyco_tgt, pyco_src), kw)) + + return tgt + +def generate(env): + try: + env['INSTALL'] + except KeyError: + env['INSTALL'] = copyFunc + + global InstallPythonBuilder + InstallPythonBuilder = createPythonBuilder(env) + + env['PYTHON_OPTIMIZE'] = False # generate '.pyc' files by default + env['PYTHON_OPTIMIZE_FLAGS'] = '-O' + env['PYTHON_COMPILE_CMD'] = "-m py_compile $SOURCES" + env['PYTHON_PYCOM'] = '$PYTHON ${PYTHON_OPTIMIZE_FLAGS if ' \ + 'PYTHON_OPTIMIZE} $CPYTHON_COMPILE_CMD' + env['PYTHON_PYCOMSTR'] = 'Install file: "$SOURCE" as "$TARGET"' + env['PYTHON_SUFFIX'] = '.py' # extension for Python source files + + try: + env.Append(BUILDERS={'InstallPython': InstallPythonBuilder}) + except AttributeError: + # Looks like we use a pre-0.98 version of SCons... + from SCons.Script.SConscript import SConsEnvironment + SConsEnvironment.InstallPython = InstallPythonBuilder + +def exists(env): + return 1 diff -r 5deaf494934a -r 4706e0194af3 site_scons/site_tools/cpython/doc/SConstruct --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/site_scons/site_tools/cpython/doc/SConstruct Tue May 31 02:46:20 2011 -0700 @@ -0,0 +1,56 @@ +# +# A simple SConstruct for creating PDF files from Docbook XML +# sources. It's plain and ugly...but does its job ;). +# + +# +# Copyright (c) 2001-2010 The SCons Foundation +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +import os + +bld_fo = Builder(action = 'xsltproc ./pdf.xsl $SOURCE > $TARGET', + suffix = '.fo', + src_suffix = '.xml', + single_source = True) + +bld_html = Builder(action = 'xsltproc ./html.xsl $SOURCE > $TARGET', + suffix = '.html', + src_suffix = '.xml', + single_source = True) + +bld_pdf = Builder(action = 'fop $SOURCE $TARGET', + suffix = '.pdf', + src_suffix = '.fo', + single_source = True) + +env = Environment(ENV = os.environ, + BUILDERS = {'Fo' : bld_fo, + 'Html' : bld_html, + 'Pdf' : bld_pdf}) + +env.Pdf('manual', env.Fo('manual')) +env.Pdf('reference', env.Fo('reference')) + +env.Html('manual','manual') +env.Html('reference','reference') + diff -r 5deaf494934a -r 4706e0194af3 site_scons/site_tools/cpython/doc/html.xsl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/site_scons/site_tools/cpython/doc/html.xsl Tue May 31 02:46:20 2011 -0700 @@ -0,0 +1,55 @@ + + + + + + + + + + +/appendix toc,title +article/appendix nop +/article toc,title +book toc,title,figure,table,example,equation +/chapter toc,title +part toc,title +/preface toc,title +reference toc,title +/sect1 toc +/sect2 toc +/sect3 toc +/sect4 toc +/sect5 toc +/section toc +set toc,title + + + + diff -r 5deaf494934a -r 4706e0194af3 site_scons/site_tools/cpython/doc/manual.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/site_scons/site_tools/cpython/doc/manual.html Tue May 31 02:46:20 2011 -0700 @@ -0,0 +1,61 @@ +CPython, a binary builder for Python installs

CPython, a binary builder for Python installs

Dirk Baechle


Table of Contents

1. Examples

This first version of a Python Binary Builder is based on the work of +Mati Gruca's Google Summer of Code 2008 project +(last SVN branch). +

The “InstallPython” method creates .pyc or .pyo files for .py source files +and adds them to the list of targets along with the source files. +They are later copied to the destination (target) directory. +

The “InstallPython” Builder takes a target (destination) directory as its first +argument and a list of source files/directories as a second argument. +It returns the list of target files to copy to the +target directory. +

1. Examples

A simple example of an “SConstruct” file: +

env = Environment()
+hello = File('hello.py')
+env.InstallPython('/usr/local/bin/', hello)
+env.Alias('install', '/usr/local/bin/')
+

SCons” invoked with the “-Q install” parameter will compile the “hello.py” file into +“hello.pyc”, and copy both files into “/usr/local/bin/” directory. +

Sample output: +

$ scons -Q install
+Install file: "hello.py" as "/usr/local/bin/hello.py"
+Install file: "hello.pyc" as "/usr/local/bin/hello.pyc"
+

InstallPython” can also compile Python source files into optimized +binary files (“.pyo” suffix) instead of ordinary binaries (“.pyc” files). To +achieve this, change the call to “Environment()” and set the “CPYTHON_PYC” +variable to '0' (zero): +

env = Environment(CPYTHON_PYC=0)
+hello = File('hello.py')
+env.InstallPython('/usr/local/bin/', hello)
+env.Alias('install', '/usr/local/bin/')
+

Sample output: +

$ scons -Q install
+Install file: "hello.py" as "/usr/local/bin/hello.py"
+Install file: "hello.pyo" as "/usr/local/bin/hello.pyo"
+

The “InstallPython” method accepts both, files and directories, as its source arguments: +

env = Environment()
+pyfiles = Dir('pyfiles/')
+env.InstallPython('/usr/local/bin/', pyfiles)
+env.Alias('install', '/usr/local/bin')
+

Running “scons -Q install” will copy all the “.py” files from “pyfiles” directory +into “/usr/local/bin/pyfiles” directory along with corresponding “.pyc” files. +

Sample output: +

$ scons -Q install
+Install file: "pyfiles/hello.py" as "/usr/local/bin/pyfiles/hello.py"
+Install file: "pyfiles/hello.pyc" as "/usr/local/bin/pyfiles/hello.pyc"
+Install file: "pyfiles/hello2.py" as "/usr/local/bin/pyfiles/hello2.py"
+Install file: "pyfiles/hello2.pyc" as "/usr/local/bin/pyfiles/hello2.pyc"
+

Mixing files and directories is also possible: +

env = Environment()
+hello = File('hello.py')
+pyfiles = Dir('pyfiles/')
+env.InstallPython('/usr/local/bin/', [hello, pyfiles])
+env.Alias('install', '/usr/local/bin')
+

Sample output: +

$ scons -Q install
+Install file: "hello.py" as "/usr/local/bin/hello.py"
+Install file: "hello.pyc" as "/usr/local/bin/hello.pyc"
+Install file: "pyfiles/hello.py" as "/usr/local/bin/pyfiles/hello.py"
+Install file: "pyfiles/hello.pyc" as "/usr/local/bin/pyfiles/hello.pyc"
+Install file: "pyfiles/hello2.py" as "/usr/local/bin/pyfiles/hello2.py"
+Install file: "pyfiles/hello2.pyc" as "/usr/local/bin/pyfiles/hello2.pyc"
+
diff -r 5deaf494934a -r 4706e0194af3 site_scons/site_tools/cpython/doc/manual.pdf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/site_scons/site_tools/cpython/doc/manual.pdf Tue May 31 02:46:20 2011 -0700 @@ -0,0 +1,206 @@ +%PDF-1.3 +%ª«¬­ +4 0 obj +<< /Type /Info +/Producer (FOP 0.20.5) >> +endobj +5 0 obj +<< /Length 2241 /Filter [ /ASCII85Decode /FlateDecode ] + >> +stream +Gb".=gMWKOo\El*U6X_/adBVYWRQ\MgLe(GG$DphWG8FJ`n4mU_$`5:qXo2C#%e&FG.)gXnrPkeF6CcXi61q,p5W=0+jZq7Ho80kD9]tTD652#+a_\^l.DI@4DiHn73ZH@BI3&D'@bBD[]H%8:^QVa:=7_O)5X/bO'B+(EE=XaO=O&CW"QosZK^+^_02/5^jj21;dl\]in;N>jn*S>3PCrSF2El98).f2U'_RCXhs[(>ZG'%C]rR&($A#b_##N5ii5:%Lq;rrF.eOf+)BfXVB\!hap'Em,:I%*?0D)=37S^JBA#>n"PrFR>MU-%e5`s,.#DefK)rnc)o,aNr=am-ctpIWq3Nna.Z@"f^M!s?VohBU0aduLufChh&YF:j5WC/(!To6\]l[oBnnfSB#KA%s_9t,C`H>T6-Xc1kW/1`?XI3(ka7@lXVOa&u%>,#K7Hb>H8btOO1s1^]a6i*1jZs9Ye#f(DP-\SqgK&7L`^_r2RKDiKNJW-::B[X\h\B>96R*r[-5f?R:@3,S`92T^Uo!\*%S@C`2#icms:6n*S?TClm(B#*_4=+1!=&Cab$WD04YSW"on,.2RM\b0>\ZOQfc%GL^#-]HU1$H]p8hu6:I$-$`*(7pY>+rJi#?+7%812Q*9h1:T=#YtT_^;6//)'"C&#DAk<(6gH!3=m?*,>/,TRJ-.c;f,L[u7$q/Q1dTrT]KQa$-@DBkK/]cE6oC@=$G`+mV?D9(0C`UQB\H7i[OqYE[>BO%em3"ke:itCS-E;]-3(Ue>0<-n^OED]&H0?;cLm5)10VgTMfUkH5KahJK.H*52d[;Jdl'B(bb6%!9!`rkOWqM6jVO0$=]e)YO5BXco@>\F4;H'I0.aZq+=i;,E4p,qB^NAhp,"N==9Z\TX+HAURqRp>p:*PW4a\]Ifn?$J[_?N)n'WIPUjjQ'$BH;IFp*jOq13VDME5h52U8Ds/*/fb>@oUe.0lKaT`.-_8k^OUl,[QK5=6C(?l83]oE%98O+[OZfV.)B;8nY+500gUr0(bdM?iG=E&E/L!`CX@(DO.Lk'[)UWNXi7R&=]k^L4h.nauY)Kj[GI^DSB_;JGW4^l;Ko%dF_oc_IikQ&Hi-t?DqV`suX&]'l%e#jA72Z7LDr_%ui8G[eqc#"L2A+jap/ATWBgl">Pc\@)"p%eH#Brl;#7<81EM#`*6.9,SPPR@tNh'f0*/'e@\rTNq\VZ5c',>D:FPS2-+@:'lFcqcr6OhP!.GaShf7mqS_=V,AT=l]kYLl4#N)9r-K3u'+*N$"gun,:(`K9TNTu;n#C$nVS6t$gK0&,t@:M@pJRnm=Jr$0Qr(5'7V@[ofEVdf#"La0@bC3urnN>m[p:\=VlQ#M"X7)2;#K@Wi'3J1+F#c`qRK+q7112C:0^0R3kTJRJ(JkGq*1FY?_&b,_rrM>g&Rb~> +endstream +endobj +6 0 obj +<< /Type /Page +/Parent 1 0 R +/MediaBox [ 0 0 612 792 ] +/Resources 3 0 R +/Contents 5 0 R +/Annots 7 0 R +>> +endobj +7 0 obj +[ +8 0 R +10 0 R +11 0 R +12 0 R +13 0 R +14 0 R +15 0 R +] +endobj +8 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 72.0 565.62 121.44 555.62 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 9 0 R +/H /I +>> +endobj +10 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 368.828 534.62 545.608 524.62 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A << /URI (http://www.scons.org/wiki/GSoC2008/MatiGruca) +/S /URI >> +/H /I +>> +endobj +11 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 72.0 523.62 99.77 513.62 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A << /URI (http://www.scons.org/wiki/GSoC2008/MatiGruca) +/S /URI >> +/H /I +>> +endobj +12 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 190.92 523.62 390.92 513.62 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A << /URI (http://www.scons.org/wiki/GSoC2008/MatiGruca) +/S /URI >> +/H /I +>> +endobj +13 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 479.57 523.62 551.5 513.62 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A << /URI (http://scons.tigris.org/source/browse/scons/branches/py-builder/) +/S /URI >> +/H /I +>> +endobj +14 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 750.58 523.62 765.02 513.62 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A << /URI (http://scons.tigris.org/source/browse/scons/branches/py-builder/) +/S /URI >> +/H /I +>> +endobj +15 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 72.0 512.62 320.31 502.62 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A << /URI (http://scons.tigris.org/source/browse/scons/branches/py-builder/) +/S /URI >> +/H /I +>> +endobj +16 0 obj +<< /Length 1221 /Filter [ /ASCII85Decode /FlateDecode ] + >> +stream +Gau0DgMWKG&:O:STW1mfWEHQ/fLgSU/QF<$lG[[9+#"l.8sj`%\'O.^#hKG8;*_cVnWpM"ZaYkGr).k6qo-h(#@6]lnAF*XdjHQZhI>mN4TCW\AX'&F]F3\"ld'KKR_7q(B<*:P2;6hKl^gP!omXV,np.7q.%N"k2Rf"PneRj'_a4tMnfnV0,;&6$o_al]3H3dc">SrV@[-p=iAK[2+gb78#Ki2Q-66q:`7MVAV6bNm@^*JB$FX&LH(=rPFXK\!S8??BHa)#]l=D>Dag0bmRAG84ng#i1Y*-ZMLof^\7P=kRl[>X0fDj`mPeMj8\%J_P5XW/lg+!46hX%33ied]3kp!g>>^V-9Qr1[]-]%`;"%D5Fadq'bg-L/#XK_LI6u62"nfQ\4+#Z>)rq$)%%ePa\8P7['nE3*pbpEhNR#qf@ceh=%J][7QDs3dhuZSLn6eOl$m,p&[P1nfT.LAYCOH(8V&b18q&VtiEfC:n@e=3UUJ^O9*XZ*60;"_9PCs-hSPZ*-"eoXi(X`R5mj[:;1p6FfH1MNe(`1"g1hBfH8#.&uE,<+kaUE2EAoVhFBi_(!6M2oLf4c+Mk@8\9e9Q>b[9F;Z[$BmZj@u%Mqa@U(hG$YA3,0"1U1Oe6fp+X&]78V=fmG+'FcJZcUL/RWV\L8-rf!C:WBK(^0O.#-E+HNA("RhC(WlYlKbfK*B?/@#N/j]8508T&BRg(KnXIqqt`2Sme62/*>'oL:)ClpcC([I^>(Kac4_)*$('r!0,3CIe~> +endstream +endobj +17 0 obj +<< /Type /Page +/Parent 1 0 R +/MediaBox [ 0 0 612 792 ] +/Resources 3 0 R +/Contents 16 0 R +>> +endobj +18 0 obj +<< /Type /Font +/Subtype /Type1 +/Name /F3 +/BaseFont /Helvetica-Bold +/Encoding /WinAnsiEncoding >> +endobj +19 0 obj +<< /Type /Font +/Subtype /Type1 +/Name /F5 +/BaseFont /Times-Roman +/Encoding /WinAnsiEncoding >> +endobj +20 0 obj +<< /Type /Font +/Subtype /Type1 +/Name /F1 +/BaseFont /Helvetica +/Encoding /WinAnsiEncoding >> +endobj +21 0 obj +<< /Type /Font +/Subtype /Type1 +/Name /F9 +/BaseFont /Courier +/Encoding /WinAnsiEncoding >> +endobj +1 0 obj +<< /Type /Pages +/Count 2 +/Kids [6 0 R 17 0 R ] >> +endobj +2 0 obj +<< /Type /Catalog +/Pages 1 0 R + >> +endobj +3 0 obj +<< +/Font << /F3 18 0 R /F5 19 0 R /F1 20 0 R /F9 21 0 R >> +/ProcSet [ /PDF /ImageC /Text ] >> +endobj +9 0 obj +<< +/S /GoTo +/D [6 0 R /XYZ 67.0 443.62 null] +>> +endobj +xref +0 22 +0000000000 65535 f +0000005801 00000 n +0000005866 00000 n +0000005916 00000 n +0000000015 00000 n +0000000071 00000 n +0000002404 00000 n +0000002524 00000 n +0000002591 00000 n +0000006028 00000 n +0000002722 00000 n +0000002918 00000 n +0000003109 00000 n +0000003303 00000 n +0000003516 00000 n +0000003730 00000 n +0000003942 00000 n +0000005256 00000 n +0000005364 00000 n +0000005477 00000 n +0000005587 00000 n +0000005695 00000 n +trailer +<< +/Size 22 +/Root 2 0 R +/Info 4 0 R +>> +startxref +6091 +%%EOF diff -r 5deaf494934a -r 4706e0194af3 site_scons/site_tools/cpython/doc/manual.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/site_scons/site_tools/cpython/doc/manual.xml Tue May 31 02:46:20 2011 -0700 @@ -0,0 +1,95 @@ + + +
+ CPython, a binary builder for Python installs + + + Dirk Baechle + + +This first version of a Python Binary Builder is based on the work of +Mati Gruca's Google Summer of Code 2008 project +(last SVN branch). + +The InstallPython method creates .pyc or .pyo files for .py source files +and adds them to the list of targets along with the source files. +They are later copied to the destination (target) directory. + +The InstallPython Builder takes a target (destination) directory as its first +argument and a list of source files/directories as a second argument. +It returns the list of target files to copy to the +target directory. + +
Examples +A simple example of an SConstruct file: + +env = Environment() +hello = File('hello.py') +env.InstallPython('/usr/local/bin/', hello) +env.Alias('install', '/usr/local/bin/') + +SCons invoked with the -Q install parameter will compile the hello.py file into +hello.pyc, and copy both files into /usr/local/bin/ directory. + +Sample output: + +$ scons -Q install +Install file: "hello.py" as "/usr/local/bin/hello.py" +Install file: "hello.pyc" as "/usr/local/bin/hello.pyc" + +InstallPython can also compile Python source files into optimized +binary files (.pyo suffix) instead of ordinary binaries (.pyc files). To +achieve this, change the call to Environment() and set the CPYTHON_PYC +variable to '0' (zero): + +env = Environment(CPYTHON_PYC=0) +hello = File('hello.py') +env.InstallPython('/usr/local/bin/', hello) +env.Alias('install', '/usr/local/bin/') + +Sample output: + +$ scons -Q install +Install file: "hello.py" as "/usr/local/bin/hello.py" +Install file: "hello.pyo" as "/usr/local/bin/hello.pyo" + +The InstallPython method accepts both, files and directories, as its source arguments: + +env = Environment() +pyfiles = Dir('pyfiles/') +env.InstallPython('/usr/local/bin/', pyfiles) +env.Alias('install', '/usr/local/bin') + +Running scons -Q install will copy all the .py files from pyfiles directory +into /usr/local/bin/pyfiles directory along with corresponding .pyc files. + +Sample output: + +$ scons -Q install +Install file: "pyfiles/hello.py" as "/usr/local/bin/pyfiles/hello.py" +Install file: "pyfiles/hello.pyc" as "/usr/local/bin/pyfiles/hello.pyc" +Install file: "pyfiles/hello2.py" as "/usr/local/bin/pyfiles/hello2.py" +Install file: "pyfiles/hello2.pyc" as "/usr/local/bin/pyfiles/hello2.pyc" + +Mixing files and directories is also possible: + +env = Environment() +hello = File('hello.py') +pyfiles = Dir('pyfiles/') +env.InstallPython('/usr/local/bin/', [hello, pyfiles]) +env.Alias('install', '/usr/local/bin') + +Sample output: + +$ scons -Q install +Install file: "hello.py" as "/usr/local/bin/hello.py" +Install file: "hello.pyc" as "/usr/local/bin/hello.pyc" +Install file: "pyfiles/hello.py" as "/usr/local/bin/pyfiles/hello.py" +Install file: "pyfiles/hello.pyc" as "/usr/local/bin/pyfiles/hello.pyc" +Install file: "pyfiles/hello2.py" as "/usr/local/bin/pyfiles/hello2.py" +Install file: "pyfiles/hello2.pyc" as "/usr/local/bin/pyfiles/hello2.pyc" + +
+ +
diff -r 5deaf494934a -r 4706e0194af3 site_scons/site_tools/cpython/doc/pdf.xsl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/site_scons/site_tools/cpython/doc/pdf.xsl Tue May 31 02:46:20 2011 -0700 @@ -0,0 +1,62 @@ + + + + + + + + + + +0pt + + +/appendix toc,title +article/appendix nop +/article toc,title +book toc,title,figure,table,example,equation +/chapter toc,title +part toc,title +/preface toc,title +reference toc,title +/sect1 toc +/sect2 toc +/sect3 toc +/sect4 toc +/sect5 toc +/section toc +set toc,title + + + + + + + + diff -r 5deaf494934a -r 4706e0194af3 site_scons/site_tools/cpython/doc/reference.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/site_scons/site_tools/cpython/doc/reference.html Tue May 31 02:46:20 2011 -0700 @@ -0,0 +1,294 @@ + +SCons tool cpython - Reference
Table of Contents
1. Interna
2. Builders
2.1. InstallPython
3. Variables

This reference lists all the variables that are used within the + "cpython" tool, and the available builders. It is intended + for SCons tool developers and core programmers, as a normal user you + should read the manual instead.


1. Interna

Internally, the builder is based on the + Install/InstallAs methods from + SCons.Tool.install. It makes use of the basic builder's + functions: installFunc(), and + add_targets_to_INSTALLED_FILES().


2. Builders

2.1. InstallPython

The "InstallPython" method creates + .pyc or .pyo files for + .py source files and adds them to the list of targets + along with the source files. They are later copied to the destination + (target) directory.

Example:

env = Environment()
+hello = File('hello.py')
+env.InstallPython('/usr/local/bin/', hello)
+env.Alias('install', '/usr/local/bin/')
+


3. Variables

CPYTHON_PYC

Default value is 1, which means that the + Python source files get compiled to .pyc files. + Set this variable to 0 in order to get + optimized .pyo files, parallel to your + installed sources.

CPYTHON_EXE

The path to the external Python executable, used for + creating optimized .pyo files. Default value is + 'python'.

CPYTHON_PYO_FLAGS

Additional flags for compiling optimized Python files + (.pyo). The default is + '-O'.

CPYTHON_PYO_CMD

The command arguments for compiling optimized Python files + (.pyo). The default value is '-c + 'import sys,py_compile; [py_compile.compile(i) for i in + sys.argv[1:]]''.

CPYTHON_PYCOM

The command line for compiling optimized Python files + (.pyo). Default is '$CPYTHON_EXE + $CPYTHON_PYO_FLAGS $CPYTHON_PYO_CMD'.

CPYTHON_PYCOMSTR

The message string for the + 'CPYTHON_PYCOM' command. Default is + 'Install file: "$SOURCE" as "$TARGET"'.

CPYTHON_SUFFIX

Default value is '.py'. The suffix for Python source + files.

\ No newline at end of file diff -r 5deaf494934a -r 4706e0194af3 site_scons/site_tools/cpython/doc/reference.pdf Binary file site_scons/site_tools/cpython/doc/reference.pdf has changed diff -r 5deaf494934a -r 4706e0194af3 site_scons/site_tools/cpython/doc/reference.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/site_scons/site_tools/cpython/doc/reference.xml Tue May 31 02:46:20 2011 -0700 @@ -0,0 +1,157 @@ + + + +
+ + SCons tool <quote>cpython</quote> - Reference + + + Dirk + + Baechle + + + 2010-07-28 + + + + This reference lists all the variables that are used within the + cpython tool, and the available builders. It is intended + for SCons tool developers and core programmers, as a normal user you + should read the manual instead. + + +
+ Interna + + Internally, the builder is based on the + Install/InstallAs methods from + SCons.Tool.install. It makes use of the basic builder's + functions: installFunc(), and + add_targets_to_INSTALLED_FILES(). +
+ +
+ Builders + +
+ InstallPython + + The InstallPython method creates + .pyc or .pyo files for + .py source files and adds them to the list of targets + along with the source files. They are later copied to the destination + (target) directory. + + Example: + + env = Environment() +hello = File('hello.py') +env.InstallPython('/usr/local/bin/', hello) +env.Alias('install', '/usr/local/bin/') + +
+
+ +
+ Variables + + + + CPYTHON_PYC + + + Default value is 1, which means that the + Python source files get compiled to .pyc files. + Set this variable to 0 in order to get + optimized .pyo files, parallel to your + installed sources. + + + + + CPYTHON_EXE + + + The path to the external Python executable, used for + creating optimized .pyo files. Default value is + 'python'. + + + + + CPYTHON_PYO_FLAGS + + + Additional flags for compiling optimized Python files + (.pyo). The default is + '-O'. + + + + + CPYTHON_PYO_CMD + + + The command arguments for compiling optimized Python files + (.pyo). The default value is '-c + 'import sys,py_compile; [py_compile.compile(i) for i in + sys.argv[1:]]''. + + + + + CPYTHON_PYCOM + + + The command line for compiling optimized Python files + (.pyo). Default is '$CPYTHON_EXE + $CPYTHON_PYO_FLAGS $CPYTHON_PYO_CMD'. + + + + + CPYTHON_PYCOMSTR + + + The message string for the + 'CPYTHON_PYCOM' command. Default is + 'Install file: "$SOURCE" as "$TARGET"'. + + + + + CPYTHON_SUFFIX + + + Default value is '.py'. The suffix for Python source + files. + + + +
+
\ No newline at end of file diff -r 5deaf494934a -r 4706e0194af3 site_scons/site_tools/cpython/doc/scons.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/site_scons/site_tools/cpython/doc/scons.css Tue May 31 02:46:20 2011 -0700 @@ -0,0 +1,263 @@ +body { + background: #ffffff; + margin: 10px; + padding: 0; + font-family:palatino, georgia, verdana, arial, sans-serif; + } + + +a { + color: #80572a; + } + +a:hover { + color: #d72816; + text-decoration: none; + } + +tt { + color: #a14447; + } + +pre { + background: #e0e0e0; + } + +#main { + border: 1px solid; + border-color: black; + background-color: white; + background-image: url(../images/sconsback.png); + background-repeat: repeat-y 50% 0; + background-position: right top; + margin: 30px auto; + width: 750px; + } + +#banner { + background-image: url(../images/scons-banner.jpg); + border-bottom: 1px solid; + height: 95px; + } + +#menu { + font-family: sans-serif; + font-size: small; + line-height: 0.9em; + float: right; + width: 220px; + clear: both; + margin-top: 10px; + } + +#menu li { + margin-bottom: 7px; + } + +#menu li li { + margin-bottom: 2px; + } + +#menu li.submenuitems { + margin-bottom: 2px; + } + +#menu a { + text-decoration: none; + } + +#footer { + border-top: 1px solid black; + text-align: center; + font-size: small; + color: #822; + margin-top: 4px; + background: #eee; + } + +ul.hack { + list-style-position:inside; + } + +ul.menuitems { + list-style-type: none; + } + +ul.submenuitems { + list-style-type: none; + font-size: smaller; + margin-left: 0; + padding-left: 16px; + } + +ul.subsubmenuitems { + list-style-type: none; + font-size: smaller; + margin-left: 0; + padding-left: 16px; + } + +ol.upper-roman { + list-style-type: upper-roman; + } + +ol.decimal { + list-style-type: decimal; + } + +#currentpage { + font-weight: bold; + } + +#bodycontent { + margin: 15px; + width: 520px; + font-size: small; + line-height: 1.5em; + } + +#bodycontent li { + margin-bottom: 6px; + list-style-type: square; + } + +#sconsdownloadtable downloadtable { + display: table; + margin-left: 5%; + border-spacing: 12px 3px; + } + +#sconsdownloadtable downloadrow { + display: table-row; + } + +#sconsdownloadtable downloadentry { + display: table-cell; + text-align: center; + vertical-align: bottom; + } + +#sconsdownloadtable downloaddescription { + display: table-cell; + font-weight: bold; + text-align: left; + } + +#sconsdownloadtable downloadversion { + display: table-cell; + font-weight: bold; + text-align: center; + } + +#sconsdocversiontable sconsversiontable { + display: table; + margin-left: 10%; + border-spacing: 12px 3px; + } + +#sconsdocversiontable sconsversionrow { + display: table-row; + } + +#sconsdocversiontable docformat { + display: table-cell; + font-weight: bold; + text-align: center; + vertical-align: bottom; + } + +#sconsdocversiontable sconsversion { + display: table-cell; + font-weight: bold; + text-align: left; + } + +#sconsdocversiontable docversion { + display: table-cell; + font-weight: bold; + text-align: center; + } + +#osrating { + margin-left: 35px; + } + + +h2 { + color: #272; + color: #c01714; + font-family: sans-serif; + font-weight: normal; + } + +h2.pagetitle { + font-size: xx-large; + } +h3 { + margin-bottom: 10px; + } + +.date { + font-size: small; + color: gray; + } + +.link { + margin-bottom: 22px; + } + +.linkname { + } + +.linkdesc { + margin: 10px; + margin-top: 0; + } + +.quote { + margin-top: 20px; + margin-bottom: 10px; + background: #f8f8f8; + border: 1px solid; + border-color: #ddd; + } + +.quotetitle { + font-weight: bold; + font-size: large; + margin: 10px; + } + +.quotedesc { + margin-left: 20px; + margin-right: 10px; + margin-bottom: 15px; + } + +.quotetext { + margin-top: 20px; + margin-left: 20px; + margin-right: 10px; + font-style: italic; + } + +.quoteauthor { + font-size: small; + text-align: right; + margin-top: 10px; + margin-right: 7px; + } + +.sconslogo { + font-style: normal; + font-weight: bold; + color: #822; + } + +.downloadlink { + } + +.downloaddescription { + margin-left: 1em; + margin-bottom: 0.4em; + } diff -r 5deaf494934a -r 4706e0194af3 site_scons/site_tools/cpython/test/basic/SConstruct --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/site_scons/site_tools/cpython/test/basic/SConstruct Tue May 31 02:46:20 2011 -0700 @@ -0,0 +1,6 @@ +env = Environment(tools=['cpython']) +hello = File('pyfiles/hello.py') +hello2 = File('pyfiles/hello2.py') +pydir = Dir('pyfiles2') +env.InstallPython('pybuilderdir', [hello, hello2, pydir]) +env.Alias('install', 'pybuilderdir') diff -r 5deaf494934a -r 4706e0194af3 site_scons/site_tools/cpython/test/basic/SConstruct-cflag --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/site_scons/site_tools/cpython/test/basic/SConstruct-cflag Tue May 31 02:46:20 2011 -0700 @@ -0,0 +1,6 @@ +env = Environment(tools=['cpython'], CPYTHON_PYC=1) +hello = File('pyfiles/hello.py') +hello2 = File('pyfiles/hello2.py') +pydir = Dir('pyfiles2') +env.InstallPython('pybuilderdir', [hello, hello2, pydir]) +env.Alias('install', 'pybuilderdir') diff -r 5deaf494934a -r 4706e0194af3 site_scons/site_tools/cpython/test/basic/SConstruct-oflag --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/site_scons/site_tools/cpython/test/basic/SConstruct-oflag Tue May 31 02:46:20 2011 -0700 @@ -0,0 +1,6 @@ +env = Environment(tools=['cpython'], CPYTHON_PYC=0) +hello = File('pyfiles/hello.py') +hello2 = File('pyfiles/hello2.py') +pydir = Dir('pyfiles2') +env.InstallPython('pybuilderdir', [hello, hello2, pydir]) +env.Alias('install', 'pybuilderdir') diff -r 5deaf494934a -r 4706e0194af3 site_scons/site_tools/cpython/test/basic/image/pyfiles/hello.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/site_scons/site_tools/cpython/test/basic/image/pyfiles/hello.py Tue May 31 02:46:20 2011 -0700 @@ -0,0 +1,2 @@ +#!/usr/bin/env python +print 'Hello world' diff -r 5deaf494934a -r 4706e0194af3 site_scons/site_tools/cpython/test/basic/image/pyfiles/hello2.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/site_scons/site_tools/cpython/test/basic/image/pyfiles/hello2.py Tue May 31 02:46:20 2011 -0700 @@ -0,0 +1,2 @@ +#!/usr/bin/env python +print 'Hello world version 2' diff -r 5deaf494934a -r 4706e0194af3 site_scons/site_tools/cpython/test/basic/image/pyfiles2/hello.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/site_scons/site_tools/cpython/test/basic/image/pyfiles2/hello.py Tue May 31 02:46:20 2011 -0700 @@ -0,0 +1,2 @@ +#!/usr/bin/env python +print 'Hello world' diff -r 5deaf494934a -r 4706e0194af3 site_scons/site_tools/cpython/test/basic/image/pyfiles2/hello2.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/site_scons/site_tools/cpython/test/basic/image/pyfiles2/hello2.py Tue May 31 02:46:20 2011 -0700 @@ -0,0 +1,2 @@ +#!/usr/bin/env python +print 'Hello world version 2' diff -r 5deaf494934a -r 4706e0194af3 site_scons/site_tools/cpython/test/basic/sconstest-cflag-compile.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/site_scons/site_tools/cpython/test/basic/sconstest-cflag-compile.py Tue May 31 02:46:20 2011 -0700 @@ -0,0 +1,49 @@ +#!/usr/bin/env python +# +# Copyright (c) 2001-2010 The SCons Foundation +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + + +""" +Test compilation of Python modules to .pyc files. +""" + +import TestSCons + +test = TestSCons.TestSCons() +test.dir_fixture("image") +test.file_fixture('SConstruct-cflag','SConstruct') +test.file_fixture('../../__init__.py','site_scons/site_tools/cpython/__init__.py') +test.run(arguments = 'install') + +test.must_exist(test.workpath('pybuilderdir/pyfiles/hello.pyc')) +test.must_exist(test.workpath('pybuilderdir/pyfiles/hello2.pyc')) +test.must_exist(test.workpath('pybuilderdir/pyfiles2/hello.pyc')) +test.must_exist(test.workpath('pybuilderdir/pyfiles2/hello2.pyc')) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: \ No newline at end of file diff -r 5deaf494934a -r 4706e0194af3 site_scons/site_tools/cpython/test/basic/sconstest-noflags-compile.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/site_scons/site_tools/cpython/test/basic/sconstest-noflags-compile.py Tue May 31 02:46:20 2011 -0700 @@ -0,0 +1,50 @@ +#!/usr/bin/env python +# +# Copyright (c) 2001-2010 The SCons Foundation +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + + +""" +Test compilation of Python modules with the default settings. This should create +a bunch of .pyc files. +""" + +import TestSCons + +test = TestSCons.TestSCons() +test.dir_fixture("image") +test.file_fixture('SConstruct') +test.file_fixture('../../__init__.py','site_scons/site_tools/cpython/__init__.py') +test.run(arguments = 'install') + +test.must_exist(test.workpath('pybuilderdir/pyfiles/hello.pyc')) +test.must_exist(test.workpath('pybuilderdir/pyfiles/hello2.pyc')) +test.must_exist(test.workpath('pybuilderdir/pyfiles2/hello.pyc')) +test.must_exist(test.workpath('pybuilderdir/pyfiles2/hello2.pyc')) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: \ No newline at end of file diff -r 5deaf494934a -r 4706e0194af3 site_scons/site_tools/cpython/test/basic/sconstest-oflag-compile.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/site_scons/site_tools/cpython/test/basic/sconstest-oflag-compile.py Tue May 31 02:46:20 2011 -0700 @@ -0,0 +1,49 @@ +#!/usr/bin/env python +# +# Copyright (c) 2001-2010 The SCons Foundation +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + + +""" +Test compilation of Python modules to .pyo files (optimized). +""" + +import TestSCons + +test = TestSCons.TestSCons() +test.dir_fixture("image") +test.file_fixture('SConstruct-oflag','SConstruct') +test.file_fixture('../../__init__.py','site_scons/site_tools/cpython/__init__.py') +test.run(arguments = 'install') + +test.must_exist(test.workpath('pybuilderdir/pyfiles/hello.pyo')) +test.must_exist(test.workpath('pybuilderdir/pyfiles/hello2.pyo')) +test.must_exist(test.workpath('pybuilderdir/pyfiles2/hello.pyo')) +test.must_exist(test.workpath('pybuilderdir/pyfiles2/hello2.pyo')) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: \ No newline at end of file diff -r 5deaf494934a -r 4706e0194af3 src/parpg/settings.py --- a/src/parpg/settings.py Wed Jun 01 00:45:27 2011 -0700 +++ b/src/parpg/settings.py Tue May 31 02:46:20 2011 -0700 @@ -129,7 +129,8 @@ """ An object that represents a settings file, its sectons, and the options defined within those sections. """ - def __init__(self, settings_path='', system_path='', user_path='', suffix='.cfg'): + def __init__(self, settings_path='', system_path='', user_path='', + filename='parpg.cfg'): """ initializes a new settings object. If no paths are given, they are guessed based on whatever platform the script was run on. @@ -157,13 +158,9 @@ @param suffix: Suffix of the settings file that will be generated. @type suffix: string """ - if not suffix.startswith('.'): - suffix = '.' + suffix - - self.suffix = suffix + self.filename = filename self.settings_file = '' - - + self.paths = {} if not system_path and not user_path and not settings_path: # use platform-specific values as paths @@ -224,40 +221,38 @@ """ if filenames is None: - filenames = [os.path.join(self.paths['settings'], - 'system{0}'.format(self.suffix)), - os.path.join(self.paths['user'], - 'user{0}'.format(self.suffix))] + filenames = [os.path.join(self.paths['settings'], self.filename), + os.path.join(self.paths['user'], self.filename)] elif hasattr(filenames, 'split'): filenames = [filenames] for filename in filenames: section = None - - try: - self.settings_file = open(filename, 'r').readlines() - except IOError as (errno, strerror): - if errno == 2: - if os.path.basename(filename).startswith('system'): - print ('{0} could not be found. Please supply a ' - 'different path or generate a system settings ' - 'file with:\n' - 'python2 -m parpg.settings').format(filename) + if os.path.exists(filename): + try: + self.settings_file = open(filename, 'r').readlines() + except IOError as (errno, strerror): + if errno == 2: + if os.path.basename(filename).startswith('system'): + print ('{0} could not be found. Please supply a ' + 'different path or generate a system settings ' + 'file with:\n' + 'python2 -m parpg.settings').format(filename) + sys.exit(1) + else: + print 'Error No. {0}: {1} {2}'.format(errno, filename, strerror) sys.exit(1) - else: - print 'Error No. {0}: {1} {2}'.format(errno, filename, strerror) - sys.exit(1) - for line in self.settings_file: - if line.startswith('#') or line.strip() == '': - continue - elif line.startswith('[') and line.endswith(']\n'): - getattr(self, line[1:-2]) - section = line[1:-2] - else: - option, value = [item.strip() - for item in line.split('=', 1)] - setattr(getattr(self, section), option, value) + for line in self.settings_file: + if line.startswith('#') or line.strip() == '': + continue + elif line.startswith('[') and line.endswith(']\n'): + getattr(self, line[1:-2]) + section = line[1:-2] + else: + option, value = [item.strip() + for item in line.split('=', 1)] + setattr(getattr(self, section), option, value) def write(self, filename=None): """ Writes a settings file based on the settings object's diff -r 5deaf494934a -r 4706e0194af3 system.cfg.in --- a/system.cfg.in Wed Jun 01 00:45:27 2011 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,122 +0,0 @@ -[fife] -# Options marked with ? are untested/unknown - -# Game window's title (string) DO NOT EDIT! -WindowTitle = PARPG Techdemo 2 - -# Icon to use for the game window's border (filename) DO NOT EDIT! -WindowIcon = window_icon.png - -# Video driver to use. (?) -VideoDriver = "" - -# Backend to use for graphics (OpenGL|SDL) -RenderBackend = OpenGL - -# Run the game in fullscreen mode or not. (True|False) -FullScreen = False - -# Screen Resolution's width. Not used if FullScreen is set to False (800|1024|etc) -ScreenWidth = 800 - -# Screen Resolution's height. Not used if FullScreen is set to False (600|768|etc) -ScreenHeight = 600 - -# Screen DPI? (?) -BitsPerPixel = 0 - -# ? (?) -SDLRemoveFakeAlpha = 1 - -# Subdirectory to load icons from (path) -IconsPath = icons - -# ? ([R, G, B]) -ColorKey = [250, 0, 250] - -# ? (True|False) -ColorKeyEnabled = False - -# Turn on sound effects and music (True|False) -EnableSound = True - -# Initial volume of sound effects and music (0.0-100.0?) -InitialVolume = 5.0 - -# Characters to use to render fonts. DO NOT EDIT! -FontGlyphs = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,!?-+/():;%&`'*#=[]"" - -# Subdirectory to load fronts from (path) -FontsPath = fonts - -# Font to load when game starts -#TODO: make it so that the font name is supplied instead of the filename -Font = oldtypewriter.ttf - -# Size of in-game fonts -DefaultFontSize = 12 - -# ? (?) -LogModules = [controller] - -# ? (?) -PychanDebug = False - -# use Psyco Acceperation (True|False) -UsePsyco = False - -# ? (?) -ProfilingOn = False - -# Lighting Model to use (0-2) -Lighting = 0 - -[parpg] - -# System subdirectory to load maps from (path) -MapsPath = maps - -# YAML file that contains the available maps (filename) -MapsFile = maps.yaml - -# Map to load when game starts (filename) -Map = Mall - -# ? (filename) -AllAgentsFile = all_agents.yaml - -# System subdirectory to load objects from (path) -ObjectsPath = objects - -# YAML file that contains the database of availabel objects (filename) -ObjectDatabaseFile = object_database.yaml - -# System subdirectory to load dialogues from (path) -DialoguesPath = dialogues - -# System subdirectory to load quests from (path) -QuestsPath = quests - -# System subdirectory where gui files are loaded from (path) -GuiPath = gui - -# System subdirectory where cursors are loaded from (path) -CursorPath = cursors - -# File to use for default cursor (filename) -CursorDefault = cursor_plain.png - -# File to use for up cursor (filename) -CursorUp = cursor_up.png - -# File to use for right cursor (filename) -CursorRight = cursor_right.png - -# File to use for down cursor (filename) -CursorDown = cursor_down.png - -# File to use for left cursor (filename) -CursorLeft = cursor_left.png - -# Player walk speed (digit) -PCSpeed = 3