| Running Pyste

To run pyste, you will need:

- Python 2.2, avaiable at python's website.
- The great elementtree library, from Fredrik Lundh.
- The excellent GCCXML, from Brad King.

Installation for the tools is avaiable 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.

## Ok, now what?

Well, now let's fire it up:

`

    >python pyste.py

    Usage:
        pyste [options] --module=<name> interface-files

    where options are:
        -I <path>           add an include path
        -D <symbol>         define symbol
        --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 "pyste"

`

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.

`--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 one of your header files declare a namespace named "pyste" and this is causing conflicts.

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.

## Wait... how do I set those I and D flags?

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.

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.