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
ca89b069
Commit
ca89b069
authored
Nov 28, 2015
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Encapsulate egg-info special behavior in EggInfoDistribution class.
parent
78b89bdb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
20 deletions
+26
-20
pkg_resources/__init__.py
pkg_resources/__init__.py
+26
-20
No files found.
pkg_resources/__init__.py
View file @
ca89b069
...
...
@@ -2516,25 +2516,7 @@ class Distribution(object):
@staticmethod
def _version_from_egg_info(dist_path):
"""
Packages installed by distutils (e.g. numpy or scipy),
which uses an old safe_version, and so
their version numbers can get mangled when
converted to filenames (e.g., 1.11.0.dev0+2329eae to
1.11.0.dev0_2329eae). These distributions will not be
parsed properly
downstream by Distribution and safe_version, so
take an extra step and try to get the version number from
the metadata file itself instead of the filename.
"""
_, ext = os.path.splitext(dist_path)
if ext != '
.
egg
-
info
' or not os.path.isfile(dist_path):
return
try:
with open(dist_path) as strm:
return _version_from_file(strm)
except IOError:
pass
pass
@property
def hashcmp(self):
...
...
@@ -2830,6 +2812,30 @@ class Distribution(object):
return
[
dep
for
dep
in
self
.
_dep_map
if
dep
]
class
EggInfoDistribution
(
Distribution
):
@
staticmethod
def
_version_from_egg_info
(
dist_path
):
"""
Packages installed by distutils (e.g. numpy or scipy),
which uses an old safe_version, and so
their version numbers can get mangled when
converted to filenames (e.g., 1.11.0.dev0+2329eae to
1.11.0.dev0_2329eae). These distributions will not be
parsed properly
downstream by Distribution and safe_version, so
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
class
DistInfoDistribution
(
Distribution
):
"""Wrap an actual or potential sys.path entry w/metadata, .dist-info style"""
PKG_INFO
=
'METADATA'
...
...
@@ -2895,7 +2901,7 @@ class DistInfoDistribution(Distribution):
_distributionImpl = {
'.egg': Distribution,
'.egg-info': Distribution,
'.egg-info':
EggInfo
Distribution,
'.dist-info': DistInfoDistribution,
}
...
...
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