[Python-Dev] Dodgy code in distutils/sysconfig.py
M.-A. Lemburg
mal@lemburg.com
Tue, 09 Jul 2002 17:08:20 +0200
Michael Hudson wrote:
> I'm curious about this bit of code from Lib/distutils/sysconfig.py:
>
> ,-----------------------------------------------------------------------
> | # python_build: (Boolean) if true, we're either building Python or
> | # building an extension with an un-installed Python, so we use
> | # different (hard-wired) directories.
> |
> | argv0_path = os.path.dirname(os.path.abspath(sys.executable))
> | landmark = os.path.join(argv0_path, "Modules", "Setup")
> | if not os.path.isfile(landmark):
> | python_build = 0
> | elif os.path.isfile(os.path.join(argv0_path, "Lib", "os.py")):
> | python_build = 1
> | else:
> | python_build = os.path.isfile(os.path.join(os.path.dirname(argv0_path),
> | "Lib", "os.py"))
> | del argv0_path, landmark
> `-----------------------------------------------------------------------
>
> Well, curious is a bit weak. It's broken, and breaks (eg) the snake
> farm's builds (because that is set up to build python in a directory
> far away and over the hills from the source directory).
>
> Why isn't it just
>
> ,-----------------------------------------------------------------------
> | # python_build: (Boolean) if true, we're either building Python or
> | # building an extension with an un-installed Python, so we use
> | # different (hard-wired) directories.
> |
> | argv0_path = os.path.dirname(os.path.abspath(sys.executable))
> | landmark = os.path.join(argv0_path, "Modules", "Setup")
> |
> | python_build = os.path.isfile(landmark):
> |
> | del argv0_path, landmark
> `-----------------------------------------------------------------------
>
> ? What cases does that get wrong? I'd have changed it already, but I
> have this feeling I must be missing something.
Is Modules/Setup a landmark on all Python build platforms,
e.g. on Macs, Windows and other non-Unix platforms as well ?
--
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
_______________________________________________________________________
eGenix.com -- Makers of the Python mx Extensions: mxDateTime,mxODBC,...
Python Consulting: http://www.egenix.com/
Python Software: http://www.egenix.com/files/python/