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
cadf172f
Commit
cadf172f
authored
Jul 20, 2016
by
Jason R. Coombs
Committed by
GitHub
Jul 20, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #641 from stepshal/colon
Put colon-separated compound statement on separate lines.
parents
e6168c60
64335b63
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
34 additions
and
17 deletions
+34
-17
pkg_resources/__init__.py
pkg_resources/__init__.py
+2
-1
setuptools/depends.py
setuptools/depends.py
+2
-1
setuptools/dist.py
setuptools/dist.py
+6
-3
setuptools/lib2to3_ex.py
setuptools/lib2to3_ex.py
+2
-1
setuptools/package_index.py
setuptools/package_index.py
+14
-7
setuptools/sandbox.py
setuptools/sandbox.py
+8
-4
No files found.
pkg_resources/__init__.py
View file @
cadf172f
...
@@ -2837,7 +2837,8 @@ class Requirement(packaging.requirements.Requirement):
...
@@ -2837,7 +2837,8 @@ class Requirement(packaging.requirements.Requirement):
def _get_mro(cls):
def _get_mro(cls):
"""Get an mro for a type or classic class"""
"""Get an mro for a type or classic class"""
if not isinstance(cls, type):
if not isinstance(cls, type):
class cls(cls, object): pass
class cls(cls, object):
pass
return cls.__mro__[1:]
return cls.__mro__[1:]
return cls.__mro__
return cls.__mro__
...
...
setuptools/depends.py
View file @
cadf172f
...
@@ -53,7 +53,8 @@ class Require:
...
@@ -53,7 +53,8 @@ class Require:
if
self
.
attribute
is
None
:
if
self
.
attribute
is
None
:
try
:
try
:
f
,
p
,
i
=
find_module
(
self
.
module
,
paths
)
f
,
p
,
i
=
find_module
(
self
.
module
,
paths
)
if
f
:
f
.
close
()
if
f
:
f
.
close
()
return
default
return
default
except
ImportError
:
except
ImportError
:
return
None
return
None
...
...
setuptools/dist.py
View file @
cadf172f
...
@@ -155,8 +155,10 @@ def check_package_data(dist, attr, value):
...
@@ -155,8 +155,10 @@ def check_package_data(dist, attr, value):
"""Verify that value is a dictionary of package names to glob lists"""
"""Verify that value is a dictionary of package names to glob lists"""
if
isinstance
(
value
,
dict
):
if
isinstance
(
value
,
dict
):
for
k
,
v
in
value
.
items
():
for
k
,
v
in
value
.
items
():
if
not
isinstance
(
k
,
str
):
break
if
not
isinstance
(
k
,
str
):
try
:
iter
(
v
)
break
try
:
iter
(
v
)
except
TypeError
:
except
TypeError
:
break
break
else
:
else
:
...
@@ -807,7 +809,8 @@ class Feature:
...
@@ -807,7 +809,8 @@ class Feature:
r
for
r
in
require_features
if
isinstance
(
r
,
str
)
r
for
r
in
require_features
if
isinstance
(
r
,
str
)
]
]
er
=
[
r
for
r
in
require_features
if
not
isinstance
(
r
,
str
)]
er
=
[
r
for
r
in
require_features
if
not
isinstance
(
r
,
str
)]
if
er
:
extras
[
'require_features'
]
=
er
if
er
:
extras
[
'require_features'
]
=
er
if
isinstance
(
remove
,
str
):
if
isinstance
(
remove
,
str
):
remove
=
remove
,
remove
=
remove
,
...
...
setuptools/lib2to3_ex.py
View file @
cadf172f
...
@@ -45,7 +45,8 @@ class Mixin2to3(_Mixin2to3):
...
@@ -45,7 +45,8 @@ class Mixin2to3(_Mixin2to3):
_Mixin2to3
.
run_2to3
(
self
,
files
)
_Mixin2to3
.
run_2to3
(
self
,
files
)
def
__build_fixer_names
(
self
):
def
__build_fixer_names
(
self
):
if
self
.
fixer_names
:
return
if
self
.
fixer_names
:
return
self
.
fixer_names
=
[]
self
.
fixer_names
=
[]
for
p
in
setuptools
.
lib2to3_fixer_packages
:
for
p
in
setuptools
.
lib2to3_fixer_packages
:
self
.
fixer_names
.
extend
(
get_fixers_from_package
(
p
))
self
.
fixer_names
.
extend
(
get_fixers_from_package
(
p
))
...
...
setuptools/package_index.py
View file @
cadf172f
...
@@ -82,14 +82,16 @@ def egg_info_for_url(url):
...
@@ -82,14 +82,16 @@ def egg_info_for_url(url):
base = urllib.parse.unquote(path.split('
/
')[-1])
base = urllib.parse.unquote(path.split('
/
')[-1])
if server == '
sourceforge
.
net
' and base == '
download
': # XXX Yuck
if server == '
sourceforge
.
net
' and base == '
download
': # XXX Yuck
base = urllib.parse.unquote(path.split('
/
')[-2])
base = urllib.parse.unquote(path.split('
/
')[-2])
if '
#' in base: base, fragment = base.split('#', 1)
if '
#' in base:
base
,
fragment
=
base
.
split
(
'#'
,
1
)
return
base
,
fragment
return
base
,
fragment
def
distros_for_url
(
url
,
metadata
=
None
):
def
distros_for_url
(
url
,
metadata
=
None
):
"""Yield egg or source distribution objects that might be found at a URL"""
"""Yield egg or source distribution objects that might be found at a URL"""
base
,
fragment
=
egg_info_for_url
(
url
)
base
,
fragment
=
egg_info_for_url
(
url
)
for
dist
in
distros_for_location
(
url
,
base
,
metadata
):
yield
dist
for
dist
in
distros_for_location
(
url
,
base
,
metadata
):
yield
dist
if
fragment
:
if
fragment
:
match
=
EGG_FRAGMENT
.
match
(
fragment
)
match
=
EGG_FRAGMENT
.
match
(
fragment
)
if
match
:
if
match
:
...
@@ -289,7 +291,8 @@ class PackageIndex(Environment):
...
@@ -289,7 +291,8 @@ class PackageIndex(Environment):
self.to_scan = []
self.to_scan = []
if verify_ssl and ssl_support.is_available and (ca_bundle or ssl_support.find_ca_bundle()):
if verify_ssl and ssl_support.is_available and (ca_bundle or ssl_support.find_ca_bundle()):
self.opener = ssl_support.opener_for(ca_bundle)
self.opener = ssl_support.opener_for(ca_bundle)
else: self.opener = urllib.request.urlopen
else:
self.opener = urllib.request.urlopen
def process_url(self, url, retrieve=False):
def process_url(self, url, retrieve=False):
"""
Evaluate
a
URL
as
a
possible
download
,
and
maybe
retrieve
it
"""
"""
Evaluate
a
URL
as
a
possible
download
,
and
maybe
retrieve
it
"""
...
@@ -317,7 +320,8 @@ class PackageIndex(Environment):
...
@@ -317,7 +320,8 @@ class PackageIndex(Environment):
self.info("Reading %s", url)
self.info("Reading %s", url)
self.fetched_urls[url] = True # prevent multiple fetch attempts
self.fetched_urls[url] = True # prevent multiple fetch attempts
f = self.open_url(url, "Download error on %s: %%s -- Some packages may not be found!" % url)
f = self.open_url(url, "Download error on %s: %%s -- Some packages may not be found!" % url)
if f is None: return
if f is None:
return
self.fetched_urls[f.url] = True
self.fetched_urls[f.url] = True
if 'html' not in f.headers.get('content-type', '').lower():
if 'html' not in f.headers.get('content-type', '').lower():
f.close() # not html, we can't process it
f.close() # not html, we can't process it
...
@@ -442,7 +446,8 @@ class PackageIndex(Environment):
...
@@ -442,7 +446,8 @@ class PackageIndex(Environment):
def scan_all(self, msg=None, *args):
def scan_all(self, msg=None, *args):
if self.index_url not in self.fetched_urls:
if self.index_url not in self.fetched_urls:
if msg: self.warn(msg, *args)
if msg:
self.warn(msg, *args)
self.info(
self.info(
"Scanning index of all packages (this may take a while)"
"Scanning index of all packages (this may take a while)"
)
)
...
@@ -714,7 +719,8 @@ class PackageIndex(Environment):
...
@@ -714,7 +719,8 @@ class PackageIndex(Environment):
self.check_hash(checker, filename, tfp)
self.check_hash(checker, filename, tfp)
return headers
return headers
finally:
finally:
if fp: fp.close()
if fp:
fp.close()
def reporthook(self, url, filename, blocknum, blksize, size):
def reporthook(self, url, filename, blocknum, blksize, size):
pass # no-op
pass # no-op
...
@@ -896,7 +902,8 @@ entity_sub = re.compile(r'&(#(\d+|x[\da-fA-F]+)|[\w.:-]+);?').sub
...
@@ -896,7 +902,8 @@ entity_sub = re.compile(r'&(#(\d+|x[\da-fA-F]+)|[\w.:-]+);?').sub
def uchr(c):
def uchr(c):
if not isinstance(c, int):
if not isinstance(c, int):
return c
return c
if c > 255: return six.unichr(c)
if c > 255:
return six.unichr(c)
return chr(c)
return chr(c)
...
...
setuptools/sandbox.py
View file @
cadf172f
...
@@ -291,7 +291,8 @@ class AbstractSandbox:
...
@@ -291,7 +291,8 @@ class AbstractSandbox:
return wrap
return wrap
for name in ["rename", "link", "symlink"]:
for name in ["rename", "link", "symlink"]:
if hasattr(_os, name): locals()[name] = _mk_dual_path_wrapper(name)
if hasattr(_os, name):
locals()[name] = _mk_dual_path_wrapper(name)
def _mk_single_path_wrapper(name, original=None):
def _mk_single_path_wrapper(name, original=None):
original = original or getattr(_os, name)
original = original or getattr(_os, name)
...
@@ -310,7 +311,8 @@ class AbstractSandbox:
...
@@ -310,7 +311,8 @@ class AbstractSandbox:
"remove", "unlink", "rmdir", "utime", "lchown", "chroot", "lstat",
"remove", "unlink", "rmdir", "utime", "lchown", "chroot", "lstat",
"startfile", "mkfifo", "mknod", "pathconf", "access"
"startfile", "mkfifo", "mknod", "pathconf", "access"
]:
]:
if hasattr(_os, name): locals()[name] = _mk_single_path_wrapper(name)
if hasattr(_os, name):
locals()[name] = _mk_single_path_wrapper(name)
def _mk_single_with_return(name):
def _mk_single_with_return(name):
original = getattr(_os, name)
original = getattr(_os, name)
...
@@ -323,7 +325,8 @@ class AbstractSandbox:
...
@@ -323,7 +325,8 @@ class AbstractSandbox:
return wrap
return wrap
for name in ['readlink', 'tempnam']:
for name in ['readlink', 'tempnam']:
if hasattr(_os, name): locals()[name] = _mk_single_with_return(name)
if hasattr(_os, name):
locals()[name] = _mk_single_with_return(name)
def _mk_query(name):
def _mk_query(name):
original = getattr(_os, name)
original = getattr(_os, name)
...
@@ -336,7 +339,8 @@ class AbstractSandbox:
...
@@ -336,7 +339,8 @@ class AbstractSandbox:
return wrap
return wrap
for name in ['getcwd', 'tmpnam']:
for name in ['getcwd', 'tmpnam']:
if hasattr(_os, name): locals()[name] = _mk_query(name)
if hasattr(_os, name):
locals()[name] = _mk_query(name)
def _validate_path(self, path):
def _validate_path(self, path):
"""
Called
to
remap
or
validate
any
path
,
whether
input
or
output
"""
"""
Called
to
remap
or
validate
any
path
,
whether
input
or
output
"""
...
...
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