How do I make “setup.py bdist_egg” to ignore specific source files?

纵饮孤独 提交于 2019-12-10 16:33:36

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!