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
dc2d1dc2
Commit
dc2d1dc2
authored
Jul 14, 2016
by
stepshal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix missing whitespace around operator.
parent
10866a52
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
70 additions
and
70 deletions
+70
-70
pavement.py
pavement.py
+1
-1
setuptools/depends.py
setuptools/depends.py
+10
-10
setuptools/dist.py
setuptools/dist.py
+24
-24
setuptools/lib2to3_ex.py
setuptools/lib2to3_ex.py
+1
-1
setuptools/package_index.py
setuptools/package_index.py
+20
-20
setuptools/py31compat.py
setuptools/py31compat.py
+1
-1
setuptools/sandbox.py
setuptools/sandbox.py
+3
-3
setuptools/site-patch.py
setuptools/site-patch.py
+4
-4
setuptools/ssl_support.py
setuptools/ssl_support.py
+1
-1
setuptools/tests/test_bdist_egg.py
setuptools/tests/test_bdist_egg.py
+2
-2
setuptools/tests/test_easy_install.py
setuptools/tests/test_easy_install.py
+2
-2
setuptools/tests/test_packageindex.py
setuptools/tests/test_packageindex.py
+1
-1
No files found.
pavement.py
View file @
dc2d1dc2
...
@@ -17,7 +17,7 @@ def update_vendored():
...
@@ -17,7 +17,7 @@ def update_vendored():
remove_all
(
vendor
.
glob
(
'pyparsing*'
))
remove_all
(
vendor
.
glob
(
'pyparsing*'
))
install_args
=
[
install_args
=
[
'install'
,
'install'
,
'-r'
,
str
(
vendor
/
'vendored.txt'
),
'-r'
,
str
(
vendor
/
'vendored.txt'
),
'-t'
,
str
(
vendor
),
'-t'
,
str
(
vendor
),
]
]
pip
.
main
(
install_args
)
pip
.
main
(
install_args
)
...
...
setuptools/depends.py
View file @
dc2d1dc2
...
@@ -89,16 +89,16 @@ def _iter_code(code):
...
@@ -89,16 +89,16 @@ def _iter_code(code):
ptr
=
0
ptr
=
0
extended_arg
=
0
extended_arg
=
0
while
ptr
<
eof
:
while
ptr
<
eof
:
op
=
bytes
[
ptr
]
op
=
bytes
[
ptr
]
if
op
>=
HAVE_ARGUMENT
:
if
op
>=
HAVE_ARGUMENT
:
arg
=
bytes
[
ptr
+
1
]
+
bytes
[
ptr
+
2
]
*
256
+
extended_arg
arg
=
bytes
[
ptr
+
1
]
+
bytes
[
ptr
+
2
]
*
256
+
extended_arg
ptr
+=
3
ptr
+=
3
if
op
==
EXTENDED_ARG
:
if
op
==
EXTENDED_ARG
:
long_type
=
six
.
integer_types
[
-
1
]
long_type
=
six
.
integer_types
[
-
1
]
extended_arg
=
arg
*
long_type
(
65536
)
extended_arg
=
arg
*
long_type
(
65536
)
continue
continue
...
@@ -119,7 +119,7 @@ def find_module(module, paths=None):
...
@@ -119,7 +119,7 @@ def find_module(module, paths=None):
part
=
parts
.
pop
(
0
)
part
=
parts
.
pop
(
0
)
f
,
path
,
(
suffix
,
mode
,
kind
)
=
info
=
imp
.
find_module
(
part
,
paths
)
f
,
path
,
(
suffix
,
mode
,
kind
)
=
info
=
imp
.
find_module
(
part
,
paths
)
if
kind
==
PKG_DIRECTORY
:
if
kind
==
PKG_DIRECTORY
:
parts
=
parts
or
[
'__init__'
]
parts
=
parts
or
[
'__init__'
]
paths
=
[
path
]
paths
=
[
path
]
...
@@ -143,12 +143,12 @@ def get_module_constant(module, symbol, default=-1, paths=None):
...
@@ -143,12 +143,12 @@ def get_module_constant(module, symbol, default=-1, paths=None):
return
None
return
None
try
:
try
:
if
kind
==
PY_COMPILED
:
if
kind
==
PY_COMPILED
:
f
.
read
(
8
)
# skip magic & date
f
.
read
(
8
)
# skip magic & date
code
=
marshal
.
load
(
f
)
code
=
marshal
.
load
(
f
)
elif
kind
==
PY_FROZEN
:
elif
kind
==
PY_FROZEN
:
code
=
imp
.
get_frozen_object
(
module
)
code
=
imp
.
get_frozen_object
(
module
)
elif
kind
==
PY_SOURCE
:
elif
kind
==
PY_SOURCE
:
code
=
compile
(
f
.
read
(),
path
,
'exec'
)
code
=
compile
(
f
.
read
(),
path
,
'exec'
)
else
:
else
:
# Not something we can parse; we'll have to import it. :(
# Not something we can parse; we'll have to import it. :(
...
@@ -190,9 +190,9 @@ def extract_constant(code, symbol, default=-1):
...
@@ -190,9 +190,9 @@ def extract_constant(code, symbol, default=-1):
for
op
,
arg
in
_iter_code
(
code
):
for
op
,
arg
in
_iter_code
(
code
):
if
op
==
LOAD_CONST
:
if
op
==
LOAD_CONST
:
const
=
code
.
co_consts
[
arg
]
const
=
code
.
co_consts
[
arg
]
elif
arg
==
name_idx
and
(
op
==
STORE_NAME
or
op
==
STORE_GLOBAL
):
elif
arg
==
name_idx
and
(
op
==
STORE_NAME
or
op
==
STORE_GLOBAL
):
return
const
return
const
else
:
else
:
const
=
default
const
=
default
...
...
setuptools/dist.py
View file @
dc2d1dc2
...
@@ -65,7 +65,7 @@ sequence = tuple, list
...
@@ -65,7 +65,7 @@ sequence = tuple, list
def
check_importable
(
dist
,
attr
,
value
):
def
check_importable
(
dist
,
attr
,
value
):
try
:
try
:
ep
=
pkg_resources
.
EntryPoint
.
parse
(
'x='
+
value
)
ep
=
pkg_resources
.
EntryPoint
.
parse
(
'x='
+
value
)
assert
not
ep
.
extras
assert
not
ep
.
extras
except
(
TypeError
,
ValueError
,
AttributeError
,
AssertionError
):
except
(
TypeError
,
ValueError
,
AttributeError
,
AssertionError
):
raise
DistutilsSetupError
(
raise
DistutilsSetupError
(
...
@@ -77,7 +77,7 @@ def check_importable(dist, attr, value):
...
@@ -77,7 +77,7 @@ def check_importable(dist, attr, value):
def
assert_string_list
(
dist
,
attr
,
value
):
def
assert_string_list
(
dist
,
attr
,
value
):
"""Verify that value is a string list or None"""
"""Verify that value is a string list or None"""
try
:
try
:
assert
''
.
join
(
value
)
!=
value
assert
''
.
join
(
value
)
!=
value
except
(
TypeError
,
ValueError
,
AttributeError
,
AssertionError
):
except
(
TypeError
,
ValueError
,
AttributeError
,
AssertionError
):
raise
DistutilsSetupError
(
raise
DistutilsSetupError
(
"%r must be a list of strings (got %r)"
%
(
attr
,
value
)
"%r must be a list of strings (got %r)"
%
(
attr
,
value
)
...
@@ -109,7 +109,7 @@ def check_extras(dist, attr, value):
...
@@ -109,7 +109,7 @@ def check_extras(dist, attr, value):
if
':'
in
k
:
if
':'
in
k
:
k
,
m
=
k
.
split
(
':'
,
1
)
k
,
m
=
k
.
split
(
':'
,
1
)
if
pkg_resources
.
invalid_marker
(
m
):
if
pkg_resources
.
invalid_marker
(
m
):
raise
DistutilsSetupError
(
"Invalid environment marker: "
+
m
)
raise
DistutilsSetupError
(
"Invalid environment marker: "
+
m
)
list
(
pkg_resources
.
parse_requirements
(
v
))
list
(
pkg_resources
.
parse_requirements
(
v
))
except
(
TypeError
,
ValueError
,
AttributeError
):
except
(
TypeError
,
ValueError
,
AttributeError
):
raise
DistutilsSetupError
(
raise
DistutilsSetupError
(
...
@@ -162,7 +162,7 @@ def check_package_data(dist, attr, value):
...
@@ -162,7 +162,7 @@ def check_package_data(dist, attr, value):
else
:
else
:
return
return
raise
DistutilsSetupError
(
raise
DistutilsSetupError
(
attr
+
" must be a dictionary mapping package names to lists of "
attr
+
" must be a dictionary mapping package names to lists of "
"wildcard patterns"
"wildcard patterns"
)
)
...
@@ -313,7 +313,7 @@ class Distribution(_Distribution):
...
@@ -313,7 +313,7 @@ class Distribution(_Distribution):
def _feature_attrname(self, name):
def _feature_attrname(self, name):
"""Convert feature name to corresponding option attribute name"""
"""Convert feature name to corresponding option attribute name"""
return '
with_
'
+
name.replace('
-
', '
_
')
return '
with_
'
+
name.replace('
-
', '
_
')
def fetch_build_eggs(self, requires):
def fetch_build_eggs(self, requires):
"""Resolve pre-setup requirements"""
"""Resolve pre-setup requirements"""
...
@@ -402,13 +402,13 @@ class Distribution(_Distribution):
...
@@ -402,13 +402,13 @@ class Distribution(_Distribution):
if
feature
.
optional
:
if
feature
.
optional
:
descr
=
feature
.
description
descr
=
feature
.
description
incdef
=
' (default)'
incdef
=
' (default)'
excdef
=
''
excdef
=
''
if
not
feature
.
include_by_default
():
if
not
feature
.
include_by_default
():
excdef
,
incdef
=
incdef
,
excdef
excdef
,
incdef
=
incdef
,
excdef
go
.
append
((
'with-'
+
name
,
None
,
'include '
+
descr
+
incdef
))
go
.
append
((
'with-'
+
name
,
None
,
'include '
+
descr
+
incdef
))
go
.
append
((
'without-'
+
name
,
None
,
'exclude '
+
descr
+
excdef
))
go
.
append
((
'without-'
+
name
,
None
,
'exclude '
+
descr
+
excdef
))
no
[
'without-'
+
name
]
=
'with-'
+
name
no
[
'without-'
+
name
]
=
'with-'
+
name
self
.
global_options
=
self
.
feature_options
=
go
+
self
.
global_options
self
.
global_options
=
self
.
feature_options
=
go
+
self
.
global_options
self
.
negative_opt
=
self
.
feature_negopt
=
no
self
.
negative_opt
=
self
.
feature_negopt
=
no
...
@@ -469,7 +469,7 @@ class Distribution(_Distribution):
...
@@ -469,7 +469,7 @@ class Distribution(_Distribution):
def
include_feature
(
self
,
name
):
def
include_feature
(
self
,
name
):
"""Request inclusion of feature named 'name'"""
"""Request inclusion of feature named 'name'"""
if
self
.
feature_is_included
(
name
)
==
0
:
if
self
.
feature_is_included
(
name
)
==
0
:
descr
=
self
.
features
[
name
].
description
descr
=
self
.
features
[
name
].
description
raise
DistutilsOptionError
(
raise
DistutilsOptionError
(
descr
+
" is required, but was excluded or is not available"
descr
+
" is required, but was excluded or is not available"
...
@@ -493,7 +493,7 @@ class Distribution(_Distribution):
...
@@ -493,7 +493,7 @@ class Distribution(_Distribution):
handle whatever special inclusion logic is needed.
handle whatever special inclusion logic is needed.
"""
"""
for
k
,
v
in
attrs
.
items
():
for
k
,
v
in
attrs
.
items
():
include
=
getattr
(
self
,
'_include_'
+
k
,
None
)
include
=
getattr
(
self
,
'_include_'
+
k
,
None
)
if
include
:
if
include
:
include
(
v
)
include
(
v
)
else
:
else
:
...
@@ -502,7 +502,7 @@ class Distribution(_Distribution):
...
@@ -502,7 +502,7 @@ class Distribution(_Distribution):
def
exclude_package
(
self
,
package
):
def
exclude_package
(
self
,
package
):
"""Remove packages, modules, and extensions in named package"""
"""Remove packages, modules, and extensions in named package"""
pfx
=
package
+
'.'
pfx
=
package
+
'.'
if
self
.
packages
:
if
self
.
packages
:
self
.
packages
=
[
self
.
packages
=
[
p
for
p
in
self
.
packages
p
for
p
in
self
.
packages
...
@@ -524,10 +524,10 @@ class Distribution(_Distribution):
...
@@ -524,10 +524,10 @@ class Distribution(_Distribution):
def
has_contents_for
(
self
,
package
):
def
has_contents_for
(
self
,
package
):
"""Return true if 'exclude_package(package)' would do something"""
"""Return true if 'exclude_package(package)' would do something"""
pfx
=
package
+
'.'
pfx
=
package
+
'.'
for
p
in
self
.
iter_distribution_names
():
for
p
in
self
.
iter_distribution_names
():
if
p
==
package
or
p
.
startswith
(
pfx
):
if
p
==
package
or
p
.
startswith
(
pfx
):
return
True
return
True
def
_exclude_misc
(
self
,
name
,
value
):
def
_exclude_misc
(
self
,
name
,
value
):
...
@@ -544,7 +544,7 @@ class Distribution(_Distribution):
...
@@ -544,7 +544,7 @@ class Distribution(_Distribution):
)
)
if
old
is
not
None
and
not
isinstance
(
old
,
sequence
):
if
old
is
not
None
and
not
isinstance
(
old
,
sequence
):
raise
DistutilsSetupError
(
raise
DistutilsSetupError
(
name
+
": this setting cannot be changed via include/exclude"
name
+
": this setting cannot be changed via include/exclude"
)
)
elif
old
:
elif
old
:
setattr
(
self
,
name
,
[
item
for
item
in
old
if
item
not
in
value
])
setattr
(
self
,
name
,
[
item
for
item
in
old
if
item
not
in
value
])
...
@@ -566,10 +566,10 @@ class Distribution(_Distribution):
...
@@ -566,10 +566,10 @@ class Distribution(_Distribution):
setattr
(
self
,
name
,
value
)
setattr
(
self
,
name
,
value
)
elif
not
isinstance
(
old
,
sequence
):
elif
not
isinstance
(
old
,
sequence
):
raise
DistutilsSetupError
(
raise
DistutilsSetupError
(
name
+
": this setting cannot be changed via include/exclude"
name
+
": this setting cannot be changed via include/exclude"
)
)
else
:
else
:
setattr
(
self
,
name
,
old
+
[
item
for
item
in
value
if
item
not
in
old
])
setattr
(
self
,
name
,
old
+
[
item
for
item
in
value
if
item
not
in
old
])
def
exclude
(
self
,
**
attrs
):
def
exclude
(
self
,
**
attrs
):
"""Remove items from distribution that are named in keyword arguments
"""Remove items from distribution that are named in keyword arguments
...
@@ -588,7 +588,7 @@ class Distribution(_Distribution):
...
@@ -588,7 +588,7 @@ class Distribution(_Distribution):
handle whatever special exclusion logic is needed.
handle whatever special exclusion logic is needed.
"""
"""
for
k
,
v
in
attrs
.
items
():
for
k
,
v
in
attrs
.
items
():
exclude
=
getattr
(
self
,
'_exclude_'
+
k
,
None
)
exclude
=
getattr
(
self
,
'_exclude_'
+
k
,
None
)
if
exclude
:
if
exclude
:
exclude
(
v
)
exclude
(
v
)
else
:
else
:
...
@@ -648,19 +648,19 @@ class Distribution(_Distribution):
...
@@ -648,19 +648,19 @@ class Distribution(_Distribution):
opt
=
opt
.
replace
(
'_'
,
'-'
)
opt
=
opt
.
replace
(
'_'
,
'-'
)
if
val
==
0
:
if
val
==
0
:
cmdobj
=
self
.
get_command_obj
(
cmd
)
cmdobj
=
self
.
get_command_obj
(
cmd
)
neg_opt
=
self
.
negative_opt
.
copy
()
neg_opt
=
self
.
negative_opt
.
copy
()
neg_opt
.
update
(
getattr
(
cmdobj
,
'negative_opt'
,
{}))
neg_opt
.
update
(
getattr
(
cmdobj
,
'negative_opt'
,
{}))
for
neg
,
pos
in
neg_opt
.
items
():
for
neg
,
pos
in
neg_opt
.
items
():
if
pos
==
opt
:
if
pos
==
opt
:
opt
=
neg
opt
=
neg
val
=
None
val
=
None
break
break
else
:
else
:
raise
AssertionError
(
"Shouldn't be able to get here"
)
raise
AssertionError
(
"Shouldn't be able to get here"
)
elif
val
==
1
:
elif
val
==
1
:
val
=
None
val
=
None
d
.
setdefault
(
cmd
,
{})[
opt
]
=
val
d
.
setdefault
(
cmd
,
{})[
opt
]
=
val
...
@@ -835,7 +835,7 @@ class Feature:
...
@@ -835,7 +835,7 @@ class Feature:
if
not
self
.
available
:
if
not
self
.
available
:
raise
DistutilsPlatformError
(
raise
DistutilsPlatformError
(
self
.
description
+
" is required, "
self
.
description
+
" is required, "
"but is not available on this platform"
"but is not available on this platform"
)
)
...
...
setuptools/lib2to3_ex.py
View file @
dc2d1dc2
...
@@ -34,7 +34,7 @@ class Mixin2to3(_Mixin2to3):
...
@@ -34,7 +34,7 @@ class Mixin2to3(_Mixin2to3):
return
return
if
not
files
:
if
not
files
:
return
return
log
.
info
(
"Fixing "
+
" "
.
join
(
files
))
log
.
info
(
"Fixing "
+
" "
.
join
(
files
))
self
.
__build_fixer_names
()
self
.
__build_fixer_names
()
self
.
__exclude_fixers
()
self
.
__exclude_fixers
()
if
doctests
:
if
doctests
:
...
...
setuptools/package_index.py
View file @
dc2d1dc2
...
@@ -80,7 +80,7 @@ def egg_info_for_url(url):
...
@@ -80,7 +80,7 @@ def egg_info_for_url(url):
parts = urllib.parse.urlparse(url)
parts = urllib.parse.urlparse(url)
scheme, server, path, parameters, query, fragment = parts
scheme, server, path, parameters, query, fragment = parts
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
...
@@ -155,7 +155,7 @@ def interpret_distro_name(
...
@@ -155,7 +155,7 @@ def interpret_distro_name(
# it is a bdist_dumb, not an sdist -- bail out
# it is a bdist_dumb, not an sdist -- bail out
return
return
for p in range(1, len(parts)
+
1):
for p in range(1, len(parts)
+
1):
yield Distribution(
yield Distribution(
location, metadata, '
-
'.join(parts[:p]), '
-
'.join(parts[p:]),
location, metadata, '
-
'.join(parts[:p]), '
-
'.join(parts[p:]),
py_version=py_version, precedence = precedence,
py_version=py_version, precedence = precedence,
...
@@ -209,7 +209,7 @@ def find_external_links(url, page):
...
@@ -209,7 +209,7 @@ def find_external_links(url, page):
for tag in ("<th>Home Page", "<th>Download URL"):
for tag in ("<th>Home Page", "<th>Download URL"):
pos = page.find(tag)
pos = page.find(tag)
if pos
!=
-1:
if pos
!=
-1:
match = HREF.search(page, pos)
match = HREF.search(page, pos)
if match:
if match:
yield urllib.parse.urljoin(url, htmldecode(match.group(1)))
yield urllib.parse.urljoin(url, htmldecode(match.group(1)))
...
@@ -336,7 +336,7 @@ class PackageIndex(Environment):
...
@@ -336,7 +336,7 @@ class PackageIndex(Environment):
for match in HREF.finditer(page):
for match in HREF.finditer(page):
link = urllib.parse.urljoin(base, htmldecode(match.group(1)))
link = urllib.parse.urljoin(base, htmldecode(match.group(1)))
self.process_url(link)
self.process_url(link)
if url.startswith(self.index_url) and getattr(f, 'code', None)
!=
404:
if url.startswith(self.index_url) and getattr(f, 'code', None)
!=
404:
page = self.process_index(url, page)
page = self.process_index(url, page)
def process_filename(self, fn, nested=False):
def process_filename(self, fn, nested=False):
...
@@ -357,7 +357,7 @@ class PackageIndex(Environment):
...
@@ -357,7 +357,7 @@ class PackageIndex(Environment):
def url_ok(self, url, fatal=False):
def url_ok(self, url, fatal=False):
s = URL_SCHEME(url)
s = URL_SCHEME(url)
if (s and s.group(1).lower()
==
'file') or self.allows(urllib.parse.urlparse(url)[1]):
if (s and s.group(1).lower()
==
'file') or self.allows(urllib.parse.urlparse(url)[1]):
return True
return True
msg = ("
\
n
Note: Bypassing %s (disallowed host; see "
msg = ("
\
n
Note: Bypassing %s (disallowed host; see "
"http://bit.ly/1dg9ijs for details).
\
n
")
"http://bit.ly/1dg9ijs for details).
\
n
")
...
@@ -400,7 +400,7 @@ class PackageIndex(Environment):
...
@@ -400,7 +400,7 @@ class PackageIndex(Environment):
parts = list(map(
parts = list(map(
urllib.parse.unquote, link[len(self.index_url):].split('/')
urllib.parse.unquote, link[len(self.index_url):].split('/')
))
))
if len(parts)
==
2 and '#' not in parts[1]:
if len(parts)
==
2 and '#' not in parts[1]:
# it's a package page, sanitize and index it
# it's a package page, sanitize and index it
pkg = safe_name(parts[0])
pkg = safe_name(parts[0])
ver = safe_version(parts[1])
ver = safe_version(parts[1])
...
@@ -423,7 +423,7 @@ class PackageIndex(Environment):
...
@@ -423,7 +423,7 @@ class PackageIndex(Environment):
base, frag = egg_info_for_url(new_url)
base, frag = egg_info_for_url(new_url)
if base.endswith('.py') and not frag:
if base.endswith('.py') and not frag:
if ver:
if ver:
new_url
+=
'#egg=%s-%s' % (pkg, ver)
new_url
+=
'#egg=%s-%s' % (pkg, ver)
else:
else:
self.need_version_info(url)
self.need_version_info(url)
self.scan_url(new_url)
self.scan_url(new_url)
...
@@ -449,11 +449,11 @@ class PackageIndex(Environment):
...
@@ -449,11 +449,11 @@ class PackageIndex(Environment):
self.scan_url(self.index_url)
self.scan_url(self.index_url)
def find_packages(self, requirement):
def find_packages(self, requirement):
self.scan_url(self.index_url + requirement.unsafe_name
+
'/')
self.scan_url(self.index_url + requirement.unsafe_name
+
'/')
if not self.package_pages.get(requirement.key):
if not self.package_pages.get(requirement.key):
# Fall back to safe version of the name
# Fall back to safe version of the name
self.scan_url(self.index_url + requirement.project_name
+
'/')
self.scan_url(self.index_url + requirement.project_name
+
'/')
if not self.package_pages.get(requirement.key):
if not self.package_pages.get(requirement.key):
# We couldn't find the target package, so search the index page too
# We couldn't find the target package, so search the index page too
...
@@ -589,13 +589,13 @@ class PackageIndex(Environment):
...
@@ -589,13 +589,13 @@ class PackageIndex(Environment):
for dist in env[req.key]:
for dist in env[req.key]:
if dist.precedence
==
DEVELOP_DIST and not develop_ok:
if dist.precedence
==
DEVELOP_DIST and not develop_ok:
if dist not in skipped:
if dist not in skipped:
self.warn("Skipping development or system egg: %s", dist)
self.warn("Skipping development or system egg: %s", dist)
skipped[dist] = 1
skipped[dist] = 1
continue
continue
if dist in req and (dist.precedence
<=
SOURCE_DIST or not source):
if dist in req and (dist.precedence
<=
SOURCE_DIST or not source):
return dist
return dist
if force_scan:
if force_scan:
...
@@ -645,7 +645,7 @@ class PackageIndex(Environment):
...
@@ -645,7 +645,7 @@ class PackageIndex(Environment):
interpret_distro_name(filename, match.group(1), None) if d.version
interpret_distro_name(filename, match.group(1), None) if d.version
] or []
] or []
if len(dists)
==
1: # unambiguous ``#egg`` fragment
if len(dists)
==
1: # unambiguous ``#egg`` fragment
basename = os.path.basename(filename)
basename = os.path.basename(filename)
# Make sure the file has been downloaded to the temp dir.
# Make sure the file has been downloaded to the temp dir.
...
@@ -654,7 +654,7 @@ class PackageIndex(Environment):
...
@@ -654,7 +654,7 @@ class PackageIndex(Environment):
from setuptools.command.easy_install import samefile
from setuptools.command.easy_install import samefile
if not samefile(filename, dst):
if not samefile(filename, dst):
shutil.copy2(filename, dst)
shutil.copy2(filename, dst)
filename
=
dst
filename
=
dst
with open(os.path.join(tmpdir, 'setup.py'), 'w') as file:
with open(os.path.join(tmpdir, 'setup.py'), 'w') as file:
file.write(
file.write(
...
@@ -771,13 +771,13 @@ class PackageIndex(Environment):
...
@@ -771,13 +771,13 @@ class PackageIndex(Environment):
# Download the file
# Download the file
#
#
if scheme
==
'svn' or scheme.startswith('svn+'):
if scheme
==
'svn' or scheme.startswith('svn+'):
return self._download_svn(url, filename)
return self._download_svn(url, filename)
elif scheme
==
'git' or scheme.startswith('git+'):
elif scheme
==
'git' or scheme.startswith('git+'):
return self._download_git(url, filename)
return self._download_git(url, filename)
elif scheme.startswith('hg+'):
elif scheme.startswith('hg+'):
return self._download_hg(url, filename)
return self._download_hg(url, filename)
elif scheme
==
'file':
elif scheme
==
'file':
return urllib.request.url2pathname(urllib.parse.urlparse(url)[2])
return urllib.request.url2pathname(urllib.parse.urlparse(url)[2])
else:
else:
self.url_ok(url, True) # raises error if not allowed
self.url_ok(url, True) # raises error if not allowed
...
@@ -806,7 +806,7 @@ class PackageIndex(Environment):
...
@@ -806,7 +806,7 @@ class PackageIndex(Environment):
break # not an index page
break # not an index page
file.close()
file.close()
os.unlink(filename)
os.unlink(filename)
raise DistutilsError("Unexpected HTML page found at "
+
url)
raise DistutilsError("Unexpected HTML page found at "
+
url)
def _download_svn(self, url, filename):
def _download_svn(self, url, filename):
url = url.split('#', 1)[0] # remove any fragment for svn's sake
url = url.split('#', 1)[0] # remove any fragment for svn's sake
...
@@ -821,7 +821,7 @@ class PackageIndex(Environment):
...
@@ -821,7 +821,7 @@ class PackageIndex(Environment):
user, pw = auth.split(':', 1)
user, pw = auth.split(':', 1)
creds = " --username=%s --password=%s" % (user, pw)
creds = " --username=%s --password=%s" % (user, pw)
else:
else:
creds = " --username="
+
auth
creds = " --username="
+
auth
netloc = host
netloc = host
parts = scheme, netloc, url, p, q, f
parts = scheme, netloc, url, p, q, f
url = urllib.parse.urlunparse(parts)
url = urllib.parse.urlunparse(parts)
...
@@ -896,7 +896,7 @@ entity_sub = re.compile(r'&(#(\d+|x[\da-fA-F]+)|[\w.:-]+);?').sub
...
@@ -896,7 +896,7 @@ 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)
...
@@ -1046,7 +1046,7 @@ def open_with_auth(url, opener=urllib.request.urlopen):
...
@@ -1046,7 +1046,7 @@ def open_with_auth(url, opener=urllib.request.urlopen):
# Put authentication info back into request URL if same host,
# Put authentication info back into request URL if same host,
# so that links found on the page will work
# so that links found on the page will work
s2, h2, path2, param2, query2, frag2 = urllib.parse.urlparse(fp.url)
s2, h2, path2, param2, query2, frag2 = urllib.parse.urlparse(fp.url)
if s2
==scheme and h2==
host:
if s2
== scheme and h2 ==
host:
parts = s2, netloc, path2, param2, query2, frag2
parts = s2, netloc, path2, param2, query2, frag2
fp.url = urllib.parse.urlunparse(parts)
fp.url = urllib.parse.urlunparse(parts)
...
...
setuptools/py31compat.py
View file @
dc2d1dc2
...
@@ -12,7 +12,7 @@ except ImportError:
...
@@ -12,7 +12,7 @@ except ImportError:
def
get_path
(
name
):
def
get_path
(
name
):
if
name
not
in
(
'platlib'
,
'purelib'
):
if
name
not
in
(
'platlib'
,
'purelib'
):
raise
ValueError
(
"Name must be purelib or platlib"
)
raise
ValueError
(
"Name must be purelib or platlib"
)
return
get_python_lib
(
name
==
'platlib'
)
return
get_python_lib
(
name
==
'platlib'
)
try
:
try
:
# Python >=3.2
# Python >=3.2
...
...
setuptools/sandbox.py
View file @
dc2d1dc2
...
@@ -234,7 +234,7 @@ def run_setup(setup_script, args):
...
@@ -234,7 +234,7 @@ def run_setup(setup_script, args):
setup_dir = os.path.abspath(os.path.dirname(setup_script))
setup_dir = os.path.abspath(os.path.dirname(setup_script))
with setup_context(setup_dir):
with setup_context(setup_dir):
try:
try:
sys.argv[:] = [setup_script]
+
list(args)
sys.argv[:] = [setup_script]
+
list(args)
sys.path.insert(0, setup_dir)
sys.path.insert(0, setup_dir)
# reset to include setup dir, w/clean callback list
# reset to include setup dir, w/clean callback list
working_set.__init__()
working_set.__init__()
...
@@ -353,8 +353,8 @@ class AbstractSandbox:
...
@@ -353,8 +353,8 @@ class AbstractSandbox:
def _remap_pair(self, operation, src, dst, *args, **kw):
def _remap_pair(self, operation, src, dst, *args, **kw):
"""
Called
for
path
pairs
like
rename
,
link
,
and
symlink
operations
"""
"""
Called
for
path
pairs
like
rename
,
link
,
and
symlink
operations
"""
return (
return (
self._remap_input(operation
+
'-from', src, *args, **kw),
self._remap_input(operation
+
'-from', src, *args, **kw),
self._remap_input(operation
+
'-to', dst, *args, **kw)
self._remap_input(operation
+
'-to', dst, *args, **kw)
)
)
...
...
setuptools/site-patch.py
View file @
dc2d1dc2
...
@@ -2,7 +2,7 @@ def __boot():
...
@@ -2,7 +2,7 @@ def __boot():
import
sys
import
sys
import
os
import
os
PYTHONPATH
=
os
.
environ
.
get
(
'PYTHONPATH'
)
PYTHONPATH
=
os
.
environ
.
get
(
'PYTHONPATH'
)
if
PYTHONPATH
is
None
or
(
sys
.
platform
==
'win32'
and
not
PYTHONPATH
):
if
PYTHONPATH
is
None
or
(
sys
.
platform
==
'win32'
and
not
PYTHONPATH
):
PYTHONPATH
=
[]
PYTHONPATH
=
[]
else
:
else
:
PYTHONPATH
=
PYTHONPATH
.
split
(
os
.
pathsep
)
PYTHONPATH
=
PYTHONPATH
.
split
(
os
.
pathsep
)
...
@@ -12,7 +12,7 @@ def __boot():
...
@@ -12,7 +12,7 @@ def __boot():
mydir
=
os
.
path
.
dirname
(
__file__
)
mydir
=
os
.
path
.
dirname
(
__file__
)
for
item
in
stdpath
:
for
item
in
stdpath
:
if
item
==
mydir
or
not
item
:
if
item
==
mydir
or
not
item
:
continue
# skip if current dir. on Windows, or my own directory
continue
# skip if current dir. on Windows, or my own directory
importer
=
pic
.
get
(
item
)
importer
=
pic
.
get
(
item
)
if
importer
is
not
None
:
if
importer
is
not
None
:
...
@@ -55,7 +55,7 @@ def __boot():
...
@@ -55,7 +55,7 @@ def __boot():
for
item
in
sys
.
path
:
for
item
in
sys
.
path
:
p
,
np
=
makepath
(
item
)
p
,
np
=
makepath
(
item
)
if
np
==
nd
and
insert_at
is
None
:
if
np
==
nd
and
insert_at
is
None
:
# We've hit the first 'system' path entry, so added entries go here
# We've hit the first 'system' path entry, so added entries go here
insert_at
=
len
(
new_path
)
insert_at
=
len
(
new_path
)
...
@@ -68,6 +68,6 @@ def __boot():
...
@@ -68,6 +68,6 @@ def __boot():
sys
.
path
[:]
=
new_path
sys
.
path
[:]
=
new_path
if
__name__
==
'site'
:
if
__name__
==
'site'
:
__boot
()
__boot
()
del
__boot
del
__boot
setuptools/ssl_support.py
View file @
dc2d1dc2
...
@@ -235,7 +235,7 @@ def get_win_certfile():
...
@@ -235,7 +235,7 @@ def get_win_certfile():
def find_ca_bundle():
def find_ca_bundle():
"""Return an existing CA bundle path, or None"""
"""Return an existing CA bundle path, or None"""
if os.name
==
'
nt
':
if os.name
==
'
nt
':
return get_win_certfile()
return get_win_certfile()
else:
else:
for cert_path in cert_paths:
for cert_path in cert_paths:
...
...
setuptools/tests/test_bdist_egg.py
View file @
dc2d1dc2
...
@@ -18,9 +18,9 @@ setup(name='foo', py_modules=['hi'])
...
@@ -18,9 +18,9 @@ setup(name='foo', py_modules=['hi'])
@
pytest
.
yield_fixture
@
pytest
.
yield_fixture
def
setup_context
(
tmpdir
):
def
setup_context
(
tmpdir
):
with
(
tmpdir
/
'setup.py'
).
open
(
'w'
)
as
f
:
with
(
tmpdir
/
'setup.py'
).
open
(
'w'
)
as
f
:
f
.
write
(
SETUP_PY
)
f
.
write
(
SETUP_PY
)
with
(
tmpdir
/
'hi.py'
).
open
(
'w'
)
as
f
:
with
(
tmpdir
/
'hi.py'
).
open
(
'w'
)
as
f
:
f
.
write
(
'1
\
n
'
)
f
.
write
(
'1
\
n
'
)
with
tmpdir
.
as_cwd
():
with
tmpdir
.
as_cwd
():
yield
tmpdir
yield
tmpdir
...
...
setuptools/tests/test_easy_install.py
View file @
dc2d1dc2
...
@@ -157,7 +157,7 @@ class TestPTHFileWriter:
...
@@ -157,7 +157,7 @@ class TestPTHFileWriter:
@
pytest
.
yield_fixture
@
pytest
.
yield_fixture
def
setup_context
(
tmpdir
):
def
setup_context
(
tmpdir
):
with
(
tmpdir
/
'setup.py'
).
open
(
'w'
)
as
f
:
with
(
tmpdir
/
'setup.py'
).
open
(
'w'
)
as
f
:
f
.
write
(
SETUP_PY
)
f
.
write
(
SETUP_PY
)
with
tmpdir
.
as_cwd
():
with
tmpdir
.
as_cwd
():
yield
tmpdir
yield
tmpdir
...
@@ -555,7 +555,7 @@ class TestScriptHeader:
...
@@ -555,7 +555,7 @@ class TestScriptHeader:
assert
actual
==
expected
assert
actual
==
expected
actual
=
ei
.
ScriptWriter
.
get_script_header
(
'#!/usr/bin/python'
,
actual
=
ei
.
ScriptWriter
.
get_script_header
(
'#!/usr/bin/python'
,
executable
=
'"'
+
self
.
exe_with_spaces
+
'"'
)
executable
=
'"'
+
self
.
exe_with_spaces
+
'"'
)
expected
=
'#!"%s"
\
n
'
%
self
.
exe_with_spaces
expected
=
'#!"%s"
\
n
'
%
self
.
exe_with_spaces
assert
actual
==
expected
assert
actual
==
expected
...
...
setuptools/tests/test_packageindex.py
View file @
dc2d1dc2
...
@@ -129,7 +129,7 @@ class TestPackageIndex:
...
@@ -129,7 +129,7 @@ class TestPackageIndex:
# the distribution has been found
# the distribution has been found
assert
'foobar'
in
pi
assert
'foobar'
in
pi
# we have only one link, because links are compared without md5
# we have only one link, because links are compared without md5
assert
len
(
pi
[
'foobar'
])
==
1
assert
len
(
pi
[
'foobar'
])
==
1
# the link should be from the index
# the link should be from the index
assert
'correct_md5'
in
pi
[
'foobar'
][
0
].
location
assert
'correct_md5'
in
pi
[
'foobar'
][
0
].
location
...
...
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