How to create both a c extension and a pure python package
Marco Sulla
Marco.Sulla.Python at gmail.com
Tue Mar 9 17:42:11 EST 2021
As title. Currently I ended up using this trick in my setup.py:
if len(argv) > 1 and argv[1] == "c":
sys.argv = [sys.argv[0]] + sys.argv[2:]
setuptools.setup(ext_modules = ext_modules, **common_setup_args)
else:
setuptools.setup(**common_setup_args)
So if I pass "c" as the first argument of ./setup.py , the c extension
is builded, otherwise the py version is packaged.
Is there not a better way to do this?
More information about the Python-list
mailing list