[New-bugs-announce] [issue19286] error: can't copy '<dirname>': doesn't exist or not a regular file

Jason R. Coombs report at bugs.python.org
Fri Oct 18 21:11:00 CEST 2013


New submission from Jason R. Coombs:

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?

----------
assignee: eric.araujo
components: Distutils
messages: 200298
nosy: eric.araujo, jason.coombs, tarek
priority: normal
severity: normal
status: open
title: error: can't copy '<dirname>': doesn't exist or not a regular file
versions: Python 2.7, Python 3.3, Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19286>
_______________________________________


More information about the New-bugs-announce mailing list