This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Unsupported provider

classification
Title: error: can't copy '': doesn't exist or not a regular file
Type: Stage:
Components: Distutils Versions: Python 3.3, Python 3.4, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: eric.araujo Nosy List: eric.araujo, jaraco, python-dev, tarek
Priority: normal Keywords:

Created on 2013-10-18 19:11 by jaraco, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
example.zip jaraco, 2013-10-18 19:16
Messages (4)
msg200298 - (view) Author: Jason R. Coombs (jaraco) * (Python committer) Date: 2013-10-18 19:10
On Python 2.7 and 3.3, if the package_data glob happens to match a directory, it will trigger this error during build:

error: can't copy '<package>/<dirname>': doesn't exist or not a regular file

It seems that package_data is not very smart about filtering out directories, and assumes every name matched in the glob is a file. This is particularly inconvenient when one has a directory structure of package data. Consider:

	package_data={
		'bug_pkg': (
			[
				'html/*.*',
				'html/something-1.0/*.*',
			]
		),
	},

with a directory structure of:

.
│   setup.py
│
└───bug_pkg
    │   __init__.py
    │
    └───html
        │   index.html
        │
        └───something-1.0
                index.dat

Since 'html/*.*' matches 'something-1.0', distutils assumes something-1.0 is a file and tries to copy it and fails with:

error: can't copy 'bug_pkg/html/something-1.0': doesn't exist or not a regular file

I believe distutils should be filtering out folders from package_data. In the past, users (including myself) have worked around the issue by using '*.*' to match only files, but that's a poor heuristic is the above example demonstrates.

This issue was encountered when using sphinx-bootstrap-theme, which adds directories to sphinx HTML docs with directories like 'bootstrap-3.0.0', which are difficult to not match in a glob.

Is there any reason why globs specified in package_data should not exclude all directories?
msg200300 - (view) Author: Jason R. Coombs (jaraco) * (Python committer) Date: 2013-10-18 19:16
The attached example minimally replicates the issue.
msg201978 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-11-02 15:58
New changeset 22bac968e226 by Jason R. Coombs in branch '2.7':
Issue #19286: Adding test demonstrating the failure when a directory is found in the package_data globs.
http://hg.python.org/cpython/rev/22bac968e226

New changeset 0a1cf947eff6 by Jason R. Coombs in branch '2.7':
Issue #19286: [distutils] Only match files in build_py.find_data_files.
http://hg.python.org/cpython/rev/0a1cf947eff6
msg201981 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-11-02 17:05
New changeset d80207d15294 by Jason R. Coombs in branch '3.2':
Issue #19286: Adding test demonstrating the failure when a directory is found in the package_data globs.
http://hg.python.org/cpython/rev/d80207d15294

New changeset 265d369ad3b9 by Jason R. Coombs in branch '3.2':
Issue #19286: [distutils] Only match files in build_py.find_data_files.
http://hg.python.org/cpython/rev/265d369ad3b9

New changeset 69f8288056eb by Jason R. Coombs in branch '3.3':
Merge with 3.2 for Issue #19286.
http://hg.python.org/cpython/rev/69f8288056eb

New changeset 9eafe31251b4 by Jason R. Coombs in branch 'default':
Merge with 3.3 for Issue #19286.
http://hg.python.org/cpython/rev/9eafe31251b4
History
Date User Action Args
2022-04-11 14:57:52adminsetgithub: 63485
2013-11-02 17:06:33jaracosetstatus: open -> closed
resolution: fixed
2013-11-02 17:05:31python-devsetmessages: + msg201981
2013-11-02 15:58:39python-devsetnosy: + python-dev
messages: + msg201978
2013-10-18 19:16:08jaracosetfiles: + example.zip

messages: + msg200300
2013-10-18 19:11:00jaracocreate