Skip to content

Commit 238f5aa

Browse files
committed
merge 3.4 (#22349)
2 parents 87a2803 + df0eb95 commit 238f5aa

File tree

3 files changed

+16
-45
lines changed

3 files changed

+16
-45
lines changed

Lib/distutils/command/build_ext.py

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,7 @@
1414
from distutils.util import get_platform
1515
from distutils import log
1616

17-
# this keeps compatibility from 2.3 to 2.5
18-
if sys.version < "2.6":
19-
USER_BASE = None
20-
HAS_USER_SITE = False
21-
else:
22-
from site import USER_BASE
23-
HAS_USER_SITE = True
17+
from site import USER_BASE
2418

2519
if os.name == 'nt':
2620
from distutils.msvccompiler import get_build_version
@@ -97,14 +91,11 @@ class build_ext(Command):
9791
"list of SWIG command line options"),
9892
('swig=', None,
9993
"path to the SWIG executable"),
94+
('user', None,
95+
"add user include, library and rpath")
10096
]
10197

102-
boolean_options = ['inplace', 'debug', 'force', 'swig-cpp']
103-
104-
if HAS_USER_SITE:
105-
user_options.append(('user', None,
106-
"add user include, library and rpath"))
107-
boolean_options.append('user')
98+
boolean_options = ['inplace', 'debug', 'force', 'swig-cpp', 'user']
10899

109100
help_options = [
110101
('help-compiler', None,

Lib/distutils/sysconfig.py

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,7 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None):
151151
if standard_lib:
152152
return os.path.join(prefix, "Lib")
153153
else:
154-
if get_python_version() < "2.2":
155-
return prefix
156-
else:
157-
return os.path.join(prefix, "Lib", "site-packages")
154+
return os.path.join(prefix, "Lib", "site-packages")
158155
else:
159156
raise DistutilsPlatformError(
160157
"I don't know where Python installs its library "
@@ -244,12 +241,8 @@ def get_config_h_filename():
244241
inc_dir = _sys_home or project_base
245242
else:
246243
inc_dir = get_python_inc(plat_specific=1)
247-
if get_python_version() < '2.2':
248-
config_h = 'config.h'
249-
else:
250-
# The name of the config.h file changed in 2.2
251-
config_h = 'pyconfig.h'
252-
return os.path.join(inc_dir, config_h)
244+
245+
return os.path.join(inc_dir, 'pyconfig.h')
253246

254247

255248
def get_makefile_filename():
@@ -461,17 +454,6 @@ def _init_posix():
461454
if python_build:
462455
g['LDSHARED'] = g['BLDSHARED']
463456

464-
elif get_python_version() < '2.1':
465-
# The following two branches are for 1.5.2 compatibility.
466-
if sys.platform == 'aix4': # what about AIX 3.x ?
467-
# Linker script is in the config directory, not in Modules as the
468-
# Makefile says.
469-
python_lib = get_python_lib(standard_lib=1)
470-
ld_so_aix = os.path.join(python_lib, 'config', 'ld_so_aix')
471-
python_exp = os.path.join(python_lib, 'config', 'python.exp')
472-
473-
g['LDSHARED'] = "%s %s -bI:%s" % (ld_so_aix, g['CC'], python_exp)
474-
475457
global _config_vars
476458
_config_vars = g
477459

Lib/distutils/tests/test_build_ext.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,11 @@ def setUp(self):
3131
self.tmp_dir = self.mkdtemp()
3232
self.sys_path = sys.path, sys.path[:]
3333
sys.path.append(self.tmp_dir)
34-
if sys.version > "2.6":
35-
import site
36-
self.old_user_base = site.USER_BASE
37-
site.USER_BASE = self.mkdtemp()
38-
from distutils.command import build_ext
39-
build_ext.USER_BASE = site.USER_BASE
34+
import site
35+
self.old_user_base = site.USER_BASE
36+
site.USER_BASE = self.mkdtemp()
37+
from distutils.command import build_ext
38+
build_ext.USER_BASE = site.USER_BASE
4039

4140
def test_build_ext(self):
4241
global ALREADY_TESTED
@@ -84,11 +83,10 @@ def tearDown(self):
8483
support.unload('xx')
8584
sys.path = self.sys_path[0]
8685
sys.path[:] = self.sys_path[1]
87-
if sys.version > "2.6":
88-
import site
89-
site.USER_BASE = self.old_user_base
90-
from distutils.command import build_ext
91-
build_ext.USER_BASE = self.old_user_base
86+
import site
87+
site.USER_BASE = self.old_user_base
88+
from distutils.command import build_ext
89+
build_ext.USER_BASE = self.old_user_base
9290
super(BuildExtTestCase, self).tearDown()
9391

9492
def test_solaris_enable_shared(self):

0 commit comments

Comments
 (0)