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
d54b82ff
Commit
d54b82ff
authored
Mar 19, 2013
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Plain Diff
Merge pkg_resources
--HG-- branch : Setuptools-Distribute merge
parents
59cf0135
5b2e22a7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
17 deletions
+20
-17
pkg_resources.py
pkg_resources.py
+20
-17
No files found.
pkg_resources.py
View file @
d54b82ff
...
...
@@ -13,7 +13,7 @@ The package resource API is designed to work with normal filesystem packages,
method.
"""
import
sys
,
os
,
zipimport
,
time
,
re
,
imp
,
types
import
sys
,
os
,
zipimport
,
time
,
re
,
imp
from
urlparse
import
urlparse
,
urlunparse
try
:
...
...
@@ -87,6 +87,7 @@ _sget_none = _sset_none = lambda *args: None
def
get_supported_platform
():
"""Return this platform's maximum compatible version.
...
...
@@ -260,6 +261,12 @@ macosVersionString = re.compile(r"macosx-(\d+)\.(\d+)-(.*)")
darwinVersionString = re.compile(r"
darwin
-
(
\
d
+
)
\
.(
\
d
+
)
\
.(
\
d
+
)
-
(.
*
)
")
get_platform = get_build_platform # XXX backward compat
def compatible_platforms(provided,required):
"""Can code for the `provided` platform run on the `required` platform?
...
...
@@ -435,7 +442,7 @@ class WorkingSet(object):
def add_entry(self, entry):
"""Add a path item to ``.entries``, finding any distributions on it
``find_distributions(entry,True)`` is used to find distributions
``find_distributions(entry,
True)`` is used to find distributions
corresponding to the path entry, and they are added. `entry` is
always appended to ``.entries``, even if it is already present.
(This is because ``sys.path`` can contain the same value more than
...
...
@@ -680,7 +687,6 @@ class WorkingSet(object):
activated to fulfill the requirements; all relevant distributions are
included, even if they were already activated in this working set.
"""
needed = self.resolve(parse_requirements(requirements))
for dist in needed:
...
...
@@ -688,7 +694,6 @@ class WorkingSet(object):
return needed
def subscribe(self, callback):
"""Invoke `callback` for all distributions (including existing ones)"""
if callback in self.callbacks:
...
...
@@ -697,14 +702,15 @@ class WorkingSet(object):
for dist in self:
callback(dist)
def _added_new(self, dist):
for callback in self.callbacks:
callback(dist)
def __getstate__(self):
return (self.entries[:], self.entry_keys.copy(), self.by_key.copy(),
self.callbacks[:])
return (
self.entries[:], self.entry_keys.copy(), self.by_key.copy(),
self.callbacks[:]
)
def __setstate__(self, (entries, keys, by_key, callbacks)):
self.entries = entries[:]
...
...
@@ -713,8 +719,6 @@ class WorkingSet(object):
self.callbacks = callbacks[:]
class Environment(object):
"""Searchable snapshot of distributions on a search path"""
...
...
@@ -1795,7 +1799,7 @@ def _handle_ns(packageName, path_item):
return None
module = sys.modules.get(packageName)
if module is None:
module = sys.modules[packageName] =
types.ModuleTyp
e(packageName)
module = sys.modules[packageName] =
imp.new_modul
e(packageName)
module.__path__ = []; _set_parent_ns(packageName)
elif not hasattr(module,'__path__'):
raise TypeError("
Not
a
package
:
", packageName)
...
...
@@ -2337,12 +2341,9 @@ class Distribution(object):
if
not
loc
:
return
if
path
is
sys
.
path
:
self
.
check_version_conflict
()
nloc
=
_normalize_cached
(
loc
)
bdir
=
os
.
path
.
dirname
(
nloc
)
npath
=
map
(
_normalize_cached
,
path
)
npath
=
[(
p
and
_normalize_cached
(
p
)
or
p
)
for
p
in
path
]
bp
=
None
for
p
,
item
in
enumerate
(
npath
):
...
...
@@ -2350,10 +2351,14 @@ class Distribution(object):
break
elif
item
==
bdir
and
self
.
precedence
==
EGG_DIST
:
# if it's an .egg, give it precedence over its directory
if
path
is
sys
.
path
:
self
.
check_version_conflict
()
path
.
insert
(
p
,
loc
)
npath
.
insert
(
p
,
nloc
)
break
else
:
if
path
is
sys
.
path
:
self
.
check_version_conflict
()
path
.
append
(
loc
)
return
...
...
@@ -2370,7 +2375,6 @@ class Distribution(object):
return
def
check_version_conflict
(
self
):
if
self
.
key
==
'setuptools'
:
return
# ignore the inevitable setuptools self-conflicts :(
...
...
@@ -2631,7 +2635,7 @@ class Requirement:
def __contains__(self,item):
if isinstance(item,Distribution):
if item.key
<>
self.key: return False
if item.key
!=
self.key: return False
if self.index: item = item.parsed_version # only get if we need it
elif isinstance(item,basestring):
item = parse_version(item)
...
...
@@ -2739,7 +2743,6 @@ _initialize(globals())
# Prepare the master working set and make the ``require()`` API available
_declare_state('object', working_set = WorkingSet())
try:
# Does the main program list any requirements?
from __main__ import __requires__
...
...
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