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

Delta Between Two Patch Sets: Lib/distutils/tests/support.py

Issue 3871: cross and native build of python for mingw32 with distutils
Left Patch Set: Created 9 years, 6 months ago
Right Patch Set: Created 7 years, 2 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:
Right: Side by side diff | Download
« no previous file with change/comment | « Lib/distutils/sysconfig.py ('k') | Lib/distutils/tests/test_bdist_msi.py » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
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 from test.support import SAVEDCWD as _test_SAVEDCWD
9 10
10 from distutils import log 11 from distutils import log
11 from distutils.log import DEBUG, INFO, WARN, ERROR, FATAL 12 from distutils.log import DEBUG, INFO, WARN, ERROR, FATAL
12 from distutils.core import Distribution 13 from distutils.core import Distribution
13 14
14 15
15 class LoggingSilencer(object): 16 class LoggingSilencer(object):
16 17
17 def setUp(self): 18 def setUp(self):
18 super().setUp() 19 super().setUp()
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 os.path.join(srcdir, '..', '..', '..', 'Modules', 'xxmodule.c'), 169 os.path.join(srcdir, '..', '..', '..', 'Modules', 'xxmodule.c'),
169 ] 170 ]
170 for path in candidates: 171 for path in candidates:
171 if os.path.exists(path): 172 if os.path.exists(path):
172 return path 173 return path
173 174
174 175
175 def fixup_build_ext(cmd): 176 def fixup_build_ext(cmd):
176 """Function needed to make build_ext tests pass. 177 """Function needed to make build_ext tests pass.
177 178
178 When Python was built with --enable-shared on Unix, -L. is not enough to 179 When Python was built with --enable-shared on Posix, -L. is not enough to
179 find libpython<blah>.so, because regrtest runs in a tempdir, not in the 180 find libpython<blah>.so, because regrtest runs in a tempdir, not in the
180 source directory where the .so lives. 181 build directory where the .so lives.
181 182
182 When Python was built with in debug mode on Windows, build_ext commands 183 When Python was built with in debug mode on Windows, build_ext commands
183 need their debug attribute set, and it is not done automatically for 184 need their debug attribute set, and it is not done automatically for
184 some reason. 185 some reason.
185 186
186 This function handles both of these things. Example use: 187 This function handles both of these things. Example use:
187 188
188 cmd = build_ext(dist) 189 cmd = build_ext(dist)
189 support.fixup_build_ext(cmd) 190 support.fixup_build_ext(cmd)
190 cmd.ensure_finalized() 191 cmd.ensure_finalized()
191 192
192 Unlike most other Unix platforms, Mac OS X embeds absolute paths 193 Unlike most other Unix platforms, Mac OS X embeds absolute paths
193 to shared libraries into executables, so the fixup is not needed there. 194 to shared libraries into executables, so the fixup is not needed there.
194 """ 195 """
195 if os.name == 'nt': 196 if os.name == 'nt':
196 cmd.debug = sys.executable.endswith('_d.exe') 197 cmd.debug = sys.executable.endswith('_d.exe')
198 if (sys.version.find("GCC") >= 0 and
199 sysconfig.get_config_var('Py_ENABLE_SHARED')):
200 if cmd.library_dirs is None:
201 cmd.library_dirs = []
202 cmd.library_dirs.insert(0, _test_SAVEDCWD)
197 elif sysconfig.get_config_var('Py_ENABLE_SHARED'): 203 elif sysconfig.get_config_var('Py_ENABLE_SHARED'):
198 # To further add to the shared builds fun on Unix, we can't just add 204 # To further add to the shared builds fun on Unix, we can't just add
199 # library_dirs to the Extension() instance because that doesn't get 205 # library_dirs to the Extension() instance because that doesn't get
200 # plumbed through to the final compiler command. 206 # plumbed through to the final compiler command.
201 runshared = sysconfig.get_config_var('RUNSHARED') 207 runshared = sysconfig.get_config_var('RUNSHARED')
202 if runshared is None: 208 if runshared is None:
203 cmd.library_dirs = ['.'] 209 cmd.library_dirs = ['.']
204 else: 210 else:
205 if sys.platform == 'darwin': 211 if sys.platform == 'darwin':
206 cmd.library_dirs = [] 212 cmd.library_dirs = []
207 else: 213 else:
208 name, equals, value = runshared.partition('=') 214 name, equals, value = runshared.partition('=')
209 cmd.library_dirs = value.split(os.pathsep) 215 cmd.library_dirs = value.split(os.pathsep)
LEFTRIGHT

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+