我如何制作“setup.py bdist_egg"?忽略特定的源文件? [英] How do I make "setup.py bdist_egg" to ignore specific source files?

查看:52
本文介绍了我如何制作“setup.py bdist_egg"?忽略特定的源文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为 django 应用程序构建一个包,但不包括所有测试模块.我试过设置

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"]

find_packages 上并定义一个 MANIFEST.in,但测试总是被编译并包含在包中.

on find_packages and defining a MANIFEST.in, but the tests are always compiled and included in the bundle.

有什么线索吗?

推荐答案

我发现组合都添加了 find_packages 规则并写出 MANIFEST.in 规则 ie 修剪测试

I found the combination both adding find_packages rule and writing out MANIFEST.in rules i.e. prune tests

请注意,对于 python 3.2 及更早版本,您必须在测试根目录中有 __init__.py,以便 find_packages 命令将测试文件夹视为一个包.

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.

示例 find_packages setup.py

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

示例MANIFEST.in

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

这篇关于我如何制作“setup.py bdist_egg"?忽略特定的源文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆