Re: Suggestion for new directory layout for Python lib-dir.

Guido.van.Rossum@cwi.nl
Thu, 18 Aug 1994 17:06:15 +0200

> I think the general idea is good but to hardcode the architecture names
> would be bad. All that is really necessary here (I think - still new to
> python :-) is to put a ${ARCH} in the PYTHONPATH ie .../lib/python/${ARCH}
> and you are set. You just have to set ARCH='/usr/local/bin/arch' where arch
> is a local program/script on the machine that returns eg sun4 or sgi
> depending on the architecture in use. More flexible IMHO

I thought so too but it turns out that 'arch' is not enough. E.g. for
SGI, 'arch' returns 'sgi', but for many reasons you need different
subdirectories for IRIX 4 and IRIX 5. Similar for the 'sun4'
architecture (Sparc) where SunOS 4.x and Solaris 2.x are vastly
different. Part of this is an incompatible .o file format; another
problem is that many OS dependent constants (e.g. the file IN.py,
derived from <netinet/in.h>) have different values.

I could be tempted to use just the OS name+version, making
subdirectories irix4, irix5, sunos4, solaris2 (or sunos5? That's what
"uname -a" says), but some OS'es (e.g. NextStep) are supported for
multiple architectures...

It would still be a single path component for $PYTHONPATH, just
more structured, e.g. .../lib/python/sparc-sunos-5 or
.../lib/python/mips-irix-5. In general the minor OS version doesn't
make a difference here (that's why it's a minor version :-).

Assuming uname exists (the configure script can figure that out), this
can be computed as follows:

PROCESSOR=`uname -p`
SYSTEM=`uname -s | tr '[A-Z]' '[a-z]'`
RELEASE=`uname -r | sed 's/\..*//'`
SUBDIRNAME=$PROCESSOR-$SYSTEM-$RELEASE

--Guido van Rossum, CWI, Amsterdam <Guido.van.Rossum@cwi.nl>
<URL:http://www.cwi.nl/cwi/people/Guido.van.Rossum.html>