Skip to content

Commit c492876

Browse files
authored
Merge pull request #2653 from pypa/distutils-refresh
Distutils refresh
2 parents 6fcad30 + be2d138 commit c492876

File tree

6 files changed

+23
-11
lines changed

6 files changed

+23
-11
lines changed

changelog.d/2653.change.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Incorporated assorted changes from pypa/distutils.

setuptools/_distutils/_msvccompiler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ def initialize(self, plat_name=None):
248248
# Future releases of Python 3.x will include all past
249249
# versions of vcruntime*.dll for compatibility.
250250
self.compile_options = [
251-
'/nologo', '/Ox', '/W3', '/GL', '/DNDEBUG', '/MD'
251+
'/nologo', '/O2', '/W3', '/GL', '/DNDEBUG', '/MD'
252252
]
253253

254254
self.compile_options_debug = [

setuptools/_distutils/ccompiler.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,13 +792,20 @@ def has_function(self, funcname, includes=None, include_dirs=None,
792792
objects = self.compile([fname], include_dirs=include_dirs)
793793
except CompileError:
794794
return False
795+
finally:
796+
os.remove(fname)
795797

796798
try:
797799
self.link_executable(objects, "a.out",
798800
libraries=libraries,
799801
library_dirs=library_dirs)
800802
except (LinkError, TypeError):
801803
return False
804+
else:
805+
os.remove("a.out")
806+
finally:
807+
for fn in objects:
808+
os.remove(fn)
802809
return True
803810

804811
def find_library_file (self, dirs, lib, debug=0):

setuptools/_distutils/msvc9compiler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,13 +399,13 @@ def initialize(self, plat_name=None):
399399

400400
self.preprocess_options = None
401401
if self.__arch == "x86":
402-
self.compile_options = [ '/nologo', '/Ox', '/MD', '/W3',
402+
self.compile_options = [ '/nologo', '/O2', '/MD', '/W3',
403403
'/DNDEBUG']
404404
self.compile_options_debug = ['/nologo', '/Od', '/MDd', '/W3',
405405
'/Z7', '/D_DEBUG']
406406
else:
407407
# Win64
408-
self.compile_options = [ '/nologo', '/Ox', '/MD', '/W3', '/GS-' ,
408+
self.compile_options = [ '/nologo', '/O2', '/MD', '/W3', '/GS-' ,
409409
'/DNDEBUG']
410410
self.compile_options_debug = ['/nologo', '/Od', '/MDd', '/W3', '/GS-',
411411
'/Z7', '/D_DEBUG']

setuptools/_distutils/msvccompiler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,13 +283,13 @@ def initialize(self):
283283

284284
self.preprocess_options = None
285285
if self.__arch == "Intel":
286-
self.compile_options = [ '/nologo', '/Ox', '/MD', '/W3', '/GX' ,
286+
self.compile_options = [ '/nologo', '/O2', '/MD', '/W3', '/GX' ,
287287
'/DNDEBUG']
288288
self.compile_options_debug = ['/nologo', '/Od', '/MDd', '/W3', '/GX',
289289
'/Z7', '/D_DEBUG']
290290
else:
291291
# Win64
292-
self.compile_options = [ '/nologo', '/Ox', '/MD', '/W3', '/GS-' ,
292+
self.compile_options = [ '/nologo', '/O2', '/MD', '/W3', '/GS-' ,
293293
'/DNDEBUG']
294294
self.compile_options_debug = ['/nologo', '/Od', '/MDd', '/W3', '/GS-',
295295
'/Z7', '/D_DEBUG']

setuptools/_distutils/spawn.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def spawn(cmd, search_path=1, verbose=0, dry_run=0, env=None):
4040
# in, protect our %-formatting code against horrible death
4141
cmd = list(cmd)
4242

43-
log.info(' '.join(cmd))
43+
log.info(subprocess.list2cmdline(cmd))
4444
if dry_run:
4545
return
4646

@@ -60,13 +60,17 @@ def spawn(cmd, search_path=1, verbose=0, dry_run=0, env=None):
6060
if _cfg_target:
6161
_cfg_target_split = [int(x) for x in _cfg_target.split('.')]
6262
if _cfg_target:
63-
# ensure that the deployment target of build process is not less
64-
# than that used when the interpreter was built. This ensures
65-
# extension modules are built with correct compatibility values
63+
# Ensure that the deployment target of the build process is not
64+
# less than 10.3 if the interpreter was built for 10.3 or later.
65+
# This ensures extension modules are built with correct
66+
# compatibility values, specifically LDSHARED which can use
67+
# '-undefined dynamic_lookup' which only works on >= 10.3.
6668
cur_target = os.environ.get('MACOSX_DEPLOYMENT_TARGET', _cfg_target)
67-
if _cfg_target_split > [int(x) for x in cur_target.split('.')]:
69+
cur_target_split = [int(x) for x in cur_target.split('.')]
70+
if _cfg_target_split[:2] >= [10, 3] and cur_target_split[:2] < [10, 3]:
6871
my_msg = ('$MACOSX_DEPLOYMENT_TARGET mismatch: '
69-
'now "%s" but "%s" during configure'
72+
'now "%s" but "%s" during configure;'
73+
'must use 10.3 or later'
7074
% (cur_target, _cfg_target))
7175
raise DistutilsPlatformError(my_msg)
7276
env.update(MACOSX_DEPLOYMENT_TARGET=cur_target)

0 commit comments

Comments
 (0)