[Python-bugs-list] [ python-Bugs-597604 ] import cycle in distutils
noreply@sourceforge.net
noreply@sourceforge.net
Fri, 06 Sep 2002 15:18:50 -0700
Bugs item #597604, was opened at 2002-08-20 00:59
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=597604&group_id=5470
Category: Distutils
>Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Andrew Dalke (dalke)
>Assigned to: Jeremy Hylton (jhylton)
Summary: import cycle in distutils
Initial Comment:
There is a import cycle in distutils which causes
4Suite's setup.py
to fail. Here's the reproducible, using 2.3a0 from CVS
(latest
updated on 18 Aug)
% python
Python 2.3a0 (#3, Aug 19 2002, 01:46:45)
[GCC 2.96 20000731 (Red Hat Linux 7.1 2.96-98)] on linux2
Type "help", "copyright", "credits" or "license" for
more information.
>>> from distutils import dist
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/local/lib/python2.3/distutils/dist.py",
line 19, in ?
from distutils.core import DEBUG
File "/usr/local/lib/python2.3/distutils/core.py",
line 24, in ?
from distutils.dist import Distribution
ImportError: cannot import name Distribution
>>>
However, I *can* do the following
% python
Python 2.3a0 (#3, Aug 19 2002, 01:46:45)
[GCC 2.96 20000731 (Red Hat Linux 7.1 2.96-98)] on linux2
Type "help", "copyright", "credits" or "license" for
more information.
>>> from distutils import core
>>> from distutils import dist
>>>
This doesn't exist in Python 2.2.
The cycle is obvious -- 'dist' imports 'core' imports
DEBUG from 'dist'.
I tried replacing things with
from distutils import core
and using core.DEBUG instead of DEBUG, but that
caused a problem with Python's install. Hence, no
patch included.
----------------------------------------------------------------------
>Comment By: Neal Norwitz (nnorwitz)
Date: 2002-09-06 18:18
Message:
Logged In: YES
user_id=33168
Jeremy, it looks like this was introduced with your change
on 04-Jun-02. If dist.py:19 (from distutils.core import
DEBUG) is moved down after the Distribution class, I think
this problem would be fixed. Can also move the import into
the 3 methods where it's used.
DEBUG is used in 3 Distribution methods:
parse_config_files, get_command_obj, and _set_command_options.
Jeremy, if this is a reasonable change, assign back to me
and let me know how best to fix it.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=597604&group_id=5470