How to package python extensions that need a special preprocessor?

Guy Streeter streeter at redhat.com
Thu Sep 3 14:19:06 UTC 2015


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 09/03/2015 05:36 AM, David Howells wrote:
> Hi,
> 
> I'm trying to package a python module that has a C extension that has a 
> special preprocessor that turns protocol definition files into C.
> 
> Currently, I have a makefile that calls the rxgen program[*]:
> 
> ./rxgen/rxgen.pl rpc-api/*
> 
> which produces four C files (afs_xg.[ch] and afs_py.[ch]) that then get 
> compiled and linked together with some other sources into an extension
> module:
> 
> from distutils.core import setup, Extension
> 
> setup(name = "kafs", version = "0.1", description = "AFS filesystem
> management scripting and commands", author = "David Howells", 
> author_email = "dhowells at redhat.com", license = "GPLv2", ext_modules =
> [Extension("kafs", sources = [ "afs_xg.c", "kafs.c", "afs_py.c", 
> "py_passwd.c", "py_rxgen.c", "py_rxconn.c", "py_rxsplit.c", "af_rxrpc.c" 
> ], extra_compile_args = [ "-O0", "-Wp,-U_FORTIFY_SOURCE", ], libraries =
> [ "k5crypto", "krb5" ] )])
> 
> Is there any way of making the Extension module do the rxgen step?  It
> would be possible to convert the rxgen perl scripts into python and call
> it directly - it's just that I find it easier to write a file parser in
> perl, at least initially.
> 
> David
> 
> [*] yes, I know, it's written in perl
> 

See the setup.py in this package:

https://git.fedorahosted.org/cgit/python-libnuma.git/

It runs msgfmt on the provided message catalog files at build time.

- --Guy

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iEYEARECAAYFAlXoVtoACgkQ0Bme0QyNhPRHewCgvBCbHGeR54Wj2dLZ3yFjunUV
ikkAmgNFJX1iSSR+a9oAz+P+QBsS8Sne
=874O
-----END PGP SIGNATURE-----


More information about the devel mailing list