简体   繁体   English

在使用setuptools的setup.py中,如何仅选择Subversion中的.py文件?

[英]In setup.py that uses setuptools, how can I select only .py files that are in Subversion?

In my setup.py file which uses setuptools, I use packages = find_packages() . 在使用setuptools的setup.py文件中,我使用packages = find_packages() This works fine, except that it includes unversioned .py files that are stored in the package folders. 除包含未版本化的.py文件(存储在软件包文件夹中)外,此方法工作正常。 I would like it to include only the .py files that I have checked into my Subversion repository. 我希望它仅包含已检查到Subversion存储库中的.py文件。 Is that possible and, if so, how? 那有可能吗?

In essence, I would like the inclusion of .py files in the packages to work more like the inclusion of data files enabled with include_package_data = True , where only data files that are also checked into Subversion get included. 本质上,我希望软件包中包含.py文件的工作方式类似于包含include_package_data = True启用的数据文件的工作,其中仅包含也已签入Subversion的数据文件。

1 Find a list of files not version controlled using 1查找不受版本控制的文件列表

svn status | grep ^?

Refer to How do I get a list of all unversioned files from SVN? 请参阅如何从SVN获取所有未版本控制的文件的列表?

You will have to shell out using something like subprocess.check_output . 您将必须使用诸如subprocess.check_output东西进行外壳处理。

2 setuptools.find_packages() takes an exclude= parameter to specify a list of patterns and it will ignore all packages that match these patterns. 2 setuptools.find_packages()使用exclude=参数指定模式列表,它将忽略与这些模式匹配的所有软件包。 You will have to send the filenames from setp 1 as exclude= . 您必须将setp 1中的文件名发送为exclude= Refer: http://pythonhosted.org/setuptools/setuptools.html#using-find-packages 请参阅: http : //pythonhosted.org/setuptools/setuptools.html#using-find-packages

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

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