[Distutils] Distutils changes for PEP 250

Paul Moore gustav@morpheus.demon.co.uk
Sat Jul 21 12:18:03 2001


I think there's now been enough time to ensure that no further issues are=
 going
to come out. I therefore enclose a patch, which should, I believe, =
capture all
the issues.

Note:

1. It is against the CVS version of distutils, as on 21/07/2001. (I found=
 a way
of getting CVS to work for me. Yay!) There are no changes needed to core =
Python,
as the site.py change needed is in 2.2a1.

2. It covers Fred's issue of backward compatibility, by testing for =
sys.version
being 2.2 or greater - otherwise the old behaviour is retained.

3. It does nothing for platforms other than Windows. I'll leave the =
Unix/Mac
experts to decide if they want changes on their platforms.

4. I've tested it (relatively) minimally. It does install into =
site-packages
with the 'install' command. (And as expected, it doesn't on Python 2.1 - =
until
you remember to change the '2.2' to '2.1' in the code so that you can =
test it
:-))

All that this needs is for someone to approve and apply this patch. =
Thomas?
Would you be willing, given that you have made the necessary changes to =
the
Windows Installer to match this?

Thanks to all for the feedback. I've learned a lot, about distutils and =
the PEP
process. I don't think I'll be so free with my "why doesn't Python do =
XXX"
comments in future... (Maybe :-))

I'll go off and update the PEP now, to reflect what is (hopefully) the =
final
resolution.

Paul.

diff -u sysconfig.py.orig sysconfig.py
--- sysconfig.py.orig	Wed Jul 18 19:39:56 2001
+++ sysconfig.py	Sat Jul 21 16:38:36 2001
@@ -93,7 +93,10 @@
         if standard_lib:
             return os.path.join(PREFIX, "Lib")
         else:
-            return prefix
+            if sys.version < "2.2":
+                return prefix
+            else:
+                return os.path.join(PREFIX, "Lib", "site-packages")
=20
     elif os.name =3D=3D "mac":
         if plat_specific:
diff -u command\install.py.orig command\install.py
--- command\install.py.orig	Tue Jan 16 16:16:03 2001
+++ command\install.py	Sat Jul 21 16:41:15 2001
@@ -15,6 +15,23 @@
 from distutils.errors import DistutilsOptionError
 from glob import glob
=20
+if sys.version < "2.2":
+    WINDOWS_SCHEME =3D {
+        'purelib': '$base',
+        'platlib': '$base',
+        'headers': '$base/Include/$dist_name',
+        'scripts': '$base/Scripts',
+        'data'   : '$base',
+    }
+else:
+    WINDOWS_SCHEME =3D {
+        'purelib': '$base/Lib/site-packages',
+        'platlib': '$base/Lib/site-packages',
+        'headers': '$base/Include/$dist_name',
+        'scripts': '$base/Scripts',
+        'data'   : '$base',
+    }
+
 INSTALL_SCHEMES =3D {
     'unix_prefix': {
         'purelib': '$base/lib/python$py_version_short/site-packages',
@@ -30,13 +47,7 @@
         'scripts': '$base/bin',
         'data'   : '$base',
         },
-    'nt': {
-        'purelib': '$base',
-        'platlib': '$base',
-        'headers': '$base/Include/$dist_name',
-        'scripts': '$base/Scripts',
-        'data'   : '$base',
-        },
+    'nt': WINDOWS_SCHEME,
     'mac': {
         'purelib': '$base/Lib/site-packages',
         'platlib': '$base/Lib/site-packages',