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

Can someone verify this bug report and, if appropriate, apply the included patch? Thanks --

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

Andrew Kuchling wrote:
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.
I suppose this is for Thomas Heller to answer. Perhaps the bdist_wininst command relies on this.
Why is it relevant whether get_python_lib() returns a relative or an absolute path ?
...
*** 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
Distutils-SIG maillist - Distutils-SIG@python.org http://mail.python.org/mailman/listinfo/distutils-sig

On Tue, Nov 26, 2002 at 10:27:21AM +0100, M.-A. Lemburg wrote:
Why is it relevant whether get_python_lib() returns a relative or an absolute path ?
I don't think get_python_lib() ever returns a relative path, so that part of the original poster's diagnosis is incorrect. I just noticed the inconsistency in usage of prefix and PREFIX as a result.
--amk (www.amk.ca) "Such minds, Hinton, shaping infinity itself." -- Gull, in FROM HELL #2
participants (3)
-
Andrew Kuchling
-
Greg Ward
-
M.-A. Lemburg