无法通过setuptools在egg中包含静态包文件
我正在尝试 Pyramid 教程示例,它的内置 setup.py 文件似乎被设置为将静态文件添加到 Egg 文件,但实际上并没有发生。我已经进行了一些搜索并尝试了设置,但无法获得所需的行为。
- 有一个 MANIFEST.in 文件,它包含一行:
include *.ini
include_package_data
is set toTrue
package_data
包含条目:{ '' : ['*.ini'] }'
我更改什么设置似乎并不重要,似乎没有效果。我可能应该提到所需的文件列在 SOURCES.txt 文件中。
我想要包含的文件位于发行版目录的根目录中(setup.py 所在的位置)。
我在这里似乎缺少什么?
I am trying out the Pyramid tutorial example and it's built-in setup.py file appears to be set up to add static files to the egg file but it doesn't actually happen. I've done some search and toying with the settings but I'm unable to get the desired behavior.
- There is a MANIFEST.in file, it contains a line:
include *.ini
include_package_data
is set toTrue
package_data
contains the entry:{ '' : ['*.ini'] }'
It doesn't seem to matter what setting I change, there appears to be no effect. I should probably mention the desired files are listed in the SOURCES.txt file.
The files I'd like to have included are in the root of the distribution's directory (where setup.py resides).
What do I seem to be missing here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
金字塔的顶层.ini文件是“非包数据文件”,即它们所在的目录中没有
__init__.py
。这在某种程度上意味着它们不会包含在使用setup.py bdist_egg
生成的 Egg 存档中,即使您的条件 1 和 2 得到满足。要包含此类“非包数据文件”,我认为最干净的方法是将它们作为
data_files
添加到setup()
,例如然后,这些文件将包含在顶层的 Egg 档案,可通过以下方式检索:
The top level .ini files of pyramid are "non-package data files", i.e. there is no
__init__.py
in the directory they reside. This somehow means that they will not be included in the egg archive generated withsetup.py bdist_egg
, even if your conditions 1 and 2 are satisfied.To include such "non-package data files", I think the cleanest way is to add them as
data_files
tosetup()
, e.g.Then, the files will be included in the egg archive at the top level, retrievable with:
不知道那里发生了什么,但如果我在新构建的金字塔脚手架上执行“setup.py sdist”,这就是我到达的地方。
创建项目:
运行 sdist:
在脚手架中创建的 .ini 文件将放入生成的 tarball 中:
Not sure what's going on there, but if I do "setup.py sdist" on a freshly built Pyramid scaffold, this is where I get to.
Creating the project:
Running sdist:
The .ini files that were created in the scaffold are put into the resulting tarball: