问题
I'm trying to build a package for a django application, but excluding all tests modules. I have tried setting
exclude = ["*.tests", "*.tests.*", "tests.*", "tests"]
on find_packages and defining a MANIFEST.in, but the tests are always compiled and included in the bundle.
Any clues?
回答1:
I found the combination both adding find_packages rule and writing out MANIFEST.in rules i.e. prune tests
Note that for python 3.2 and older you must have __init__.py in tests root, for find_packages command to consider tests folder to be a package.
Sample find_packages exclude command in setup.py
packages=find_packages(
exclude=["*.tests", "*.tests.*", "tests.*", "tests"]),
Sample MANIFEST.in
include *.txt *.ini *.cfg *.rst
recursive-include fmcc *.ico *.png *.css *.gif *.jpg *.pt *.txt *.mak *.mako *.js *.html *.xml
prune tests
回答2:
Can I asked...did you try:
find_packages(exclude=['tests'])
来源:https://stackoverflow.com/questions/9723861/how-do-i-make-setup-py-bdist-egg-to-ignore-specific-source-files