[Pyrex] New Distutils implementation for Pyrex.

Billy G. Allie bill.allie at defiant.mug.org
Thu Aug 2 02:55:11 CEST 2007


Greetings,

I am re-implementing my PostgreSQL interface (pyPgSQL) using Pyrex to 
implement an extension for the libpq C-API.  When using the supplied 
build_ext, I notices that I had to have the .pxd files in the same 
directory as the source .pyx file.  Also, the generated c source file 
was placed in the same directory as the Pyrex source.  I also could not 
specify Pyrex options to create a listing file, etc.  I wanted to have 
the .pxd files in an separate include directory and I also did not want 
to clean up the generated files from the Pyrex source directory.  To 
correct these (minor) annoyances, I've implesmentd a new version of 
buld_ext.py and created a version of core.py and extension.py.

This implementation of Pyrex.Distutils will:

   1. put the generated files (*.c, *.h, *.pxi) into the
      [build_temp]/pyrex directory (unless the --inplace option is used).
   2. add the following Pyrex specific command-line options:
          * pyrex-include-dirs: a list of directories that Pyrex will
            search for include files (the -I option of pyrexc)
          * pyrex-cplus: tells Pyrex to use the C++ compiler to compile
            the generated file.
          * pyrex-create-listing: tells Pyrex to place error messages in
            a listing (.lis) file.
   3. add the following Pyrex specific Extension parameters:
          * pyrex_include_dirs: a python list of include directories to
            search.
          * pyrex_cplus: a boolean parameter - =1 tells Pyrex to use the
            C++ compiler (i.e. generates .cpp files instead of .c files)
          * pyres_create_listing: a boolean parameter - =1 tells Pyres
            to  generate a listing (.lis) file.

These parameters can also be used in a distutils configuration file 
(i.e. setup.cfg).

I am also supplying a patch to Pyrex's Main.py that will place the 
listing file in the same directory as the output file, instead of in the 
same directory as the source file.

Thanks for a very useful product Greg.

Billy G. Allie.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.copyleft.no/pipermail/pyrex/attachments/20070802/61593739/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: build_ext.py
Type: text/x-python
Size: 5531 bytes
Desc: not available
Url : http://lists.copyleft.no/pipermail/pyrex/attachments/20070802/61593739/attachment.py 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: core.py
Type: text/x-python
Size: 1102 bytes
Desc: not available
Url : http://lists.copyleft.no/pipermail/pyrex/attachments/20070802/61593739/attachment-0001.py 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: extension.py
Type: text/x-python
Size: 2386 bytes
Desc: not available
Url : http://lists.copyleft.no/pipermail/pyrex/attachments/20070802/61593739/attachment-0002.py 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: __init__.py
Type: text/x-python
Size: 444 bytes
Desc: not available
Url : http://lists.copyleft.no/pipermail/pyrex/attachments/20070802/61593739/attachment-0003.py 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Main.diff
Type: text/x-patch
Size: 1231 bytes
Desc: not available
Url : http://lists.copyleft.no/pipermail/pyrex/attachments/20070802/61593739/attachment.bin 


More information about the Pyrex mailing list