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
1ad2c11c
Commit
1ad2c11c
authored
Dec 24, 2017
by
Jason R. Coombs
Committed by
GitHub
Dec 24, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1232 from duggelz/dgreiman/issue1188
Fix trailing slash handling in pkg_resources.ZipProvider
parents
e001996a
0d0baed8
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
2 deletions
+45
-2
CHANGES.rst
CHANGES.rst
+5
-0
pkg_resources/__init__.py
pkg_resources/__init__.py
+3
-0
pkg_resources/tests/test_pkg_resources.py
pkg_resources/tests/test_pkg_resources.py
+35
-0
setup.cfg
setup.cfg
+1
-1
setup.py
setup.py
+1
-1
No files found.
CHANGES.rst
View file @
1ad2c11c
v38
.2.5
-------
*
#
1232
:
Fix
trailing
slash
handling
in
``
pkg_resources
.
ZipProvider
``.
v38
.2.4
-------
...
...
pkg_resources/__init__.py
View file @
1ad2c11c
...
...
@@ -1693,6 +1693,9 @@ class ZipProvider(EggProvider):
def _zipinfo_name(self, fspath):
# Convert a virtual filename (full path to file) into a zipfile subpath
# usable with the zipimport directory cache for our target archive
fspath = fspath.rstrip(os.sep)
if fspath == self.loader.archive:
return ''
if fspath.startswith(self.zip_pre):
return fspath[len(self.zip_pre):]
raise AssertionError(
...
...
pkg_resources/tests/test_pkg_resources.py
View file @
1ad2c11c
...
...
@@ -62,10 +62,21 @@ class TestZipProvider(object):
zip_info
.
filename
=
'data.dat'
zip_info
.
date_time
=
cls
.
ref_time
.
timetuple
()
zip_egg
.
writestr
(
zip_info
,
'hello, world!'
)
zip_info
=
zipfile
.
ZipInfo
()
zip_info
.
filename
=
'subdir/mod2.py'
zip_info
.
date_time
=
cls
.
ref_time
.
timetuple
()
zip_egg
.
writestr
(
zip_info
,
'x = 6
\
n
'
)
zip_info
=
zipfile
.
ZipInfo
()
zip_info
.
filename
=
'subdir/data2.dat'
zip_info
.
date_time
=
cls
.
ref_time
.
timetuple
()
zip_egg
.
writestr
(
zip_info
,
'goodbye, world!'
)
zip_egg
.
close
()
egg
.
close
()
sys
.
path
.
append
(
egg
.
name
)
subdir
=
os
.
path
.
join
(
egg
.
name
,
'subdir'
)
sys
.
path
.
append
(
subdir
)
cls
.
finalizers
.
append
(
EggRemover
(
subdir
))
cls
.
finalizers
.
append
(
EggRemover
(
egg
.
name
))
@
classmethod
...
...
@@ -73,6 +84,30 @@ class TestZipProvider(object):
for
finalizer
in
cls
.
finalizers
:
finalizer
()
def
test_resource_listdir
(
self
):
import
mod
zp
=
pkg_resources
.
ZipProvider
(
mod
)
expected_root
=
[
'data.dat'
,
'mod.py'
,
'subdir'
]
assert
sorted
(
zp
.
resource_listdir
(
''
))
==
expected_root
assert
sorted
(
zp
.
resource_listdir
(
'/'
))
==
expected_root
expected_subdir
=
[
'data2.dat'
,
'mod2.py'
]
assert
sorted
(
zp
.
resource_listdir
(
'subdir'
))
==
expected_subdir
assert
sorted
(
zp
.
resource_listdir
(
'subdir/'
))
==
expected_subdir
assert
zp
.
resource_listdir
(
'nonexistent'
)
==
[]
assert
zp
.
resource_listdir
(
'nonexistent/'
)
==
[]
import
mod2
zp2
=
pkg_resources
.
ZipProvider
(
mod2
)
assert
sorted
(
zp2
.
resource_listdir
(
''
))
==
expected_subdir
assert
sorted
(
zp2
.
resource_listdir
(
'/'
))
==
expected_subdir
assert
zp2
.
resource_listdir
(
'subdir'
)
==
[]
assert
zp2
.
resource_listdir
(
'subdir/'
)
==
[]
def
test_resource_filename_rewrites_on_change
(
self
):
"""
If a previous call to get_resource_filename has saved the file, but
...
...
setup.cfg
View file @
1ad2c11c
[bumpversion]
current_version = 38.2.
4
current_version = 38.2.
5
commit = True
tag = True
...
...
setup.py
View file @
1ad2c11c
...
...
@@ -89,7 +89,7 @@ def pypi_link(pkg_filename):
setup_params
=
dict
(
name
=
"setuptools"
,
version
=
"38.2.
4
"
,
version
=
"38.2.
5
"
,
description
=
"Easily download, build, install, upgrade, and uninstall "
"Python packages"
,
author
=
"Python Packaging Authority"
,
...
...
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