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.

classification
Title: distutils regression related to Distribution.run_command
Type: Stage:
Components: Library (Lib) Versions: Python 2.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: pje Nosy List: akuchling, collinwinter, pje
Priority: high Keywords:

Created on 2006-07-27 17:49 by collinwinter, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (9)
msg29328 - (view) Author: Collin Winter (collinwinter) * (Python committer) Date: 2006-07-27 17:49
The following used to work in Python 2.4.x but fails
under Python 2.5:

>>> import setuptools
>>> import distutils.core
>>> distutils.core._setup_stop_after = 'config'
>>> 
>>> import setup
>>> setup.dist.run_command('test')

Where setup.dist is an instance of
distutils.core.Distribution (which setuptools replaces
with setuptools.dist.Distribution).

Under Python 2.4.x, this code would execute setuptools'
test command. Under Python 2.5b2 (as of r50855), this
code results in the following exception:

/opt/dev/python/2.5/lib/python2.5/distutils/dist.py:263:
UserWarning: Unknown distribution option: 'test_suite'
  warnings.warn(msg)
Traceback (most recent call last):
  File "test.py", line 8, in <module>
    setup.dist.run_command('test')
  File
"/opt/dev/python/2.5/lib/python2.5/distutils/dist.py",
line 992, in run_command
    cmd_obj = self.get_command_obj(command)
  File
"/opt/dev/python/2.5/lib/python2.5/distutils/dist.py",
line 868, in get_command_obj
    klass = self.get_command_class(command)
  File
"/opt/dev/python/2.5/lib/python2.5/site-packages/setuptools/dist.py",
line 357, in get_command_class
    return _Distribution.get_command_class(self, command)
  File
"/opt/dev/python/2.5/lib/python2.5/distutils/dist.py",
line 851, in get_command_class
    raise DistutilsModuleError("invalid command '%s'" %
command)
distutils.errors.DistutilsModuleError: invalid command
'test'

I'd greatly appreciate it if this regression could be
fixed before Python 2.5 is released.
msg29329 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2006-07-27 18:03
Logged In: YES 
user_id=11375

Assigned to Phillip.  I don't see any obviously relevant
changes to distutils/dist.py, but maybe this problems stems
from changes to some other module.
msg29330 - (view) Author: Collin Winter (collinwinter) * (Python committer) Date: 2006-07-27 18:18
Logged In: YES 
user_id=1344176

Forgot to mention: I've tried this with setuptools 0.6a9 and
0.6c1. Python 2.4.x (2.4.1, 2.4.2 and 2.4.3 tested) with
both setuptools version worked fine, where Python 2.5b2
fails with both.
msg29331 - (view) Author: Collin Winter (collinwinter) * (Python committer) Date: 2006-07-27 18:34
Logged In: YES 
user_id=1344176

Further testing reveals that all of setuptools' extension
commands (tested: egg_info, bdist_egg, test, rotate, alias)
are broken under Python 2.5b2, even when called from the
command line, like so:

$ python2.5 setup.py egg_info

This produces an "error: invalid command: 'egg_info'" message.
msg29332 - (view) Author: PJ Eby (pje) * (Python committer) Date: 2006-07-27 18:35
Logged In: YES 
user_id=56214

I can't reproduce this using setuptools 0.7a1 and the Python
2.5 trunk.  Please note that setuptools 0.6 does *not*
support Python 2.5; there were numerous changes needed and
there may still be additional changes needed.  Please try
using setuptools 0.7a1 and let me know what you find out. 
Thanks.
msg29333 - (view) Author: PJ Eby (pje) * (Python committer) Date: 2006-07-27 21:13
Logged In: YES 
user_id=56214

Problem source confirmed: reverting the PEP 302 breakage of
r46372 (need-for-speed import cache hack) fixes the problem.

setuptools 0.7a1 doesn't show any problems because it uses
2.5's "pkgutil" module if possible, and r46372 patches
pkgutil in a way that masks the problem, at least as far as
setuptools is concerned, for this one specific feature. 
(Other code in setuptools is affected in both 0.6 *and* 0.7,
and will require further workaround code to be written.)

msg29334 - (view) Author: Collin Winter (collinwinter) * (Python committer) Date: 2006-07-27 22:12
Logged In: YES 
user_id=1344176

I've tried using setuptools 0.7a1 in conjunction with Python
2.5b2 (r50877), and the problem still exists. setuptools'
extension commands still do not work (tested: rotate, alias,
egg_info, bdist_egg, test), that is, 'python2.5 setup.py
test' still fails with "error: invalid command 'test'".

Also, the code snippet in the bug report does not work. I am
sure Python is picking up setuptools 0.7a1 because the path
/opt/dev/python/2.5/lib/python2.5/site-packages/setuptools-0.7a1dev_r50755-py2.4.egg/setuptools/dist.py
appears in the traceback.
msg29335 - (view) Author: PJ Eby (pje) * (Python committer) Date: 2006-07-28 04:53
Logged In: YES 
user_id=56214

Um, why is there a py2.4 egg on your python 2.5 path?

Setuptools configures itself according to the Python version
it is built with, so a 2.4 egg is not going to be correctly
configured for 2.5.  I don't know if this is related to your
problem or not, but I was unable to reproduce your problem
with a setuptools 0.7a1 checkout.  I was only able to
reproduce it with setuptools 0.6.
msg29336 - (view) Author: PJ Eby (pje) * (Python committer) Date: 2006-07-28 22:04
Logged In: YES 
user_id=56214

Fixed in r50916 on the trunk.
History
Date User Action Args
2022-04-11 14:56:19adminsetgithub: 43734
2006-07-27 17:49:50collinwintercreate