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

Moore, Paul Paul.Moore@atosorigin.com
Wed, 18 Jul 2001 15:21:03 +0100


From: Moore, Paul [mailto:Paul.Moore@atosorigin.com]
> Having waited a few days to let the dust settle, I believe that the
> following is the current state of affairs:
>
> 1. The change to site.py, to include site-packages in sys.path, is in.
> 2. The change to distutils.sysconfig to change to site-packages, is in.

Urk. I just downloaded 2.2a1, and the sysconfig.py change isn't in :-(

Attached are a couple of possible patches - one which just tweaks Windows
(os.name is 'nt' for Win9x???) and another which tries to slim down on the
platform-specific special casing, but which may have larger effects on
non-Windows platforms.

Can someone put one of these in?

Thanks,
Paul.

Trivial version of the change:

--- sysconfig.py.orig        Sat Jul 07 23:55:28 2001
+++ sysconfig.py   Wed Jul 18 15:13:45 2001
@@ -89,7 +89,7 @@
         if standard_lib:
             return os.path.join(PREFIX, "Lib")
         else:
-            return prefix
+            return os.path.join(libpython, "site-packages")

     elif os.name == "mac":
         if plat_specific:

Better version, which covers all platforms (but which removes a couple of
"OK, where DO site-specific modules go on the Mac?" errors, which may be
glossing over an issue...) is

--- sysconfig.py.orig	Sat Jul 07 23:55:28 2001
+++ sysconfig.py	Wed Jul 18 15:18:55 2001
@@ -80,35 +80,23 @@
     if os.name == "posix":
         libpython = os.path.join(prefix,
                                  "lib", "python" + sys.version[:3])
-        if standard_lib:
-            return libpython
-        else:
-            return os.path.join(libpython, "site-packages")
-
     elif os.name == "nt":
-        if standard_lib:
-            return os.path.join(PREFIX, "Lib")
-        else:
-            return prefix
-
+        libpython = os.path.join(PREFIX, "Lib")
     elif os.name == "mac":
         if plat_specific:
-            if standard_lib:
-                return os.path.join(EXEC_PREFIX, "Mac", "Plugins")
-            else:
-                raise DistutilsPlatformError, \
-                      "OK, where DO site-specific extensions go on the
Mac?"
+            libpython = os.path.join(EXEC_PREFIX, "Mac", "Plugins")
         else:
-            if standard_lib:
-                return os.path.join(PREFIX, "Lib")
-            else:
-                raise DistutilsPlatformError, \
-                      "OK, where DO site-specific modules go on the Mac?"
+            libpython = os.path.join(PREFIX, "Lib")
     else:
         raise DistutilsPlatformError, \
               ("I don't know where Python installs its library " +
                "on platform '%s'") % os.name
 
+    if standard_lib:
+        return libpython
+    else:
+        return os.path.join(libpython, "site-packages")
+
 # get_python_lib()