[Distutils] fwd: Distutils.sysconfig.get_python_lib() always returns absolute path in win32.

Andrew Kuchling akuchlin@mems-exchange.org
Mon Nov 25 15:07:32 2002


De-HTMLifying...
 ...

 I browsed the bug and patch managers and didn't see any patches or
 bug reports matching what I believe to be a bug in the
 get_python_lib() function in the distutils sysconfig.py file in the
 win32 version of Python 2.2.2.  When os.name == "nt" and sys.version
 > 2.2, get_python_lib() always returns the absolute path when the
 plat_specific argument is true.  Maybe I'm showing my ignorance but
 I'm guessing that get_python_lib(1,0,'') should return the relative
 path as it does for all the other cases.

 ...

*** sysconfig.py~       Tue Oct  8 19:46:04 2002
--- sysconfig.py        Mon Nov 25 11:05:02 2002
***************
*** 110,116 ****
              if sys.version < "2.2":
                  return prefix
              else:
!                 return os.path.join(PREFIX, "Lib", "site-packages")
  
      elif os.name == "mac":
          if plat_specific:
--- 110,116 ----
              if sys.version < "2.2":
                  return prefix
              else:
!                 return os.path.join(prefix, "Lib", "site-packages")
  
      elif os.name == "mac":
          if plat_specific:

At the start of this function, there are the lines:

    if prefix is None:
        prefix = plat_specific and EXEC_PREFIX or PREFIX

So using PREFIX certainly looks incorrect; 'prefix' uses EXEC_PREFIX
or PREFIX as appropriate.  Can someone on NT please verify?

Just after the branch for os.name == "mac", the OS/2 code
also uses PREFIX:

    elif os.name == "os2":
        if standard_lib:
            return os.path.join(PREFIX, "Lib")
        else:
            return os.path.join(PREFIX, "Lib", "site-packages")

Should this be fixed, too?

--amk                                                             (www.amk.ca)
Abstraction is one of those notions that Python tosses out the window, yet
expresses very well.
      -- Gordon McMillan, 6 Jan 2000