mirror of
https://github.com/boostorg/python.git
synced 2026-01-22 17:32:55 +00:00
151 lines
7.3 KiB
HTML
151 lines
7.3 KiB
HTML
<html>
|
|
<head>
|
|
<!-- Generated by the Spirit (http://spirit.sf.net) QuickDoc -->
|
|
<title>Running Pyste</title>
|
|
<link rel="stylesheet" href="theme/style.css" type="text/css">
|
|
<link rel="prev" href="introduction.html">
|
|
<link rel="next" href="the_interface_files.html">
|
|
</head>
|
|
<body>
|
|
<table width="100%" height="48" border="0" cellspacing="2">
|
|
<tr>
|
|
<td><img src="theme/c%2B%2Bboost.gif">
|
|
</td>
|
|
<td width="85%">
|
|
<font size="6" face="Verdana, Arial, Helvetica, sans-serif"><b>Running Pyste</b></font>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<br>
|
|
<table border="0">
|
|
<tr>
|
|
<td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td>
|
|
<td width="30"><a href="introduction.html"><img src="theme/l_arr.gif" border="0"></a></td>
|
|
<td width="20"><a href="the_interface_files.html"><img src="theme/r_arr.gif" border="0"></a></td>
|
|
</tr>
|
|
</table>
|
|
<p>
|
|
To run Pyste, you will need:</p>
|
|
<ul><li>Python 2.2, available at <a href="http://www.python.org">
|
|
python's website</a>.</li><li>The great <a href="http://effbot.org">
|
|
elementtree</a> library, from Fredrik Lundh.</li><li>The excellent <a href="http://www.gccxml.org">
|
|
GCCXML</a>, from Brad King.</li></ul><p>
|
|
Installation for the tools is available in their respective webpages.</p>
|
|
<table width="80%" border="0" align="center">
|
|
<tr>
|
|
<td class="note_box">
|
|
|
|
<img src="theme/note.gif"></img> <a href="http://www.gccxml.org">
|
|
GCCXML</a> must be accessible in the PATH environment variable, so
|
|
that Pyste can call it. How to do this varies from platform to platform.
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<a name="ok__now_what_"></a><h2>Ok, now what?</h2><p>
|
|
Well, now let's fire it up:</p>
|
|
<code><pre>
|
|
|
|
>python pyste.py
|
|
|
|
Pyste version 0.6.5
|
|
|
|
Usage:
|
|
pyste [options] --module=<name> interface-files
|
|
|
|
where options are:
|
|
-I <path> add an include path
|
|
-D <symbol> define symbol
|
|
--multiple create various cpps (one for each pyste file), instead
|
|
of only one (useful during development)
|
|
--out specify output filename (default: <module>.cpp)
|
|
in --multiple mode, this will be a directory
|
|
--no-using do not declare "using namespace boost";
|
|
use explicit declarations instead
|
|
--pyste-ns=<name> set the namespace where new types will be declared;
|
|
default is the empty namespace
|
|
--debug writes the xml for each file parsed in the current
|
|
directory
|
|
-h, --help print this help and exit
|
|
-v, --version print version information
|
|
|
|
</pre></code><p>
|
|
Options explained:</p>
|
|
<p>
|
|
The <tt>-I</tt> and <tt>-D</tt> are preprocessor flags, which are needed by <a href="http://www.gccxml.org">
|
|
GCCXML</a> to parse
|
|
the header files correctly and by Pyste to find the header files declared in the
|
|
interface files.</p>
|
|
<p>
|
|
<tt>--multiple</tt> tells Pyste to generate multiple cpps for this module (one for
|
|
each header parsed) in the directory named by <tt>--out</tt>, instead of the usual
|
|
single cpp file. This mode is useful during development of a binding, because
|
|
you are constantly changing source files, re-generating the bindings and
|
|
recompiling. This saves a lot of time in compiling.</p>
|
|
<p>
|
|
<tt>--out</tt> names the output file (default: <tt><module>.cpp</tt>), or in multiple mode,
|
|
names a output directory for the files (default: <tt><module></tt>).</p>
|
|
<p>
|
|
<tt>--no-using</tt> tells Pyste to don't declare "<tt>using namespace boost;</tt>" in the
|
|
generated cpp, using the namespace boost::python explicitly in all declarations.
|
|
Use only if you're having a name conflict in one of the files.</p>
|
|
<p>
|
|
Use <tt>--pyste-ns</tt> to change the namespace where new types are declared (for
|
|
instance, the virtual wrappers). Use only if you are having any problems. By
|
|
default, Pyste uses the empty namespace.</p>
|
|
<p>
|
|
<tt>--debug</tt> will write in the current directory a xml file as outputted by <a href="http://www.gccxml.org">
|
|
GCCXML</a>
|
|
for each header parsed. Useful for bug reports.</p>
|
|
<p>
|
|
<tt>-h, --help, -v, --version</tt> are self-explaining, I believe. ;)</p>
|
|
<p>
|
|
So, the usage is simple enough:</p>
|
|
<code><pre>>python pyste.py --module=mymodule file.pyste file2.pyste ...</pre></code><p>
|
|
will generate a file <tt>mymodule.cpp</tt> in the same dir where the command was
|
|
executed. Now you can compile the file using the same instructions of the
|
|
<a href="../../doc/tutorial/doc/building_hello_world.html">
|
|
tutorial</a>. Or, if you prefer:</p>
|
|
<code><pre>>python pyste.py --module=mymodule --multiple file.pyste file2.pyste ...</pre></code><p>
|
|
will create a directory named "mymodule" in the current directory, and will
|
|
generate a bunch of cpp files, one for each header exported. You can then
|
|
compile them all into a single shared library (or dll).</p>
|
|
<a name="wait____how_do_i_set_those_i_and_d_flags_"></a><h2>Wait... how do I set those I and D flags?</h2><p>
|
|
Don't worry: normally <a href="http://www.gccxml.org">
|
|
GCCXML</a> is already configured correctly for your plataform,
|
|
so the search path to the standard libraries and the standard defines should
|
|
already be set. You only have to set the paths to other libraries that your code
|
|
needs, like Boost, for example.</p>
|
|
<p>
|
|
Plus, Pyste automatically uses the contents of the environment variable
|
|
<tt>INCLUDE</tt> if it exists. Visual C++ users should run the <tt>Vcvars32.bat</tt> file,
|
|
which for Visual C++ 6 is normally located at:</p>
|
|
<code><pre>
|
|
<span class=identifier>C</span><span class=special>:\</span><span class=identifier>Program </span><span class=identifier>Files</span><span class=special>\</span><span class=identifier>Microsoft </span><span class=identifier>Visual </span><span class=identifier>Studio</span><span class=special>\</span><span class=identifier>VC98</span><span class=special>\</span><span class=identifier>bin</span><span class=special>\</span><span class=identifier>Vcvars32</span><span class=special>.</span><span class=identifier>bat
|
|
</span></pre></code>
|
|
<p>
|
|
with that, you should have little trouble setting up the flags.</p>
|
|
<table width="80%" border="0" align="center">
|
|
<tr>
|
|
<td class="note_box">
|
|
<img src="theme/note.gif"></img><b>A note about Psyco</b><br><br>
|
|
Although you don't have to install <a href="http://psyco.sourceforge.net/">
|
|
Psyco</a> to use Pyste, if you do, Pyste will make use of it to speed up the wrapper generation. Speed ups of 30% can be achieved, so it's highly recommended.
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<table border="0">
|
|
<tr>
|
|
<td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td>
|
|
<td width="30"><a href="introduction.html"><img src="theme/l_arr.gif" border="0"></a></td>
|
|
<td width="20"><a href="the_interface_files.html"><img src="theme/r_arr.gif" border="0"></a></td>
|
|
</tr>
|
|
</table>
|
|
<br>
|
|
<hr size="1"><p class="copyright">Copyright © 2003 Bruno da Silva de Oliveira<br>Copyright © 2002-2003 Joel de Guzman<br><br>
|
|
<font size="2">Permission to copy, use, modify, sell and distribute this document
|
|
is granted provided this copyright notice appears in all copies. This document
|
|
is provided "as is" without express or implied warranty, and with
|
|
no claim as to its suitability for any purpose. </font> </p>
|
|
</body>
|
|
</html>
|