[Python-Dev] python setup.py fails with illegal import (+ fix)
Sjoerd Mullender
sjoerd@oratrix.nl
Wed, 31 Jan 2001 21:05:06 +0100
With the current CVS version, running python setup.py as part of the
build process fails with a syntax error:
Traceback (most recent call last):
File "../setup.py", line 12, in ?
from distutils.core import Extension, setup
File "/usr/people/sjoerd/src/python/Lib/distutils/core.py", line 20, in ?
from distutils.cmd import Command
File "/usr/people/sjoerd/src/python/Lib/distutils/cmd.py", line 15, in ?
from distutils import util, dir_util, file_util, archive_util, dep_util
SyntaxError: 'from ... import *' may only occur in a module scope
The fix is to change the from ... import * that the compiler complains
about:
Index: file_util.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/distutils/file_util.py,v
retrieving revision 1.7
diff -u -c -r1.7 file_util.py
*** file_util.py 2000/09/30 17:29:35 1.7
--- file_util.py 2001/01/31 20:01:56
***************
*** 106,112 ****
# changing it (ie. it's not already a hard/soft link to src OR
# (not update) and (src newer than dst).
! from stat import *
from distutils.dep_util import newer
if not os.path.isfile(src):
--- 106,112 ----
# changing it (ie. it's not already a hard/soft link to src OR
# (not update) and (src newer than dst).
! from stat import ST_ATIME, ST_MTIME, ST_MODE, S_IMODE
from distutils.dep_util import newer
if not os.path.isfile(src):
I didn't check this in because distutils is Greg Ward's baby.
-- Sjoerd Mullender <sjoerd.mullender@oratrix.com>