summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/command
diff options
context:
space:
mode:
authorTarek Ziadé <ziade.tarek@gmail.com>2009-07-08 22:40:51 (GMT)
committerTarek Ziadé <ziade.tarek@gmail.com>2009-07-08 22:40:51 (GMT)
commit42b145d0e2f45e0744f8f45d89564f24fbc8b374 (patch)
tree8912117e6ca301ec0b74250dec0892bfbd67a831 /Lib/distutils/command
parent5fd3af24a25ff7fd6d87fb521cdd2b5f5c5d32ee (diff)
downloadcpython-42b145d0e2f45e0744f8f45d89564f24fbc8b374.zip
cpython-42b145d0e2f45e0744f8f45d89564f24fbc8b374.tar.gz
cpython-42b145d0e2f45e0744f8f45d89564f24fbc8b374.tar.bz2
Sets the compiler attribute to keep the old behavior for third-party packages.
Diffstat (limited to 'Lib/distutils/command')
-rw-r--r--Lib/distutils/command/build_ext.py22
1 files changed, 19 insertions, 3 deletions
diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py
index be37313..fadd633 100644
--- a/Lib/distutils/command/build_ext.py
+++ b/Lib/distutils/command/build_ext.py
@@ -134,13 +134,17 @@ class build_ext (Command):
def _set_compiler(self, compiler):
if not isinstance(compiler, str) and compiler is not None:
# we don't want to allow that anymore in the future
- warn("'compiler' specify the compiler type in build_ext. "
+ warn("'compiler' specifies the compiler type in build_ext. "
"If you want to get the compiler object itself, "
"use 'compiler_obj'", PendingDeprecationWarning)
-
self._compiler = compiler
def _get_compiler(self):
+ if not isinstance(self._compiler, str) and self._compiler is not None:
+ # we don't want to allow that anymore in the future
+ warn("'compiler' specifies the compiler type in build_ext. "
+ "If you want to get the compiler object itself, "
+ "use 'compiler_obj'", PendingDeprecationWarning)
return self._compiler
compiler = property(_get_compiler, _set_compiler)
@@ -343,10 +347,22 @@ class build_ext (Command):
# Setup the CCompiler object that we'll use to do all the
# compiling and linking
- self.compiler_obj = new_compiler(compiler=self.compiler,
+
+ # used to prevent the usage of an existing compiler for the
+ # compiler option when calling new_compiler()
+ # this will be removed in 3.3 and 2.8
+ if not isinstance(self._compiler, str):
+ self._compiler = None
+
+ self.compiler_obj = new_compiler(compiler=self._compiler,
verbose=self.verbose,
dry_run=self.dry_run,
force=self.force)
+
+ # used to keep the compiler object reachable with
+ # "self.compiler". this will be removed in 3.3 and 2.8
+ self._compiler = self.compiler_obj
+
customize_compiler(self.compiler_obj)
# If we are cross-compiling, init the compiler now (if we are not
# cross-compiling, init would not hurt, but people may rely on