[Distutils] Re: [Python-Dev] PEP 250: Summary of comments

Moore, Paul Paul.Moore@atosorigin.com
Wed, 18 Jul 2001 16:52:02 +0100


From: M.-A. Lemburg [mailto:mal@lemburg.com]
> (I believe that install.py would have to be told about
> sys.extinstallpath too and that it should fallback to the
> defaults given in the install schemes if it is not set.)

Hmm, browsing this a bit more, I'm getting further confused. The cause of
this is the INSTALL_SCHEMES stuff, which has a purelib/platlib distinction,
which is only used on unix_prefix (all other cases use the same value for
both of these). I can't see how sys.extinstallpath relates - I could use it
as default for both purelib and platlib, but that somewhat defeats the point
of having the two. Does this imply that sys.extinstallpath should be split
into two parts (pure & plat)? I can't comment, as this is a Unix-only thing.

This is getting silly. I feel that the correct approach is to go back to my
original stance, of *only* changing Windows behaviour - leave the Unix and
Mac camps as they are. With that in mind, sys.extinstallpath seems like an
overgeneralisation, and the attached patch does everything bar handle
bdist_wininst. The Windows Installer should then do the same thing - load
Python, and generate os.path.join(sys.prefix, "lib", "site-packages") as the
destination directory. OK, so the same thing is hard-coded in four places,
but this whole area is rife with duplicated code, and fixing that issue is
way outside the scope of PEP 250.

For the limited purpose of making site-packages appear in sys.path, and
making python setup.py install install to site-packages, the attached patch
works. I've only tested it on a simple Python module, but that's all I have
to hand. I can try some C modules tonight when I get home, but I see no
reason why they wouldn't work as well. The patch is pretty much trivial,
which (IMHO) is very much in its favour as Python 2.2a1 is already out...

Unless someone comes up with a *very strong* argument as to why I should be
going further than this, I would like to request that this goes into Python
as it stands. If someone can supply the source of the bdist_wininst
installer, I will make a corresponding change to that.

I will NOT make any changes which affect Unix, or Mac platforms. I don't
know the issues. If someone wants to supply a patch which does this, I'll be
happy to see it go in, and I am quite comfortable with it going under the
banner of PEP 250, but I will not get involved in the issues - I simply am
not qualified to comment.

Paul.

------------------------------------------------------

diff -u site.py.orig site.py
--- site.py.orig	Tue Jun 26 10:07:06 2001
+++ site.py	Wed Jul 18 16:33:37 2001
@@ -143,7 +143,7 @@
         elif os.sep == ':':
             sitedirs = [makepath(prefix, "lib", "site-packages")]
         else:
-            sitedirs = [prefix]
+            sitedirs = [prefix, makepath(prefix, "lib", "site-packages")]
         for sitedir in sitedirs:
             if os.path.isdir(sitedir):
                 addsitedir(sitedir)
diff -u distutils\sysconfig.py.orig distutils\sysconfig.py
--- distutils\sysconfig.py.orig	Thu Apr 19 10:24:24 2001
+++ distutils\sysconfig.py	Wed Jul 18 16:20:20 2001
@@ -87,7 +87,7 @@
 
     elif os.name == "nt":
         if standard_lib:
-            return os.path.join(PREFIX, "Lib")
+            return os.path.join(PREFIX, "Lib", "site-packages")
         else:
             return prefix
 
diff -u distutils\command\install.py.orig distutils\command\install.py
--- distutils\command\install.py.orig	Thu Apr 19 10:24:24 2001
+++ distutils\command\install.py	Wed Jul 18 16:29:29 2001
@@ -31,8 +31,8 @@
         'data'   : '$base',
         },
     'nt': {
-        'purelib': '$base',
-        'platlib': '$base',
+        'purelib': '$base/Lib/site-packages',
+        'platlib': '$base/Lib/site-packages',
         'headers': '$base/Include/$dist_name',
         'scripts': '$base/Scripts',
         'data'   : '$base',