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
718c66c4
Commit
718c66c4
authored
Dec 01, 2015
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Re-use metadata loading functionality from Provider. Fixes #469.
parent
e36ec568
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
16 deletions
+14
-16
CHANGES.txt
CHANGES.txt
+7
-0
pkg_resources/__init__.py
pkg_resources/__init__.py
+7
-16
No files found.
CHANGES.txt
View file @
718c66c4
...
...
@@ -3,6 +3,13 @@ CHANGES
=======
------
18.7.1
------
* Issue #469: Refactored logic for Issue #419 fix to re-use metadata
loading from Provider.
----
18.7
----
...
...
pkg_resources/__init__.py
View file @
718c66c4
...
...
@@ -2507,7 +2507,6 @@ class Distribution(object):
@classmethod
def from_location(cls, location, basename, metadata=None, **kw):
project_name, version, py_version, platform = [None]*4
dist_path = os.path.join(location, basename)
basename, ext = os.path.splitext(basename)
if ext.lower() in _distributionImpl:
cls = _distributionImpl[ext.lower()]
...
...
@@ -2517,16 +2516,13 @@ class Distribution(object):
project_name, version, py_version, platform = match.group(
'
name
', '
ver
', '
pyver
', '
plat
'
)
version = cls._version_from_metadata(dist_path) or version
return cls(
location, metadata, project_name=project_name, version=version,
py_version=py_version, platform=platform, **kw
)
)
._reload_version()
@staticmethod
def _version_from_metadata(dist_path):
pass
def _reload_version(self):
return self
@property
def hashcmp(self):
...
...
@@ -2824,8 +2820,7 @@ class Distribution(object):
class
EggInfoDistribution
(
Distribution
):
@
staticmethod
def
_version_from_metadata
(
dist_path
):
def
_reload_version
(
self
):
"""
Packages installed by distutils (e.g. numpy or scipy),
which uses an old safe_version, and so
...
...
@@ -2837,13 +2832,9 @@ class EggInfoDistribution(Distribution):
take an extra step and try to get the version number from
the metadata file itself instead of the filename.
"""
if
not
os
.
path
.
isfile
(
dist_path
):
return
try
:
with
open
(
dist_path
)
as
strm
:
return
_version_from_file
(
strm
)
except
IOError
:
pass
md_version
=
_version_from_file
(
self
.
_get_metadata
(
self
.
PKG_INFO
))
self
.
_version
=
md_version
or
self
.
_version
return
self
class
DistInfoDistribution
(
Distribution
):
...
...
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