Mercurial > parpg-core
changeset 11:4706e0194af3
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.
line wrap: on
line diff
--- 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
--- 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)
--- /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
--- 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 <stdlib.h> -#include <stdio.h> -#include <string.h> -#ifdef _WIN32 -# include <process.h> -#else -# include <sys/types.h> -# include <sys/wait.h> -#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); - } -} -
--- /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
--- /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
--- /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
--- /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
--- /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
--- /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
--- /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') +
--- /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 @@ +<?xml version='1.0'?> +<!-- + + 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. + +--> +<xsl:stylesheet + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:fo="http://www.w3.org/1999/XSL/Format" + version="1.0"> + + <xsl:import href="file:///usr/share/docbook-xsl-1.71.1/html/docbook.xsl"/> + +<xsl:param name="l10n.gentext.default.language" select="'en'"/> +<xsl:param name="section.autolabel" select="1"/> +<xsl:param name="html.stylesheet" select="'scons.css'"/> +<xsl:param name="generate.toc"> +/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 +</xsl:param> + +</xsl:stylesheet> +
--- /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 @@ +<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>CPython, a binary builder for Python installs</title><link rel="stylesheet" href="scons.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.71.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="article" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="id2476347"></a>CPython, a binary builder for Python installs</h2></div><div><div class="author"><h3 class="author"><span class="surname">Dirk Baechle</span></h3></div></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#examples">1. Examples</a></span></dt></dl></div><p>This first version of a Python Binary Builder is based on the work of +<a href="http://www.scons.org/wiki/GSoC2008/MatiGruca" target="_top">Mati Gruca's Google Summer of Code 2008 project</a> +(<a href="http://scons.tigris.org/source/browse/scons/branches/py-builder/" target="_top">last SVN branch</a>). +</p><p>The “<span class="quote"><code class="literal">InstallPython</code></span>” method creates <code class="literal">.pyc</code> or <code class="literal">.pyo</code> files for <code class="literal">.py</code> source files +and adds them to the list of targets along with the source files. +They are later copied to the destination (target) directory. +</p><p>The “<span class="quote"><code class="literal">InstallPython</code></span>” 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. +</p><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="examples"></a>1. Examples</h2></div></div></div><p>A simple example of an “<span class="quote"><code class="literal">SConstruct</code></span>” file: +</p><pre class="screen">env = Environment() +hello = File('hello.py') +env.InstallPython('/usr/local/bin/', hello) +env.Alias('install', '/usr/local/bin/') +</pre><p>“<span class="quote"><code class="literal">SCons</code></span>” invoked with the “<span class="quote"><code class="literal">-Q install</code></span>” parameter will compile the “<span class="quote"><code class="literal">hello.py</code></span>” file into +“<span class="quote"><code class="literal">hello.pyc</code></span>”, and copy both files into “<span class="quote"><code class="literal">/usr/local/bin/</code></span>” directory. +</p><p>Sample output: +</p><pre class="screen">$ scons -Q install +Install file: "hello.py" as "/usr/local/bin/hello.py" +Install file: "hello.pyc" as "/usr/local/bin/hello.pyc" +</pre><p>“<span class="quote"><code class="literal">InstallPython</code></span>” can also compile Python source files into optimized +binary files (“<span class="quote"><code class="literal">.pyo</code></span>” suffix) instead of ordinary binaries (“<span class="quote"><code class="literal">.pyc</code></span>” files). To +achieve this, change the call to “<span class="quote"><code class="literal">Environment()</code></span>” and set the “<span class="quote"><code class="literal">CPYTHON_PYC</code></span>” +variable to '<code class="literal">0</code>' (zero): +</p><pre class="screen">env = Environment(CPYTHON_PYC=0) +hello = File('hello.py') +env.InstallPython('/usr/local/bin/', hello) +env.Alias('install', '/usr/local/bin/') +</pre><p>Sample output: +</p><pre class="screen">$ scons -Q install +Install file: "hello.py" as "/usr/local/bin/hello.py" +Install file: "hello.pyo" as "/usr/local/bin/hello.pyo" +</pre><p>The “<span class="quote"><code class="literal">InstallPython</code></span>” method accepts both, files and directories, as its source arguments: +</p><pre class="screen">env = Environment() +pyfiles = Dir('pyfiles/') +env.InstallPython('/usr/local/bin/', pyfiles) +env.Alias('install', '/usr/local/bin') +</pre><p>Running “<span class="quote"><code class="literal">scons -Q install</code></span>” will copy all the “<span class="quote"><code class="literal">.py</code></span>” files from “<span class="quote"><code class="literal">pyfiles</code></span>” directory +into “<span class="quote"><code class="literal">/usr/local/bin/pyfiles</code></span>” directory along with corresponding “<span class="quote"><code class="literal">.pyc</code></span>” files. +</p><p>Sample output: +</p><pre class="screen">$ 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" +</pre><p>Mixing files and directories is also possible: +</p><pre class="screen">env = Environment() +hello = File('hello.py') +pyfiles = Dir('pyfiles/') +env.InstallPython('/usr/local/bin/', [hello, pyfiles]) +env.Alias('install', '/usr/local/bin') +</pre><p>Sample output: +</p><pre class="screen">$ 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" +</pre></div></div></body></html>
--- /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<ZJc<uSrXlN>#+a_\^l.DI@4DiHn73ZH@BI3&D'@bBD[]H%8:^QVa:=7_<p8n)<E2cQ$!X)qO.$,RfD6u5obb9nL_etaPi.5,Yj7Q8<Q<fcJDt;1W1bE'H]itVj9\1ZDfMPIZ<s2<i:SPl"(E[Rj;b1:^amkGe,#a5]F5G,OR6/AKEBP(*SEBAkfUs!FB>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\!<gC5Gqf=;0EBW7uXjHQ-)!=r>hap'Em,:I%*?0D)=37S^JBA#>n"PrFR>MU-%e5`s,.#DefK)rnc)o,aNr=am-ctpIWq3Nn<ILVdPgqB0$*ZcA!&S>a.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`</d23(e*4;7&&LI3+<&2D8`Ym75b*.Xhqu3qcsriL^ImDLij\C`F=dhSukI^;Xhi;Gus0r8f1;dP<n8fVUDgo8@:\fbGFn<Y4ktL1?42mP.8ee$&Qc&Op1YhOu&H5k,kDa<[gXNOC[TZJIcb2;399W!9KMsCU]CW+djE0\[b1u5VhF.%'s5E=1C^op4US"<0U3>92T^Uo!\*%S@C`2#icms:6n*S?TClm<t<7<UTPS\\\\98/(`m"Y+3k@>(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<DTAo&^K/Cal$](7BpF.Ve*7_Be!tFp_;$L#Cn`2s"spqbLMj#f2$%fgdjKgRlFV^)$5p5Wph0IJT-[VW,dTq0c;)]NL0F3_@OVGKBO]jEEDV0Fq1V6Rdo4YOHog_4#UN@:E@ba-Vg:Q38"DDFFk6!PaD@QQO*i@%l$[_&k%TC./P\WQU)(P<SG#O&5n.ZIT7GfF;HFmEZ0^U,PJVu.@dl"k".7-I5i.l5$#Q=hg[=&HqL:\*(of^UeDDP.LtrIZm'<$kY7-WSZn@'Qfu/E`L1,,LW3MJJ;qblcbW6igFQ,B>.aZq+=i;,E4p,qB^NAhp,"N==9Z<PQ1mTXeTA-H#j'rU>\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<ad@N0_;/ZtTSfP$SEYA2^WV>]<kM]D2La&;fp?.4G5CU<bHelX.Eg_pP*YP[PafN6+SK;I</i@4pURC<>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`%\'<fS^^KM_OC7(h&n583b_8'`Z[TNRI9=^Bc[6E2+f!n2HhVLq&EJ0=p>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=<kO0'Zqq<`?rA7b;R"E],2$76>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&[P<YAB2oGH05?<$DjI%7dLQ*V"q_"i)q't^n`d6W=`:*<DsfY8Z<rkS29/-P#tKFm*4)S1*d!W%HD'4Xg/Luqk'B2E+'(OtDJ%Z"*;#)-EhMOje8X0bREA,bg+Q2MP%!QVR.o,^%rf.r/c1=@^bX\4E1<C=7+66U?.Z1js/L+i8[6S4UtFnt>1nfT.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"1U<IRgF*3,#==0)_I?C_kCP;^!#e?TR*"J6MEL`akh#%J)#Nuh%5d#o:oeVWVr\qJkS0[LNl^hgl<Q2FU6%Kg="BnO^Wg<[[Yk?#DE$H*7CC@n2d[WBu/RP*\'Og[d\e/p_D\`R%NjJf^CKp)&JG26)gaX@iP);A_`mB62-<=1TX-[!rQmkbaR^aJg)POC=2#U@>1Oe6fp+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
--- /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 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" +"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"> +<article> + <title>CPython, a binary builder for Python installs</title> + <articleinfo> + <author> + <surname>Dirk Baechle</surname> + </author> + </articleinfo> +<para>This first version of a Python Binary Builder is based on the work of +<ulink url="http://www.scons.org/wiki/GSoC2008/MatiGruca">Mati Gruca's Google Summer of Code 2008 project</ulink> +(<ulink url="http://scons.tigris.org/source/browse/scons/branches/py-builder/">last SVN branch</ulink>). +</para> +<para>The <quote><literal>InstallPython</literal></quote> method creates <literal>.pyc</literal> or <literal>.pyo</literal> files for <literal>.py</literal> source files +and adds them to the list of targets along with the source files. +They are later copied to the destination (target) directory. +</para> +<para>The <quote><literal>InstallPython</literal></quote> 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. +</para> +<section id="examples"><title>Examples</title> +<para>A simple example of an <quote><literal>SConstruct</literal></quote> file: +</para> +<screen>env = Environment() +hello = File('hello.py') +env.InstallPython('/usr/local/bin/', hello) +env.Alias('install', '/usr/local/bin/') +</screen> +<para><quote><literal>SCons</literal></quote> invoked with the <quote><literal>-Q install</literal></quote> parameter will compile the <quote><literal>hello.py</literal></quote> file into +<quote><literal>hello.pyc</literal></quote>, and copy both files into <quote><literal>/usr/local/bin/</literal></quote> directory. +</para> +<para>Sample output: +</para> +<screen>$ scons -Q install +Install file: "hello.py" as "/usr/local/bin/hello.py" +Install file: "hello.pyc" as "/usr/local/bin/hello.pyc" +</screen> +<para><quote><literal>InstallPython</literal></quote> can also compile Python source files into optimized +binary files (<quote><literal>.pyo</literal></quote> suffix) instead of ordinary binaries (<quote><literal>.pyc</literal></quote> files). To +achieve this, change the call to <quote><literal>Environment()</literal></quote> and set the <quote><literal>CPYTHON_PYC</literal></quote> +variable to '<literal>0</literal>' (zero): +</para> +<screen>env = Environment(CPYTHON_PYC=0) +hello = File('hello.py') +env.InstallPython('/usr/local/bin/', hello) +env.Alias('install', '/usr/local/bin/') +</screen> +<para>Sample output: +</para> +<screen>$ scons -Q install +Install file: "hello.py" as "/usr/local/bin/hello.py" +Install file: "hello.pyo" as "/usr/local/bin/hello.pyo" +</screen> +<para>The <quote><literal>InstallPython</literal></quote> method accepts both, files and directories, as its source arguments: +</para> +<screen>env = Environment() +pyfiles = Dir('pyfiles/') +env.InstallPython('/usr/local/bin/', pyfiles) +env.Alias('install', '/usr/local/bin') +</screen> +<para>Running <quote><literal>scons -Q install</literal></quote> will copy all the <quote><literal>.py</literal></quote> files from <quote><literal>pyfiles</literal></quote> directory +into <quote><literal>/usr/local/bin/pyfiles</literal></quote> directory along with corresponding <quote><literal>.pyc</literal></quote> files. +</para> +<para>Sample output: +</para> +<screen>$ 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" +</screen> +<para>Mixing files and directories is also possible: +</para> +<screen>env = Environment() +hello = File('hello.py') +pyfiles = Dir('pyfiles/') +env.InstallPython('/usr/local/bin/', [hello, pyfiles]) +env.Alias('install', '/usr/local/bin') +</screen> +<para>Sample output: +</para> +<screen>$ 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" +</screen> +</section> + +</article>
--- /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 @@ +<?xml version='1.0'?> +<!-- + + 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. + +--> + +<xsl:stylesheet + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:fo="http://www.w3.org/1999/XSL/Format" + version="1.0"> + + <xsl:import href="file:///usr/share/docbook-xsl-1.71.1/fo/docbook.xsl"/> + +<xsl:param name="l10n.gentext.default.language" select="'en'"/> +<xsl:param name="section.autolabel" select="1"></xsl:param> +<xsl:param name="toc.indent.width" select="0"></xsl:param> +<xsl:param name="body.start.indent">0pt</xsl:param> +<xsl:param name="shade.verbatim" select="1"></xsl:param> +<xsl:param name="generate.toc"> +/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 +</xsl:param> + +<xsl:template match="varlistentry/term"> + <xsl:call-template name="inline.boldseq"/> +</xsl:template> + +</xsl:stylesheet> +
--- /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 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<HTML +><HEAD +><TITLE +>SCons tool cpython - Reference</TITLE +><META +NAME="GENERATOR" +CONTENT="Modular DocBook HTML Stylesheet Version 1.79"></HEAD +><BODY +CLASS="article" +BGCOLOR="#FFFFFF" +TEXT="#000000" +LINK="#0000FF" +VLINK="#840084" +ALINK="#0000FF" +><DIV +CLASS="ARTICLE" +><DIV +CLASS="TITLEPAGE" +><H1 +CLASS="title" +><A +NAME="AEN2" +>SCons tool <SPAN +CLASS="QUOTE" +>"cpython"</SPAN +> - Reference</A +></H1 +><H3 +CLASS="author" +><A +NAME="AEN5" +>Dirk Baechle</A +></H3 +><P +CLASS="pubdate" +>2010-07-28<BR></P +><HR></DIV +><DIV +CLASS="TOC" +><DL +><DT +><B +>Table of Contents</B +></DT +><DT +>1. <A +HREF="#interna" +>Interna</A +></DT +><DT +>2. <A +HREF="#AEN20" +>Builders</A +></DT +><DD +><DL +><DT +>2.1. <A +HREF="#AEN22" +>InstallPython</A +></DT +></DL +></DD +><DT +>3. <A +HREF="#AEN33" +>Variables</A +></DT +></DL +></DIV +><BLOCKQUOTE +CLASS="ABSTRACT" +><DIV +CLASS="abstract" +><P +></P +><A +NAME="AEN9" +></A +><P +>This reference lists all the variables that are used within the + <SPAN +CLASS="QUOTE" +>"cpython"</SPAN +> 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.</P +><P +></P +></DIV +></BLOCKQUOTE +><DIV +CLASS="section" +><HR><H2 +CLASS="section" +><A +NAME="interna" +>1. Interna</A +></H2 +><P +>Internally, the builder is based on the + <TT +CLASS="literal" +>Install</TT +>/<TT +CLASS="literal" +>InstallAs</TT +> methods from + <TT +CLASS="literal" +>SCons.Tool.install</TT +>. It makes use of the basic builder's + functions: <TT +CLASS="literal" +>installFunc()</TT +>, and + <TT +CLASS="literal" +>add_targets_to_INSTALLED_FILES()</TT +>.</P +></DIV +><DIV +CLASS="section" +><HR><H2 +CLASS="section" +><A +NAME="AEN20" +>2. Builders</A +></H2 +><DIV +CLASS="section" +><H3 +CLASS="section" +><A +NAME="AEN22" +>2.1. InstallPython</A +></H3 +><P +>The <SPAN +CLASS="QUOTE" +>"<TT +CLASS="literal" +>InstallPython</TT +>"</SPAN +> method creates + <TT +CLASS="literal" +>.pyc</TT +> or <TT +CLASS="literal" +>.pyo</TT +> files for + <TT +CLASS="literal" +>.py</TT +> source files and adds them to the list of targets + along with the source files. They are later copied to the destination + (target) directory.</P +><P +>Example:</P +><P +><PRE +CLASS="screen" +>env = Environment() +hello = File('hello.py') +env.InstallPython('/usr/local/bin/', hello) +env.Alias('install', '/usr/local/bin/') +</PRE +></P +></DIV +></DIV +><DIV +CLASS="section" +><HR><H2 +CLASS="section" +><A +NAME="AEN33" +>3. Variables</A +></H2 +><P +><P +></P +><DIV +CLASS="variablelist" +><DL +><DT +>CPYTHON_PYC</DT +><DD +><P +>Default value is <TT +CLASS="literal" +>1</TT +>, which means that the + Python source files get compiled to <TT +CLASS="literal" +>.pyc</TT +> files. + Set this variable to <TT +CLASS="literal" +>0</TT +> in order to get + optimized <TT +CLASS="literal" +>.pyo</TT +> files, parallel to your + installed sources.</P +></DD +><DT +>CPYTHON_EXE</DT +><DD +><P +>The path to the external Python executable, used for + creating optimized <TT +CLASS="literal" +>.pyo</TT +> files. Default value is + '<TT +CLASS="literal" +>python</TT +>'.</P +></DD +><DT +>CPYTHON_PYO_FLAGS</DT +><DD +><P +>Additional flags for compiling optimized Python files + (<TT +CLASS="literal" +>.pyo</TT +>). The default is + '<TT +CLASS="literal" +>-O</TT +>'.</P +></DD +><DT +>CPYTHON_PYO_CMD</DT +><DD +><P +>The command arguments for compiling optimized Python files + (<TT +CLASS="literal" +>.pyo</TT +>). The default value is '<TT +CLASS="literal" +>-c + 'import sys,py_compile; [py_compile.compile(i) for i in + sys.argv[1:]]'</TT +>'.</P +></DD +><DT +>CPYTHON_PYCOM</DT +><DD +><P +>The command line for compiling optimized Python files + (<TT +CLASS="literal" +>.pyo</TT +>). Default is '<TT +CLASS="literal" +>$CPYTHON_EXE + $CPYTHON_PYO_FLAGS $CPYTHON_PYO_CMD</TT +>'.</P +></DD +><DT +>CPYTHON_PYCOMSTR</DT +><DD +><P +>The message string for the + '<TT +CLASS="literal" +>CPYTHON_PYCOM</TT +>' command. Default is + '<TT +CLASS="literal" +>Install file: "$SOURCE" as "$TARGET"</TT +>'.</P +></DD +><DT +>CPYTHON_SUFFIX</DT +><DD +><P +>Default value is '.py'. The suffix for Python source + files.</P +></DD +></DL +></DIV +></P +></DIV +></DIV +></BODY +></HTML +> \ No newline at end of file
--- /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 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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. + +--> +<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" +"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"> +<article> + <articleinfo> + <title>SCons tool <quote>cpython</quote> - Reference</title> + + <author> + <firstname>Dirk</firstname> + + <surname>Baechle</surname> + </author> + + <pubdate>2010-07-28</pubdate> + </articleinfo> + + <abstract> + <para>This reference lists all the variables that are used within the + <quote>cpython</quote> 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.</para> + </abstract> + + <section id="interna"> + <title>Interna</title> + + <para>Internally, the builder is based on the + <literal>Install</literal>/<literal>InstallAs</literal> methods from + <literal>SCons.Tool.install</literal>. It makes use of the basic builder's + functions: <literal>installFunc()</literal>, and + <literal>add_targets_to_INSTALLED_FILES()</literal>.</para> + </section> + + <section> + <title>Builders</title> + + <section> + <title>InstallPython</title> + + <para>The <quote><literal>InstallPython</literal></quote> method creates + <literal>.pyc</literal> or <literal>.pyo</literal> files for + <literal>.py</literal> source files and adds them to the list of targets + along with the source files. They are later copied to the destination + (target) directory.</para> + + <para>Example:</para> + + <para><screen>env = Environment() +hello = File('hello.py') +env.InstallPython('/usr/local/bin/', hello) +env.Alias('install', '/usr/local/bin/') +</screen></para> + </section> + </section> + + <section> + <title>Variables</title> + + <para><variablelist> + <varlistentry> + <term>CPYTHON_PYC</term> + + <listitem> + <para>Default value is <literal>1</literal>, which means that the + Python source files get compiled to <literal>.pyc</literal> files. + Set this variable to <literal>0</literal> in order to get + optimized <literal>.pyo</literal> files, parallel to your + installed sources.</para> + </listitem> + </varlistentry> + + <varlistentry> + <term>CPYTHON_EXE</term> + + <listitem> + <para>The path to the external Python executable, used for + creating optimized <literal>.pyo</literal> files. Default value is + '<literal>python</literal>'.</para> + </listitem> + </varlistentry> + + <varlistentry> + <term>CPYTHON_PYO_FLAGS</term> + + <listitem> + <para>Additional flags for compiling optimized Python files + (<literal>.pyo</literal>). The default is + '<literal>-O</literal>'.</para> + </listitem> + </varlistentry> + + <varlistentry> + <term>CPYTHON_PYO_CMD</term> + + <listitem> + <para>The command arguments for compiling optimized Python files + (<literal>.pyo</literal>). The default value is '<literal>-c + 'import sys,py_compile; [py_compile.compile(i) for i in + sys.argv[1:]]'</literal>'.</para> + </listitem> + </varlistentry> + + <varlistentry> + <term>CPYTHON_PYCOM</term> + + <listitem> + <para>The command line for compiling optimized Python files + (<literal>.pyo</literal>). Default is '<literal>$CPYTHON_EXE + $CPYTHON_PYO_FLAGS $CPYTHON_PYO_CMD</literal>'.</para> + </listitem> + </varlistentry> + + <varlistentry> + <term>CPYTHON_PYCOMSTR</term> + + <listitem> + <para>The message string for the + '<literal>CPYTHON_PYCOM</literal>' command. Default is + '<literal>Install file: "$SOURCE" as "$TARGET"</literal>'.</para> + </listitem> + </varlistentry> + + <varlistentry> + <term>CPYTHON_SUFFIX</term> + + <listitem> + <para>Default value is '.py'. The suffix for Python source + files.</para> + </listitem> + </varlistentry> + </variablelist></para> + </section> +</article> \ No newline at end of file
--- /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; + }
--- /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')
--- /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')
--- /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')
--- /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'
--- /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'
--- /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'
--- /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'
--- /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
--- /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
--- /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
--- 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
--- 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