view site_scons/site_tools/cpython/doc/reference.html @ 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.
author M. George Hansen <technopolitica@gmail.com>
date Tue, 31 May 2011 02:46:20 -0700
parents
children
line wrap: on
line source

<!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
>