简体   繁体   English

如何在python distutils中包含隐藏文件?

[英]How to include hidden files in python distutils?

My package has a hidden directory I want to distribute as package data.我的包有一个隐藏目录,我想作为包数据分发。 I include the following in distutils.setup(...) :我在distutils.setup(...)包含以下内容:

[...]
package_data={'mypkg': ['.hg/*']},
[...]

However this syntax does not work: when I run python setup.py install , the directory .hg is not included in the package.但是这种语法不起作用:当我运行python setup.py install ,目录.hg不包含在包中。 I believe the problem is in the directory name .hg , because if I replace .hg with hg , then the following will work as expected.我相信问题出在目录名.hg ,因为如果我用hg替换.hg ,那么以下内容将按预期工作。

[...]
package_data={'mypkg': ['hg/*']},
[...]

Unfortunately the directory name has to be .hg for Mercurial to work.不幸的是,目录名称必须是.hg才能让 Mercurial 工作。 Is there a workaround to this issue?这个问题有解决方法吗?

Seems to work with setuptools (instead of distutils ):似乎适用于setuptools (而不是distutils ):

package_data={'mypkg': ['../.git/*']}

includes .git/* (non-recursive) in sdist , bdist_egg and bdist_wheel .sdistbdist_eggbdist_wheel包含.git/* (非递归)。

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

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