是否可以从 bdist 中排除数据文件源和中间文件? [英] Is it possible to exclude data file sources and intermediary files from bdist?
问题描述
我正在使用 setuptools 来构建一些数据文件(编译的翻译,图标调整大小并转换为不同的格式等),我想将这些数据文件的来源包含在 sdist
中,并将构建结果包含在 bdist_wheel 中,但不包含它们的来源和中间文件代码>.
I am using setuptools to build a number of data files (compiled translations,
icons resized and converted into different formats, etc.) and I would like to include the sources of these data files in to sdist
and the build results but not their sources and and intermediary files into bdist_wheel
.
当我使用 package_data
时,两个源、中间文件和构建文件都将包含在 bdist_wheel
中.例如.翻译源 (.ts) 被编译成 .qm 文件,然后作为 rcc 包的一部分包含在内,因此 bdist 包含三个不同格式的翻译副本,图标也是如此.
When I use package_data
both sources, intermediary files and built files will be included into bdist_wheel
. E.g. translation sources (.ts) are compiled into .qm files then included as part of a rcc bundle, so bdist includes three copies of the translations in different formats and the same happens with icons.
在使用 setuptools 时,是否有任何方法可以防止这种情况发生,即让 sdist
在其源格式中包含数据文件,而 bdist_wheel
仅包含构建结果而不包含源?
Is there any way to prevent this when using setuptools, i.e. have sdist
include data files in their source format and bdist_wheel
include only the built results without the sources?
推荐答案
在 MANIFEST.in
中包含您的目录(请参阅 docs),它完全适用于 sdist 分发.不要在 setup.py
中使用 include_package_data = True
,因为这会将 MANIFEST.in
中的文件包含到 bdist 发行版中.
Include your directories in MANIFEST.in
(see the docs), it's exactly for sdist distribution. Don't use include_package_data = True
in setup.py
because that includes files from MANIFEST.in
into bdist distributions.
这篇关于是否可以从 bdist 中排除数据文件源和中间文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!