amaury.forgeotdarc
2008-09-02 23:22:56 UTC
Author: amaury.forgeotdarc
Date: Wed Sep 3 01:22:56 2008
New Revision: 66172
Log:
Merged revisions 66171 via svnmerge from
svn+ssh://pythondev at svn.python.org/python/trunk
........
r66171 | amaury.forgeotdarc | 2008-09-03 01:19:56 +0200 (mer., 03 sept. 2008) | 9 lines
Issue 2975: when compiling multiple extension modules with visual studio 2008
from the same python instance, some environment variables (LIB, INCLUDE)
would grow without limit.
Tested with these statements:
distutils.ccompiler.new_compiler().initialize()
print os.environ['LIB']
But I don't know how to turn them into reliable unit tests.
........
Modified:
python/branches/py3k/ (props changed)
python/branches/py3k/Lib/distutils/msvc9compiler.py
python/branches/py3k/Misc/NEWS
Modified: python/branches/py3k/Lib/distutils/msvc9compiler.py
==============================================================================
--- python/branches/py3k/Lib/distutils/msvc9compiler.py (original)
+++ python/branches/py3k/Lib/distutils/msvc9compiler.py Wed Sep 3 01:22:56 2008
@@ -193,6 +193,17 @@
reduced_paths.append(np)
return reduced_paths
+def removeDuplicates(variable):
+ """Remove duplicate values of an environment variable.
+ """
+ oldList = variable.split(os.pathsep)
+ newList = []
+ for i in oldList:
+ if i not in newList:
+ newList.append(i)
+ newVariable = os.pathsep.join(newList)
+ return newVariable
+
def find_vcvarsall(version):
"""Find the vcvarsall.bat file
@@ -252,12 +263,12 @@
if '=' not in line:
continue
line = line.strip()
- key, value = line.split('=')
+ key, value = line.split('=', 1)
key = key.lower()
if key in interesting:
if value.endswith(os.pathsep):
value = value[:-1]
- result[key] = value
+ result[key] = removeDuplicates(value)
if len(result) != len(interesting):
raise ValueError(str(list(result.keys())))
Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS (original)
+++ python/branches/py3k/Misc/NEWS Wed Sep 3 01:22:56 2008
@@ -74,6 +74,10 @@
Extension Modules
-----------------
+- Issue #2975: When compiling several extension modules with Visual Studio 2008
+ from the same python interpreter, some environment variables would grow
+ without limit.
+
- Issue #3643: Added a few more checks to _testcapi to prevent segfaults by
exploitation of poor argument checking.
Date: Wed Sep 3 01:22:56 2008
New Revision: 66172
Log:
Merged revisions 66171 via svnmerge from
svn+ssh://pythondev at svn.python.org/python/trunk
........
r66171 | amaury.forgeotdarc | 2008-09-03 01:19:56 +0200 (mer., 03 sept. 2008) | 9 lines
Issue 2975: when compiling multiple extension modules with visual studio 2008
from the same python instance, some environment variables (LIB, INCLUDE)
would grow without limit.
Tested with these statements:
distutils.ccompiler.new_compiler().initialize()
print os.environ['LIB']
But I don't know how to turn them into reliable unit tests.
........
Modified:
python/branches/py3k/ (props changed)
python/branches/py3k/Lib/distutils/msvc9compiler.py
python/branches/py3k/Misc/NEWS
Modified: python/branches/py3k/Lib/distutils/msvc9compiler.py
==============================================================================
--- python/branches/py3k/Lib/distutils/msvc9compiler.py (original)
+++ python/branches/py3k/Lib/distutils/msvc9compiler.py Wed Sep 3 01:22:56 2008
@@ -193,6 +193,17 @@
reduced_paths.append(np)
return reduced_paths
+def removeDuplicates(variable):
+ """Remove duplicate values of an environment variable.
+ """
+ oldList = variable.split(os.pathsep)
+ newList = []
+ for i in oldList:
+ if i not in newList:
+ newList.append(i)
+ newVariable = os.pathsep.join(newList)
+ return newVariable
+
def find_vcvarsall(version):
"""Find the vcvarsall.bat file
@@ -252,12 +263,12 @@
if '=' not in line:
continue
line = line.strip()
- key, value = line.split('=')
+ key, value = line.split('=', 1)
key = key.lower()
if key in interesting:
if value.endswith(os.pathsep):
value = value[:-1]
- result[key] = value
+ result[key] = removeDuplicates(value)
if len(result) != len(interesting):
raise ValueError(str(list(result.keys())))
Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS (original)
+++ python/branches/py3k/Misc/NEWS Wed Sep 3 01:22:56 2008
@@ -74,6 +74,10 @@
Extension Modules
-----------------
+- Issue #2975: When compiling several extension modules with Visual Studio 2008
+ from the same python interpreter, some environment variables would grow
+ without limit.
+
- Issue #3643: Added a few more checks to _testcapi to prevent segfaults by
exploitation of poor argument checking.