This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2015年02月09日 21:06 by belopolsky, last changed 2022年04月11日 14:58 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| setup1.py | belopolsky, 2015年02月09日 21:08 | |||
| setup.py | belopolsky, 2015年02月09日 21:12 | |||
| issue23426.patch | belopolsky, 2015年02月09日 21:14 | review | ||
| issue23426-with-tests.patch | belopolsky, 2015年02月10日 00:16 | review | ||
| Messages (5) | |||
|---|---|---|---|
| msg235632 - (view) | Author: Alexander Belopolsky (belopolsky) * (Python committer) | Date: 2015年02月09日 21:06 | |
With the following simple setup.py
$ cat setup.py
from distutils.core import setup
from distutils.command.install import install
class install1(install):
sub_commands = install.sub_commamnds
setup(name='bug', cmdclass={'install': install1})
I get
>>> from distutils.core import run_setup
>>> run_setup('setup.py')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "Lib/distutils/core.py", line 216, in run_setup
exec(f.read(), g, l)
File "<string>", line 4, in <module>
File "<string>", line 5, in install1
NameError: name 'install' is not defined
Furthermore, on an even simpler setup.py:
$ cat setup1.py
from distutils.core import setup
setup(name='bug')
run_setup runs, but clobbers sys.argv:
>>> from distutils.core import run_setup
>>> run_setup('setup1.py', script_args=['--name'])
bug
<distutils.dist.Distribution object at 0x101dddef0>
>>> import sys;sys.argv
['setup1.py', '--name']
|
|||
| msg235634 - (view) | Author: Alexander Belopolsky (belopolsky) * (Python committer) | Date: 2015年02月09日 21:14 | |
Attached patch fixes both issues. |
|||
| msg235650 - (view) | Author: Alexander Belopolsky (belopolsky) * (Python committer) | Date: 2015年02月10日 00:16 | |
Added tests. |
|||
| msg247499 - (view) | Author: Robert Collins (rbcollins) * (Python committer) | Date: 2015年07月28日 03:45 | |
The change in exec doesn't make sense to me (but see lower :)) __file__ should be in globals, not locals, right? Also if it is right, then exec(foo, g) should be equivalent :) The reset of the patch looks ok. But I can see your patch shows this breaking - I'm guessing its one of the things I keep forgetting about module scope evaluation and the import system - anyhoo. Applying to 3.6. Also looking at it the saving of argv is still broken even with your patch - the original argv is mutated, and the /name/ not the /value/ is restored. We should rebind argv to the copy, then restore the binding. But that can be done later. |
|||
| msg247500 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2015年07月28日 03:55 | |
New changeset d8950778e3c2 by Robert Collins in branch 'default': Issue #23426: run_setup was broken in distutils. https://hg.python.org/cpython/rev/d8950778e3c2 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:58:12 | admin | set | github: 67614 |
| 2015年07月28日 04:00:48 | rbcollins | set | status: open -> closed resolution: fixed stage: commit review -> resolved |
| 2015年07月28日 03:55:19 | python-dev | set | nosy:
+ python-dev messages: + msg247500 |
| 2015年07月28日 03:45:19 | rbcollins | set | nosy:
+ rbcollins messages: + msg247499 |
| 2015年02月10日 00:17:30 | belopolsky | set | stage: test needed -> commit review |
| 2015年02月10日 00:16:33 | belopolsky | set | files:
+ issue23426-with-tests.patch messages: + msg235650 stage: test needed |
| 2015年02月09日 21:14:23 | belopolsky | set | messages: + msg235634 |
| 2015年02月09日 21:14:04 | belopolsky | set | files:
+ issue23426.patch keywords: + patch |
| 2015年02月09日 21:12:26 | belopolsky | set | files: - setup.py |
| 2015年02月09日 21:12:04 | belopolsky | set | files: + setup.py |
| 2015年02月09日 21:08:04 | belopolsky | set | files: + setup1.py |
| 2015年02月09日 21:07:54 | belopolsky | set | files: + setup.py |
| 2015年02月09日 21:06:45 | belopolsky | create | |