|
Running Pyste |
![]() |
![]() |
![]() |
To run Pyste, you will need:
Installation for the tools is available in their respective webpages.
GCCXML must be accessible in the PATH environment variable, so
that Pyste can call it. How to do this varies from platform to platform.
|
Well, now let's fire it up:
>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
Options explained:
The -I and -D are preprocessor flags, which are needed by GCCXML to parse the header files correctly and by Pyste to find the header files declared in the interface files.
--multiple tells Pyste to generate multiple cpps for this module (one for each header parsed) in the directory named by --out, 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.
--out names the output file (default: <module>.cpp), or in multiple mode, names a output directory for the files (default: <module>).
--no-using tells Pyste to don't declare "using namespace boost;" 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.
Use --pyste-ns 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.
--debug will write in the current directory a xml file as outputted by GCCXML for each header parsed. Useful for bug reports.
-h, --help, -v, --version are self-explaining, I believe. ;)
So, the usage is simple enough:
>python pyste.py --module=mymodule file.pyste file2.pyste ...
will generate a file mymodule.cpp in the same dir where the command was executed. Now you can compile the file using the same instructions of the tutorial. Or, if you prefer:
>python pyste.py --module=mymodule --multiple file.pyste file2.pyste ...
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).
Don't worry: normally GCCXML 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.
Plus, Pyste automatically uses the contents of the environment variable INCLUDE if it exists. Visual C++ users should run the Vcvars32.bat file, which for Visual C++ 6 is normally located at:
C:\Program Files\Microsoft Visual Studio\VC98\bin\Vcvars32.bat
with that, you should have little trouble setting up the flags.
A note about PsycoAlthough you don't have to install Psyco 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. |
![]() |
![]() |
![]() |
Copyright © 2003 Bruno da Silva de Oliveira
Copyright © 2002-2003 Joel de Guzman
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.