summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-09-02 23:22:56 (GMT)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-09-02 23:22:56 (GMT)
commitd8976f12d4e20ebd6f57e11cbb775a71e35daedd (patch)
treefdaaa19827bfc798680c9f3e41b3c9baafb51d9e /Lib
parentebad7f0d47000a28e885d1808995537aa1e42727 (diff)
downloadcpython-d8976f12d4e20ebd6f57e11cbb775a71e35daedd.zip
cpython-d8976f12d4e20ebd6f57e11cbb775a71e35daedd.tar.gz
cpython-d8976f12d4e20ebd6f57e11cbb775a71e35daedd.tar.bz2
Merged revisions 66171 via svnmerge from
svn+ssh://pythondev@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. ........
Diffstat (limited to 'Lib')
-rw-r--r--Lib/distutils/msvc9compiler.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/Lib/distutils/msvc9compiler.py b/Lib/distutils/msvc9compiler.py
index fdb74ae..465013d 100644
--- a/Lib/distutils/msvc9compiler.py
+++ b/Lib/distutils/msvc9compiler.py
@@ -193,6 +193,17 @@ def normalize_and_reduce_paths(paths):
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 @@ def query_vcvarsall(version, arch="x86"):
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())))