简体   繁体   中英

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() . This works fine, except that it includes unversioned .py files that are stored in the package folders. I would like it to include only the .py files that I have checked into my Subversion repository. 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.

1 Find a list of files not version controlled using

svn status | grep ^?

Refer to How do I get a list of all unversioned files from SVN?

You will have to shell out using something like 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. You will have to send the filenames from setp 1 as exclude= . Refer: http://pythonhosted.org/setuptools/setuptools.html#using-find-packages

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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