[Python-Dev] Dodgy code in distutils/sysconfig.py
Michael Hudson
mwh@python.net
10 Jul 2002 10:56:03 +0100
Jack Jansen <Jack.Jansen@cwi.nl> writes:
> 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).
How so? It worked for my cron jobs last night, which build in this
fashion.
> 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.
Is this MacPython as built by CodeWarrior? I'm counting MacOS X as
unix when it's convenient to do so :)
> But as for MacPython the build tree and the install tree are one and
> the same there is no problem.
Don't understand, sorry.
> And as to a general solution to the problem: how about parsing the
> Makefile that sits beside the interpreter?
If there's a Modules/Setup file, that's what we do.
> 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.
So you're suggesting that we use the Makefile as the landmark instead
of Modules/Setup?
> And the Makefile will have the srcdir variable that points to the
> source directory. And we have a makefile parser in distutils.
That's in effect what happens now.
Cheers,
M.
--
I hate leaving Windows95 boxes publically accessible, so shifting
even to NT is a blessing in some ways. At least I can reboot them
remotely in a sane manner, rather than having to send them malformed
packets. -- http://bofhcam.org/journal/journal.html, 20/06/2000