I'm using Cython to generate a shared object out of Python module. The compilation output is written to build/lib.linux-x86_64-3.5/<Package>/<module>.cpython-35m-x86_64-linux-gnu.so
. Is there any option to change the naming rule? I want the file to be named <module>.so
without the interpreter version or arch appendix.
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
This behavior has been defined in distutils package. distutils uses sysconfig and "EXT_SUFFIX" config variable:
Starting with Python 3.5 "EXT_SUFFIX" variable contains platform information, for example ".cp35-win_amd64".
I have written the following function:
And custom build_ext command:
Usage:
Seems like
setuptools
provides no option to change or get rid of the suffix completely. The magic happens indistutils/command/build_ext.py
:Seems like I will need to add a post-build renaming action.
Update from 08/12/2016:
Ok, I forgot to actually post the solution. Actually, I implemented a renaming action by overloading the built-in
install_lib
command. Here's the logic:Now all you have to do is to overload the command in the
setup
function:Still, I'm not happy with overloading standard commands; if you find a better solution, post it and I will accept your answer.