我有一个 Python 包,我想在其中包含一个空目录作为源代码分发的一部分。我尝试添加
include empty_directory
到 MANIFEST.in
文件,但是当我运行时
python setup.py sdist
空目录仍然不包括在内。有关如何执行此操作的任何提示?
最佳答案
根据 the docs :
include pat1 pat2
- include all files matching any of the listed patternsexclude pat1 pat2
- exclude all files matching any of the listed patternsrecursive-include dir pat1 pat2
- include all files under dir matching any of the listed patternsrecursive-exclude dir pat1 pat2
- exclude all files under dir matching any of the listed patternsglobal-include pat1 pat2
- include all files anywhere in the source tree matching — & any of the listed patternsglobal-exclude pat1 pat2
- exclude all files anywhere in the source tree matching — & any of the listed patternsprune dir
- exclude all files under dirgraft dir
- include all files under dir
看来你想要graft
,而不是include
。
另外,您似乎不能包含空目录。您必须在目录中创建一个“empty.txt
”文件或类似的文件以强制包含它。
关于python - 使用 python setup.py sdist 包含空目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2640378/