Issue 19286: error: can't copy '': doesn't exist or not a regular file (original) (raw)
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 '/': 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?