Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
35c0e9c2
Commit
35c0e9c2
authored
Nov 30, 2017
by
Benoit Pierre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix `data_files` handling when installing from wheel
parent
b729553a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
4 deletions
+59
-4
setuptools/tests/test_wheel.py
setuptools/tests/test_wheel.py
+36
-0
setuptools/wheel.py
setuptools/wheel.py
+23
-4
No files found.
setuptools/tests/test_wheel.py
View file @
35c0e9c2
...
...
@@ -444,6 +444,42 @@ WHEEL_INSTALL_TESTS = (
'''
),
),
dict
(
id
=
'data_in_package'
,
file_defs
=
{
'foo'
:
{
'__init__.py'
:
''
,
'data_dir'
:
{
'data.txt'
:
DALS
(
'''
Some data...
'''
),
}
}
},
setup_kwargs
=
dict
(
packages
=
[
'foo'
],
data_files
=
[(
'foo/data_dir'
,
[
'foo/data_dir/data.txt'
])],
),
install_tree
=
DALS
(
'''
foo-1.0-py{py_version}.egg/
|-- EGG-INFO/
| |-- DESCRIPTION.rst
| |-- PKG-INFO
| |-- RECORD
| |-- WHEEL
| |-- metadata.json
| |-- top_level.txt
|-- foo/
| |-- __init__.py
| |-- data_dir/
| | |-- data.txt
'''
),
),
)
@
pytest
.
mark
.
parametrize
(
...
...
setuptools/wheel.py
View file @
35c0e9c2
...
...
@@ -28,6 +28,28 @@ except ImportError:
'''
def unpack(src_dir, dst_dir):
'''Move everything under `src_dir` to `dst_dir`, and delete the former.'''
for dirpath, dirnames, filenames in os.walk(src_dir):
subdir = os.path.relpath(dirpath, src_dir)
for f in filenames:
src = os.path.join(dirpath, f)
dst = os.path.join(dst_dir, subdir, f)
os.renames(src, dst)
for n, d in reversed(list(enumerate(dirnames))):
src = os.path.join(dirpath, d)
dst = os.path.join(dst_dir, subdir, d)
if not os.path.exists(dst):
# Directory does not exist in destination,
# rename it and prune it from os.walk list.
os.renames(src, dst)
del dirnames[n]
# Cleanup.
for dirpath, dirnames, filenames in os.walk(src_dir, topdown=True):
assert not filenames
os.rmdir(dirpath)
class Wheel(object):
def __init__(self, filename):
...
...
@@ -125,10 +147,7 @@ class Wheel(object):
os.path.join(dist_data, d)
for d in ('data', 'headers', 'purelib', 'platlib')
)):
for entry in os.listdir(subdir):
os.rename(os.path.join(subdir, entry),
os.path.join(destination_eggdir, entry))
os.rmdir(subdir)
unpack(subdir, destination_eggdir)
if os.path.exists(dist_data):
os.rmdir(dist_data)
# Fix namespace packages.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment