Attachment 'reference.html'

Download

SCons tool “cpython” - Reference

Dirk Baechle

2010-07-28


Abstract

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.

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.

You are not allowed to attach a file to this page.