diff site_scons/site_tools/cpython/doc/manual.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 diff
--- /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 &#8220;<span class="quote"><code class="literal">InstallPython</code></span>&#8221; 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 &#8220;<span class="quote"><code class="literal">InstallPython</code></span>&#8221; 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 &#8220;<span class="quote"><code class="literal">SConstruct</code></span>&#8221; 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>&#8220;<span class="quote"><code class="literal">SCons</code></span>&#8221; invoked with the &#8220;<span class="quote"><code class="literal">-Q install</code></span>&#8221; parameter will compile the &#8220;<span class="quote"><code class="literal">hello.py</code></span>&#8221; file into
+&#8220;<span class="quote"><code class="literal">hello.pyc</code></span>&#8221;, and copy both files into &#8220;<span class="quote"><code class="literal">/usr/local/bin/</code></span>&#8221; 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>&#8220;<span class="quote"><code class="literal">InstallPython</code></span>&#8221; can also compile Python source files into optimized
+binary files (&#8220;<span class="quote"><code class="literal">.pyo</code></span>&#8221; suffix) instead of ordinary binaries (&#8220;<span class="quote"><code class="literal">.pyc</code></span>&#8221; files). To
+achieve this, change the call to &#8220;<span class="quote"><code class="literal">Environment()</code></span>&#8221; and set the &#8220;<span class="quote"><code class="literal">CPYTHON_PYC</code></span>&#8221;
+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 &#8220;<span class="quote"><code class="literal">InstallPython</code></span>&#8221; 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 &#8220;<span class="quote"><code class="literal">scons -Q install</code></span>&#8221; will copy all the &#8220;<span class="quote"><code class="literal">.py</code></span>&#8221; files from &#8220;<span class="quote"><code class="literal">pyfiles</code></span>&#8221; directory
+into &#8220;<span class="quote"><code class="literal">/usr/local/bin/pyfiles</code></span>&#8221; directory along with corresponding &#8220;<span class="quote"><code class="literal">.pyc</code></span>&#8221; 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>