Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I use scons to generate a setup.py file. So I created a template called setup.py.in and use scons to expand the template to generate setup.py.</p> <p>Here are some links to my project that does this:</p> <p><a href="http://sourceforge.net/p/nsound/code/756/tree/branch/nsound-dev-weegreenblobbie/setup.py.in" rel="nofollow">setup.py.in template</a></p> <p><a href="http://sourceforge.net/p/nsound/code/756/tree/branch/nsound-dev-weegreenblobbie/SConstruct" rel="nofollow">The SConstruct</a></p> <p>This computes a dictionary of key, value pairs to substitute into the setup.py.in template to generate setup.py.</p> <p>So the end user does two things:</p> <pre><code>scons setup.py python setup.py install </code></pre> <p>Warning: my sconstruct stuff is a bit messy as I wrote it awhile ago, but it should demonstrate the concept.</p> <p>If you learn how to write proper scons tools, then this can be transformed into a single target, for example:</p> <pre><code>scons --pymod </code></pre> <p>Here is a scons tool the generates a Python wrapper with SWIG:</p> <pre><code>import SCons.Action from SCons.Script import EnsureSConsVersion SCons.Script.EnsureSConsVersion(0,96,92) SwigGenAction = SCons.Action.Action('$SWIGGENCOM', '$SWIGGENCOMSTR') def emitter(target, source, env): """ Add dependency from target to source """ env.Depends(target, source) return target, source def generate(env): """ Add builders and construction variables for the SwigGen builder. """ if 'SWIGCOM' not in env: raise SystemError("SCons build environment could not detect tool: swig") bld = env.Builder( action = SwigGenAction, emitter = emitter, target_factory = env.fs.File) env['BUILDERS']['SwigGen'] = bld env['SWIGGENCOM'] = env['SWIGCOM'] def exists(env): return env.Detect('swig') </code></pre> <p>Now from your SConstruct file, you can generate the wrapper code:</p> <pre><code>foobar_cc = env.SwigGen("foobar_wrap.cc", "foobar.i") </code></pre> <p>If you modify foobar.i it will regenerate foobar_wrap.cc. Once you have this, you can write other tools for actually executing python setup.py install for you, so when --pymod is provided it will build the python module.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload