Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2250)

Side by Side Diff: Lib/distutils/tests/support.py

Issue 12678: test_packaging and test_distutils failures under Windows
Patch Set: Created 1 year, 9 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Lib/distutils/tests/test_build_ext.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 """Support code for distutils test cases.""" 1 """Support code for distutils test cases."""
2 import os 2 import os
3 import sys 3 import sys
4 import shutil 4 import shutil
5 import tempfile 5 import tempfile
6 import unittest 6 import unittest
7 import sysconfig 7 import sysconfig
8 from copy import deepcopy 8 from copy import deepcopy
9 9
10 from distutils import log 10 from distutils import log
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 # this file is run from its parent directory, so walk up the 162 # this file is run from its parent directory, so walk up the
163 # tree to find the real srcdir 163 # tree to find the real srcdir
164 os.path.join(srcdir, '..', '..', '..', 'Modules', 'xxmodule.c'), 164 os.path.join(srcdir, '..', '..', '..', 'Modules', 'xxmodule.c'),
165 ] 165 ]
166 for path in candidates: 166 for path in candidates:
167 if os.path.exists(path): 167 if os.path.exists(path):
168 return path 168 return path
169 169
170 170
171 def fixup_build_ext(cmd): 171 def fixup_build_ext(cmd):
172 """Function needed to make build_ext tests pass on shared builds. 172 """Function needed to make build_ext tests pass.
173 173
174 When Python was build with --enable-shared, -L. is not good enough to find 174 When Python was build with --enable-shared on Unix, -L. is not good
175 the libpython<blah>.so. This is because regrtest runs it under a tempdir, 175 enough to find the libpython<blah>.so. This is because regrtest runs
176 not in the top level where the .so lives. By the time we've gotten here, 176 it under a tempdir, not in the top level where the .so lives. By the
177 Python's already been chdir'd to the tempdir. This function work arounds 177 time we've gotten here, Python's already been chdir'd to the tempdir.
178 that. Example use: 178
179 When Python was built with in debug mode on Windows, build_ext commands
180 need their debug attribute set, and it is not done automatically for
181 some reason.
182
183 This function handles both of these things. Example use:
179 184
180 cmd = build_ext(dist) 185 cmd = build_ext(dist)
181 support.fixup_build_ext(cmd) 186 support.fixup_build_ext(cmd)
182 cmd.ensure_finalized() 187 cmd.ensure_finalized()
183 """ 188 """
184 # To further add to the fun, we can't just add library_dirs to the 189 if os.name == "nt":
185 # Extension() instance because that doesn't get plumbed through to the 190 cmd.debug = sys.executable.endswith("_d.exe")
186 # final compiler command. 191 elif sysconfig.get_config_var('Py_ENABLE_SHARED'):
187 if (sysconfig.get_config_var('Py_ENABLE_SHARED') and 192 # To further add to the shared builds fun on Unix, we can't just add
188 not sys.platform.startswith('win')): 193 # library_dirs to the Extension() instance because that doesn't get
194 # plumbed through to the final compiler command.
189 runshared = sysconfig.get_config_var('RUNSHARED') 195 runshared = sysconfig.get_config_var('RUNSHARED')
190 if runshared is None: 196 if runshared is None:
191 cmd.library_dirs = ['.'] 197 cmd.library_dirs = ['.']
192 else: 198 else:
193 name, equals, value = runshared.partition('=') 199 name, equals, value = runshared.partition('=')
194 cmd.library_dirs = value.split(os.pathsep) 200 cmd.library_dirs = value.split(os.pathsep)
OLDNEW
« no previous file with comments | « no previous file | Lib/distutils/tests/test_build_ext.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld cbc36f91f3f7