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
7c42a077
Commit
7c42a077
authored
Jul 28, 2015
by
Robert Collins
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #23426: run_setup was broken in distutils.
Patch from Alexander Belopolsky.
parent
b40f57b6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
3 deletions
+32
-3
core.py
core.py
+2
-3
tests/test_core.py
tests/test_core.py
+30
-0
No files found.
core.py
View file @
7c42a077
...
...
@@ -204,16 +204,15 @@ def run_setup (script_name, script_args=None, stop_after="run"):
global
_setup_stop_after
,
_setup_distribution
_setup_stop_after
=
stop_after
save_argv
=
sys
.
argv
save_argv
=
sys
.
argv
.
copy
()
g
=
{
'__file__'
:
script_name
}
l
=
{}
try
:
try
:
sys
.
argv
[
0
]
=
script_name
if
script_args
is
not
None
:
sys
.
argv
[
1
:]
=
script_args
with
open
(
script_name
,
'rb'
)
as
f
:
exec
(
f
.
read
(),
g
,
l
)
exec
(
f
.
read
(),
g
)
finally
:
sys
.
argv
=
save_argv
_setup_stop_after
=
None
...
...
tests/test_core.py
View file @
7c42a077
...
...
@@ -28,6 +28,21 @@ from distutils.core import setup
setup()
"""
setup_does_nothing
=
"""
\
from distutils.core import setup
setup()
"""
setup_defines_subclass
=
"""
\
from distutils.core import setup
from distutils.command.install import install as _install
class install(_install):
sub_commands = _install.sub_commands + ['cmd']
setup(cmdclass={'install': install})
"""
class
CoreTestCase
(
support
.
EnvironGuard
,
unittest
.
TestCase
):
...
...
@@ -65,6 +80,21 @@ class CoreTestCase(support.EnvironGuard, unittest.TestCase):
distutils
.
core
.
run_setup
(
self
.
write_setup
(
setup_using___file__
))
def
test_run_setup_preserves_sys_argv
(
self
):
# Make sure run_setup does not clobber sys.argv
argv_copy
=
sys
.
argv
.
copy
()
distutils
.
core
.
run_setup
(
self
.
write_setup
(
setup_does_nothing
))
self
.
assertEqual
(
sys
.
argv
,
argv_copy
)
def
test_run_setup_defines_subclass
(
self
):
# Make sure the script can use __file__; if that's missing, the test
# setup.py script will raise NameError.
dist
=
distutils
.
core
.
run_setup
(
self
.
write_setup
(
setup_defines_subclass
))
install
=
dist
.
get_command_obj
(
'install'
)
self
.
assertIn
(
'cmd'
,
install
.
sub_commands
)
def
test_run_setup_uses_current_dir
(
self
):
# This tests that the setup script is run with the current directory
# as its own current directory; this was temporarily broken by a
...
...
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