Cython, producing different modules from the same .pyx

Lele Gaifax lele at metapensiero.it
Thu Dec 19 08:16:48 EST 2019


Hi all,

in my package, I would like to compile and distribute two different extension
modules starting from the same .pyx file, just with different compilation
flags and libraries.

My first approach has been duplicating the Extension() entry in the
setup.py(*), changing the first argument (that is, the name of the module).
Although that did produce the alternative binary module, it could not be
loaded because it contains the wrong PyInit_XXX(), where XXX is computed from
the .pyx name, in my case "parser".

I tried looking at Cython documentation, and even its sources, but couldn't
find a way to alter that name.

Did I miss something, or is the only way to duplicate the source .pyx file to
a different name?

Thanks in advance,
ciao, lele.

(*) https://github.com/lelit/pglast/blob/master/setup.py#L76
-- 
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
lele at metapensiero.it  |                 -- Fortunato Depero, 1929.



More information about the Python-list mailing list