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
caa614a0
Commit
caa614a0
authored
Jan 03, 2015
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Plain Diff
Merge with master
--HG-- branch : feature/issue-229
parents
89bbe1de
d0a3a68d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
76 additions
and
73 deletions
+76
-73
linkify.py
linkify.py
+1
-1
pkg_resources/__init__.py
pkg_resources/__init__.py
+2
-0
pkg_resources/tests/__init__.py
pkg_resources/tests/__init__.py
+0
-0
pkg_resources/tests/test_pkg_resources.py
pkg_resources/tests/test_pkg_resources.py
+0
-0
pkg_resources/tests/test_resources.py
pkg_resources/tests/test_resources.py
+4
-71
setuptools/tests/test_easy_install.py
setuptools/tests/test_easy_install.py
+69
-1
No files found.
linkify.py
View file @
caa614a0
...
@@ -26,7 +26,7 @@ issue_urls = dict(
...
@@ -26,7 +26,7 @@ issue_urls = dict(
old_setuptools
=
'http://bugs.python.org/setuptools/issue{old_setuptools}'
,
old_setuptools
=
'http://bugs.python.org/setuptools/issue{old_setuptools}'
,
jython
=
'http://bugs.jython.org/issue{jython}'
,
jython
=
'http://bugs.jython.org/issue{jython}'
,
python
=
'http://bugs.python.org/issue{python}'
,
python
=
'http://bugs.python.org/issue{python}'
,
interop
=
'https://github.com/pypa/interoperability/issues/{interop}'
,
interop
=
'https://github.com/pypa/interoperability
-peps
/issues/{interop}'
,
)
)
...
...
pkg_resources/__init__.py
View file @
caa614a0
...
@@ -52,6 +52,8 @@ if PY3:
...
@@ -52,6 +52,8 @@ if PY3:
else
:
else
:
string_types
=
str
,
eval
(
'unicode'
)
string_types
=
str
,
eval
(
'unicode'
)
iteritems
=
(
lambda
i
:
i
.
items
())
if
PY3
else
lambda
i
:
i
.
iteritems
()
# capture these to bypass sandboxing
# capture these to bypass sandboxing
from
os
import
utime
from
os
import
utime
try
:
try
:
...
...
pkg_resources/tests/__init__.py
0 → 100644
View file @
caa614a0
tests/test_pkg_resources.py
→
pkg_resources/
tests/test_pkg_resources.py
View file @
caa614a0
File moved
setuptool
s/tests/test_resources.py
→
pkg_resource
s/tests/test_resources.py
View file @
caa614a0
#!/usr/bin/python
# -*- coding: utf-8 -*-
# NOTE: the shebang and encoding lines are for TestScriptHeader do not remove
import
os
import
os
import
sys
import
sys
import
tempfile
import
tempfile
...
@@ -16,8 +12,6 @@ from pkg_resources import (parse_requirements, VersionConflict, parse_version,
...
@@ -16,8 +12,6 @@ from pkg_resources import (parse_requirements, VersionConflict, parse_version,
packaging
=
pkg_resources
.
packaging
packaging
=
pkg_resources
.
packaging
from
setuptools.command.easy_install
import
(
get_script_header
,
is_sh
,
nt_quote_arg
)
import
six
import
six
...
@@ -214,13 +208,13 @@ class TestEntryPoints:
...
@@ -214,13 +208,13 @@ class TestEntryPoints:
def
assertfields
(
self
,
ep
):
def
assertfields
(
self
,
ep
):
assert
ep
.
name
==
"foo"
assert
ep
.
name
==
"foo"
assert
ep
.
module_name
==
"
setuptool
s.tests.test_resources"
assert
ep
.
module_name
==
"
pkg_resource
s.tests.test_resources"
assert
ep
.
attrs
==
(
"TestEntryPoints"
,)
assert
ep
.
attrs
==
(
"TestEntryPoints"
,)
assert
ep
.
extras
==
(
"x"
,)
assert
ep
.
extras
==
(
"x"
,)
assert
ep
.
load
()
is
TestEntryPoints
assert
ep
.
load
()
is
TestEntryPoints
assert
(
assert
(
str
(
ep
)
==
str
(
ep
)
==
"foo =
setuptool
s.tests.test_resources:TestEntryPoints [x]"
"foo =
pkg_resource
s.tests.test_resources:TestEntryPoints [x]"
)
)
def
setup_method
(
self
,
method
):
def
setup_method
(
self
,
method
):
...
@@ -229,13 +223,13 @@ class TestEntryPoints:
...
@@ -229,13 +223,13 @@ class TestEntryPoints:
def
testBasics
(
self
):
def
testBasics
(
self
):
ep
=
EntryPoint
(
ep
=
EntryPoint
(
"foo"
,
"
setuptool
s.tests.test_resources"
,
[
"TestEntryPoints"
],
"foo"
,
"
pkg_resource
s.tests.test_resources"
,
[
"TestEntryPoints"
],
[
"x"
],
self
.
dist
[
"x"
],
self
.
dist
)
)
self
.
assertfields
(
ep
)
self
.
assertfields
(
ep
)
def
testParse
(
self
):
def
testParse
(
self
):
s
=
"foo =
setuptool
s.tests.test_resources:TestEntryPoints [x]"
s
=
"foo =
pkg_resource
s.tests.test_resources:TestEntryPoints [x]"
ep
=
EntryPoint
.
parse
(
s
,
self
.
dist
)
ep
=
EntryPoint
.
parse
(
s
,
self
.
dist
)
self
.
assertfields
(
ep
)
self
.
assertfields
(
ep
)
...
@@ -561,67 +555,6 @@ class TestParsing:
...
@@ -561,67 +555,6 @@ class TestParsing:
)
)
class
TestScriptHeader
:
non_ascii_exe
=
'/Users/José/bin/python'
exe_with_spaces
=
r'C:\
P
rogram Files\
Py
thon33\
py
thon.exe'
def
test_get_script_header
(
self
):
if
not
sys
.
platform
.
startswith
(
'java'
)
or
not
is_sh
(
sys
.
executable
):
# This test is for non-Jython platforms
expected
=
'#!%s
\
n
'
%
nt_quote_arg
(
os
.
path
.
normpath
(
sys
.
executable
))
assert
get_script_header
(
'#!/usr/local/bin/python'
)
==
expected
expected
=
'#!%s -x
\
n
'
%
nt_quote_arg
(
os
.
path
.
normpath
(
sys
.
executable
))
assert
get_script_header
(
'#!/usr/bin/python -x'
)
==
expected
candidate
=
get_script_header
(
'#!/usr/bin/python'
,
executable
=
self
.
non_ascii_exe
)
assert
candidate
==
'#!%s -x
\
n
'
%
self
.
non_ascii_exe
candidate
=
get_script_header
(
'#!/usr/bin/python'
,
executable
=
self
.
exe_with_spaces
)
assert
candidate
==
'#!"%s"
\
n
'
%
self
.
exe_with_spaces
def
test_get_script_header_jython_workaround
(
self
):
# This test doesn't work with Python 3 in some locales
if
six
.
PY3
and
os
.
environ
.
get
(
"LC_CTYPE"
)
in
(
None
,
"C"
,
"POSIX"
):
return
class
java
:
class
lang
:
class
System
:
@
staticmethod
def
getProperty
(
property
):
return
""
sys
.
modules
[
"java"
]
=
java
platform
=
sys
.
platform
sys
.
platform
=
'java1.5.0_13'
stdout
,
stderr
=
sys
.
stdout
,
sys
.
stderr
try
:
# A mock sys.executable that uses a shebang line (this file)
exe
=
os
.
path
.
normpath
(
os
.
path
.
splitext
(
__file__
)[
0
]
+
'.py'
)
assert
(
get_script_header
(
'#!/usr/local/bin/python'
,
executable
=
exe
)
==
'#!/usr/bin/env %s
\
n
'
%
exe
)
# Ensure we generate what is basically a broken shebang line
# when there's options, with a warning emitted
sys
.
stdout
=
sys
.
stderr
=
six
.
StringIO
()
candidate
=
get_script_header
(
'#!/usr/bin/python -x'
,
executable
=
exe
)
assert
candidate
==
'#!%s -x
\
n
'
%
exe
assert
'Unable to adapt shebang line'
in
sys
.
stdout
.
getvalue
()
sys
.
stdout
=
sys
.
stderr
=
six
.
StringIO
()
candidate
=
get_script_header
(
'#!/usr/bin/python'
,
executable
=
self
.
non_ascii_exe
)
assert
candidate
==
'#!%s -x
\
n
'
%
self
.
non_ascii_exe
assert
'Unable to adapt shebang line'
in
sys
.
stdout
.
getvalue
()
finally
:
del
sys
.
modules
[
"java"
]
sys
.
platform
=
platform
sys
.
stdout
,
sys
.
stderr
=
stdout
,
stderr
class
TestNamespaces
:
class
TestNamespaces
:
def
setup_method
(
self
,
method
):
def
setup_method
(
self
,
method
):
...
...
setuptools/tests/test_easy_install.py
View file @
caa614a0
#!/usr/bin/python
# -*- coding: utf-8 -*-
# NOTE: the shebang and encoding lines are for TestScriptHeader do not remove
"""Easy install Tests
"""Easy install Tests
"""
"""
from
__future__
import
absolute_import
from
__future__
import
absolute_import
...
@@ -13,6 +17,7 @@ import logging
...
@@ -13,6 +17,7 @@ import logging
import
itertools
import
itertools
import
io
import
io
import
six
from
six.moves
import
urllib
from
six.moves
import
urllib
import
pytest
import
pytest
import
mock
import
mock
...
@@ -20,7 +25,9 @@ import mock
...
@@ -20,7 +25,9 @@ import mock
from
setuptools
import
sandbox
from
setuptools
import
sandbox
from
setuptools.sandbox
import
run_setup
,
SandboxViolation
from
setuptools.sandbox
import
run_setup
,
SandboxViolation
from
setuptools.command.easy_install
import
(
from
setuptools.command.easy_install
import
(
easy_install
,
fix_jython_executable
,
get_script_args
,
nt_quote_arg
)
easy_install
,
fix_jython_executable
,
get_script_args
,
nt_quote_arg
,
get_script_header
,
is_sh
,
)
from
setuptools.command.easy_install
import
PthDistributions
from
setuptools.command.easy_install
import
PthDistributions
from
setuptools.command
import
easy_install
as
easy_install_pkg
from
setuptools.command
import
easy_install
as
easy_install_pkg
from
setuptools.dist
import
Distribution
from
setuptools.dist
import
Distribution
...
@@ -410,3 +417,64 @@ def make_trivial_sdist(dist_path, setup_py):
...
@@ -410,3 +417,64 @@ def make_trivial_sdist(dist_path, setup_py):
setup_py_file
.
size
=
len
(
setup_py_bytes
.
getvalue
())
setup_py_file
.
size
=
len
(
setup_py_bytes
.
getvalue
())
with
tarfile_open
(
dist_path
,
'w:gz'
)
as
dist
:
with
tarfile_open
(
dist_path
,
'w:gz'
)
as
dist
:
dist
.
addfile
(
setup_py_file
,
fileobj
=
setup_py_bytes
)
dist
.
addfile
(
setup_py_file
,
fileobj
=
setup_py_bytes
)
class
TestScriptHeader
:
non_ascii_exe
=
'/Users/José/bin/python'
exe_with_spaces
=
r'C:\
P
rogram Files\
Py
thon33\
py
thon.exe'
def
test_get_script_header
(
self
):
if
not
sys
.
platform
.
startswith
(
'java'
)
or
not
is_sh
(
sys
.
executable
):
# This test is for non-Jython platforms
expected
=
'#!%s
\
n
'
%
nt_quote_arg
(
os
.
path
.
normpath
(
sys
.
executable
))
assert
get_script_header
(
'#!/usr/local/bin/python'
)
==
expected
expected
=
'#!%s -x
\
n
'
%
nt_quote_arg
(
os
.
path
.
normpath
(
sys
.
executable
))
assert
get_script_header
(
'#!/usr/bin/python -x'
)
==
expected
candidate
=
get_script_header
(
'#!/usr/bin/python'
,
executable
=
self
.
non_ascii_exe
)
assert
candidate
==
'#!%s -x
\
n
'
%
self
.
non_ascii_exe
candidate
=
get_script_header
(
'#!/usr/bin/python'
,
executable
=
self
.
exe_with_spaces
)
assert
candidate
==
'#!"%s"
\
n
'
%
self
.
exe_with_spaces
def
test_get_script_header_jython_workaround
(
self
):
# This test doesn't work with Python 3 in some locales
if
six
.
PY3
and
os
.
environ
.
get
(
"LC_CTYPE"
)
in
(
None
,
"C"
,
"POSIX"
):
return
class
java
:
class
lang
:
class
System
:
@
staticmethod
def
getProperty
(
property
):
return
""
sys
.
modules
[
"java"
]
=
java
platform
=
sys
.
platform
sys
.
platform
=
'java1.5.0_13'
stdout
,
stderr
=
sys
.
stdout
,
sys
.
stderr
try
:
# A mock sys.executable that uses a shebang line (this file)
exe
=
os
.
path
.
normpath
(
os
.
path
.
splitext
(
__file__
)[
0
]
+
'.py'
)
assert
(
get_script_header
(
'#!/usr/local/bin/python'
,
executable
=
exe
)
==
'#!/usr/bin/env %s
\
n
'
%
exe
)
# Ensure we generate what is basically a broken shebang line
# when there's options, with a warning emitted
sys
.
stdout
=
sys
.
stderr
=
six
.
StringIO
()
candidate
=
get_script_header
(
'#!/usr/bin/python -x'
,
executable
=
exe
)
assert
candidate
==
'#!%s -x
\
n
'
%
exe
assert
'Unable to adapt shebang line'
in
sys
.
stdout
.
getvalue
()
sys
.
stdout
=
sys
.
stderr
=
six
.
StringIO
()
candidate
=
get_script_header
(
'#!/usr/bin/python'
,
executable
=
self
.
non_ascii_exe
)
assert
candidate
==
'#!%s -x
\
n
'
%
self
.
non_ascii_exe
assert
'Unable to adapt shebang line'
in
sys
.
stdout
.
getvalue
()
finally
:
del
sys
.
modules
[
"java"
]
sys
.
platform
=
platform
sys
.
stdout
,
sys
.
stderr
=
stdout
,
stderr
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