简体   繁体   English

如何使“setup.py bdist_egg”忽略特定的源文件?

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

I'm trying to build a package for a django application, but excluding all tests modules. 我正在尝试为django应用程序构建一个包,但不包括所有测试模块。 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. find_packages定义一个MANIFEST.in ,但是测试总是被编译并包含在bundle中。

Any clues? 有线索吗?

I found the combination both adding find_packages rule and writing out MANIFEST.in rules ie prune tests 我发现组合都添加了find_packages规则并写出了MANIFEST.in规则,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. 请注意,对于python 3.2及更早版本,您必须在测试root中使用__init__.py ,因为find_packages命令将tests文件夹视为包。

Sample find_packages exclude command in setup.py 示例find_packages排除setup.py命令

 packages=find_packages(
    exclude=["*.tests", "*.tests.*", "tests.*", "tests"]),

Sample MANIFEST.in 示例MANIFEST.in

 include *.txt *.ini *.cfg *.rst
 recursive-include fmcc *.ico *.png *.css *.gif *.jpg *.pt *.txt *.mak *.mako *.js *.html *.xml
 prune tests

Can I asked...did you try: 我可以问......你试过了吗?

find_packages(exclude=['tests']) find_packages(排除= [ '测试'])

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM