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
20f38687
Commit
20f38687
authored
Jan 17, 2019
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update docs to match implementation that resource names are rooted at the package. Ref #1635.
parent
bfe286c3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
9 deletions
+6
-9
changelog.d/1635.change.rst
changelog.d/1635.change.rst
+1
-0
docs/pkg_resources.txt
docs/pkg_resources.txt
+2
-2
pkg_resources/__init__.py
pkg_resources/__init__.py
+3
-7
No files found.
changelog.d/1635.change.rst
0 → 100644
View file @
20f38687
Resource paths are passed to ``pkg_resources.resource_string`` and similar no longer accept paths that traverse parents. Violations of this expectation raise DeprecationWarnings and will become errors.
docs/pkg_resources.txt
View file @
20f38687
...
...
@@ -1132,8 +1132,8 @@ relative to the root of the identified distribution; i.e. its first path
segment will be treated as a peer of the top-level modules or packages in the
distribution.
Note that resource names must be ``/``-separated paths
and cannot be absolut
e
(i.e. no leading ``/``) or
contain relative names like ``".."``. Do *not* use
Note that resource names must be ``/``-separated paths
rooted at the packag
e
and cannot
contain relative names like ``".."``. Do *not* use
``os.path`` routines to manipulate resource paths, as they are *not* filesystem
paths.
...
...
pkg_resources/__init__.py
View file @
20f38687
...
...
@@ -1489,8 +1489,7 @@ class NullProvider:
>>> warned.clear()
>>> vrp('
/
foo
/
bar
.
txt
')
>>> bool(warned)
True
>>> warned.clear()
False
>>> vrp('
foo
/
..
/
..
/
bar
.
txt
')
>>> bool(warned)
True
...
...
@@ -1499,14 +1498,11 @@ class NullProvider:
>>> bool(warned)
False
"""
invalid = (
path.startswith('
/
') or
re.search(r'
\
B
\
.
\
.
\
B', path)
)
invalid = '
..
' in path.split('
/
')
if not invalid:
return
msg = "Use of ..
or leading /
in a resource path is not allowed."
msg = "Use of .. in a resource path is not allowed."
# for compatibility, warn; in future
# raise ValueError(msg)
warnings.warn(
...
...
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