summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2021-04-25 20:18:25 -0400
committerJason R. Coombs <jaraco@jaraco.com>2021-04-25 20:18:25 -0400
commited288d05d4a57165c48f384e4d5316b4f8e2ac84 (patch)
tree9ba3abfb5a7dc35a8141a30bfc102c7785434e4c
parentbe0f7f5cdab66335ca3462129c8f519b3a60840e (diff)
parent7423f0767acf5f8713196c5105ece867ec9e7a55 (diff)
downloadpython-setuptools-git-ed288d05d4a57165c48f384e4d5316b4f8e2ac84.tar.gz
Merge https://github.com/pypa/distutils into distutils-refresh
-rw-r--r--setuptools/_distutils/_msvccompiler.py2
-rw-r--r--setuptools/_distutils/ccompiler.py7
-rw-r--r--setuptools/_distutils/msvc9compiler.py4
-rw-r--r--setuptools/_distutils/msvccompiler.py4
-rw-r--r--setuptools/_distutils/spawn.py16
5 files changed, 22 insertions, 11 deletions
diff --git a/setuptools/_distutils/_msvccompiler.py b/setuptools/_distutils/_msvccompiler.py
index e9af4cf5..b7a06082 100644
--- a/setuptools/_distutils/_msvccompiler.py
+++ b/setuptools/_distutils/_msvccompiler.py
@@ -248,7 +248,7 @@ class MSVCCompiler(CCompiler) :
# Future releases of Python 3.x will include all past
# versions of vcruntime*.dll for compatibility.
self.compile_options = [
- '/nologo', '/Ox', '/W3', '/GL', '/DNDEBUG', '/MD'
+ '/nologo', '/O2', '/W3', '/GL', '/DNDEBUG', '/MD'
]
self.compile_options_debug = [
diff --git a/setuptools/_distutils/ccompiler.py b/setuptools/_distutils/ccompiler.py
index 57bb94e8..b38cf261 100644
--- a/setuptools/_distutils/ccompiler.py
+++ b/setuptools/_distutils/ccompiler.py
@@ -792,6 +792,8 @@ int main (int argc, char **argv) {
objects = self.compile([fname], include_dirs=include_dirs)
except CompileError:
return False
+ finally:
+ os.remove(fname)
try:
self.link_executable(objects, "a.out",
@@ -799,6 +801,11 @@ int main (int argc, char **argv) {
library_dirs=library_dirs)
except (LinkError, TypeError):
return False
+ else:
+ os.remove("a.out")
+ finally:
+ for fn in objects:
+ os.remove(fn)
return True
def find_library_file (self, dirs, lib, debug=0):
diff --git a/setuptools/_distutils/msvc9compiler.py b/setuptools/_distutils/msvc9compiler.py
index 6934e964..a1b3b02f 100644
--- a/setuptools/_distutils/msvc9compiler.py
+++ b/setuptools/_distutils/msvc9compiler.py
@@ -399,13 +399,13 @@ class MSVCCompiler(CCompiler) :
self.preprocess_options = None
if self.__arch == "x86":
- self.compile_options = [ '/nologo', '/Ox', '/MD', '/W3',
+ self.compile_options = [ '/nologo', '/O2', '/MD', '/W3',
'/DNDEBUG']
self.compile_options_debug = ['/nologo', '/Od', '/MDd', '/W3',
'/Z7', '/D_DEBUG']
else:
# Win64
- self.compile_options = [ '/nologo', '/Ox', '/MD', '/W3', '/GS-' ,
+ self.compile_options = [ '/nologo', '/O2', '/MD', '/W3', '/GS-' ,
'/DNDEBUG']
self.compile_options_debug = ['/nologo', '/Od', '/MDd', '/W3', '/GS-',
'/Z7', '/D_DEBUG']
diff --git a/setuptools/_distutils/msvccompiler.py b/setuptools/_distutils/msvccompiler.py
index d5857cb1..2d447b85 100644
--- a/setuptools/_distutils/msvccompiler.py
+++ b/setuptools/_distutils/msvccompiler.py
@@ -283,13 +283,13 @@ class MSVCCompiler(CCompiler) :
self.preprocess_options = None
if self.__arch == "Intel":
- self.compile_options = [ '/nologo', '/Ox', '/MD', '/W3', '/GX' ,
+ self.compile_options = [ '/nologo', '/O2', '/MD', '/W3', '/GX' ,
'/DNDEBUG']
self.compile_options_debug = ['/nologo', '/Od', '/MDd', '/W3', '/GX',
'/Z7', '/D_DEBUG']
else:
# Win64
- self.compile_options = [ '/nologo', '/Ox', '/MD', '/W3', '/GS-' ,
+ self.compile_options = [ '/nologo', '/O2', '/MD', '/W3', '/GS-' ,
'/DNDEBUG']
self.compile_options_debug = ['/nologo', '/Od', '/MDd', '/W3', '/GS-',
'/Z7', '/D_DEBUG']
diff --git a/setuptools/_distutils/spawn.py b/setuptools/_distutils/spawn.py
index fc592d4a..b012d00d 100644
--- a/setuptools/_distutils/spawn.py
+++ b/setuptools/_distutils/spawn.py
@@ -40,7 +40,7 @@ def spawn(cmd, search_path=1, verbose=0, dry_run=0, env=None):
# in, protect our %-formatting code against horrible death
cmd = list(cmd)
- log.info(' '.join(cmd))
+ log.info(subprocess.list2cmdline(cmd))
if dry_run:
return
@@ -60,13 +60,17 @@ def spawn(cmd, search_path=1, verbose=0, dry_run=0, env=None):
if _cfg_target:
_cfg_target_split = [int(x) for x in _cfg_target.split('.')]
if _cfg_target:
- # ensure that the deployment target of build process is not less
- # than that used when the interpreter was built. This ensures
- # extension modules are built with correct compatibility values
+ # Ensure that the deployment target of the build process is not
+ # less than 10.3 if the interpreter was built for 10.3 or later.
+ # This ensures extension modules are built with correct
+ # compatibility values, specifically LDSHARED which can use
+ # '-undefined dynamic_lookup' which only works on >= 10.3.
cur_target = os.environ.get('MACOSX_DEPLOYMENT_TARGET', _cfg_target)
- if _cfg_target_split > [int(x) for x in cur_target.split('.')]:
+ cur_target_split = [int(x) for x in cur_target.split('.')]
+ if _cfg_target_split[:2] >= [10, 3] and cur_target_split[:2] < [10, 3]:
my_msg = ('$MACOSX_DEPLOYMENT_TARGET mismatch: '
- 'now "%s" but "%s" during configure'
+ 'now "%s" but "%s" during configure;'
+ 'must use 10.3 or later'
% (cur_target, _cfg_target))
raise DistutilsPlatformError(my_msg)
env.update(MACOSX_DEPLOYMENT_TARGET=cur_target)