python: setup.py: how NOT to install C extensions used only by tests

Bartosz Golaszewski brgl at bgdev.pl
Wed Nov 30 15:23:41 EST 2022


I have a module that has a tests/ directory which contains a C
extension that's only used by test cases. I don't want to install it.
I'm building it as a setuptools.Extension() added to setup() using the
ext_modules argument. The test directory is not added to setup's
packages argument. Even though none of the python sources from the
tests/ directory gets installed when running setup.py install, the
extension binary (and nothing else) is installed into
site-packages/tests/. How can I prohibit setuptools from doing it?

Best Regards,
Bartosz Golaszewski


More information about the Python-list mailing list