[Python-Dev] Dodgy code in distutils/sysconfig.py
Jack Jansen
Jack.Jansen@cwi.nl
Wed, 10 Jul 2002 10:58:35 +0200
On Tuesday, July 9, 2002, at 04:37 , Michael Hudson wrote:
> 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
> `-----------------------------------------------------------------------
This won't work for one of the standard use cases: having multiple
"build" subdirectories of the source directory (where you build for
different platforms or some such).
And on the other question: as of a week ago setup.py is also being used
to build at least some of the MacPython extension modules. But as for
MacPython the build tree and the install tree are one and the same there
is no problem.
And as to a general solution to the problem: how about parsing the
Makefile that sits beside the interpreter? In all use cases (I think
also in your example of build directories very far away over the hills)
the Makefile will sit in the same directory as the interpreter. And the
Makefile will have the srcdir variable that points to the source
directory. And we have a makefile parser in distutils.
--
- Jack Jansen <Jack.Jansen@oratrix.com>
http://www.cwi.nl/~jack -
- If I can't dance I don't want to be part of your revolution -- Emma
Goldman -