[Python-checkins] distutils2: Synchronize sysconfig.{py, cfg} with Python 3.2.
tarek.ziade
python-checkins at python.org
Sun Sep 19 10:20:23 CEST 2010
tarek.ziade pushed d8ae6395397e to distutils2:
http://hg.python.org/distutils2/rev/d8ae6395397e
changeset: 665:d8ae6395397e
user: ?ric Araujo <merwok at netwok.org>
date: Mon Sep 06 06:08:37 2010 +0200
summary: Synchronize sysconfig.{py,cfg} with Python 3.2.
files: src/distutils2/_backport/sysconfig.cfg, src/distutils2/_backport/sysconfig.py, src/distutils2/_backport/tests/test_sysconfig.py, src/distutils2/command/build_ext.py, src/distutils2/command/install.py, src/distutils2/tests/test_install.py
diff --git a/src/distutils2/_backport/sysconfig.cfg b/src/distutils2/_backport/sysconfig.cfg
--- a/src/distutils2/_backport/sysconfig.cfg
+++ b/src/distutils2/_backport/sysconfig.cfg
@@ -100,3 +100,12 @@
include = {userbase}/include/python{py_version_short}
scripts = {userbase}/bin
data = {userbase}
+
+[osx_framework_user]
+stdlib = {userbase}/lib/python
+platstdlib = {userbase}/lib/python
+purelib = {userbase}/lib/python/site-packages
+platlib = {userbase}/lib/python/site-packages
+include = {userbase}/include
+scripts = {userbase}/bin
+data = {userbase}
diff --git a/src/distutils2/_backport/sysconfig.py b/src/distutils2/_backport/sysconfig.py
--- a/src/distutils2/_backport/sysconfig.py
+++ b/src/distutils2/_backport/sysconfig.py
@@ -4,7 +4,7 @@
import sys
import os
import re
-from os.path import pardir, abspath
+from os.path import pardir, realpath
from ConfigParser import RawConfigParser
_PREFIX = os.path.normpath(sys.prefix)
@@ -53,16 +53,21 @@
_PY_VERSION_SHORT_NO_DOT = _PY_VERSION[0] + _PY_VERSION[2]
_CONFIG_VARS = None
_USER_BASE = None
-_PROJECT_BASE = abspath(os.path.dirname(sys.executable))
+if sys.executable:
+ _PROJECT_BASE = os.path.dirname(realpath(sys.executable))
+else:
+ # sys.executable can be empty if argv[0] has been changed and Python is
+ # unable to retrieve the real program name
+ _PROJECT_BASE = realpath(os.getcwd())
if os.name == "nt" and "pcbuild" in _PROJECT_BASE[-8:].lower():
- _PROJECT_BASE = abspath(os.path.join(_PROJECT_BASE, pardir))
+ _PROJECT_BASE = realpath(os.path.join(_PROJECT_BASE, pardir))
# PC/VS7.1
if os.name == "nt" and "\\pc\\v" in _PROJECT_BASE[-10:].lower():
- _PROJECT_BASE = abspath(os.path.join(_PROJECT_BASE, pardir, pardir))
+ _PROJECT_BASE = realpath(os.path.join(_PROJECT_BASE, pardir, pardir))
# PC/AMD64
if os.name == "nt" and "\\pcbuild\\amd64" in _PROJECT_BASE[-14:].lower():
- _PROJECT_BASE = abspath(os.path.join(_PROJECT_BASE, pardir, pardir))
+ _PROJECT_BASE = realpath(os.path.join(_PROJECT_BASE, pardir, pardir))
def is_python_build():
for fn in ("Setup.dist", "Setup.local"):
@@ -74,8 +79,8 @@
if _PYTHON_BUILD:
for scheme in ('posix_prefix', 'posix_home'):
- _SCHEMES.set(scheme, 'include', '{projectbase}/Include')
- _SCHEMES.set(scheme, 'platinclude', '{srcdir}')
+ _SCHEMES.set(scheme, 'include', '{srcdir}/Include')
+ _SCHEMES.set(scheme, 'platinclude', '{projectbase}/.')
def _subst_vars(path, local_vars):
@@ -131,6 +136,15 @@
else:
return joinuser(base, "Python")
+ if sys.platform == "darwin":
+ framework = get_config_var("PYTHONFRAMEWORK")
+ if framework:
+ if env_base:
+ return env_base
+ else:
+ return joinuser("~", "Library", framework, "%d.%d" %
+ sys.version_info[:2])
+
if env_base:
return env_base
else:
@@ -184,11 +198,19 @@
done[n] = v
# do variable interpolation here
- while notdone:
- for name in notdone.keys():
+ variables = notdone.keys()
+
+ # Variables with a 'PY_' prefix in the makefile. These need to
+ # be made available without that prefix through sysconfig.
+ # Special care is needed to ensure that variable expansion works, even
+ # if the expansion uses the name without a prefix.
+ renamed_variables = ('CFLAGS', 'LDFLAGS', 'CPPFLAGS')
+
+ while len(variables) > 0:
+ for name in tuple(variables):
value = notdone[name]
m = _findvar1_rx.search(value) or _findvar2_rx.search(value)
- if m:
+ if m is not None:
n = m.group(1)
found = True
if n in done:
@@ -199,23 +221,46 @@
elif n in os.environ:
# do it like make: fall back to environment
item = os.environ[n]
+
+ elif n in renamed_variables:
+ if name.startswith('PY_') and name[3:] in renamed_variables:
+ item = ""
+
+ elif 'PY_' + n in notdone:
+ found = False
+
+ else:
+ item = str(done['PY_' + n])
+
else:
done[n] = item = ""
+
if found:
after = value[m.end():]
value = value[:m.start()] + item + after
if "$" in after:
notdone[name] = value
else:
- try: value = int(value)
+ try:
+ value = int(value)
except ValueError:
done[name] = value.strip()
else:
done[name] = value
- del notdone[name]
+ variables.remove(name)
+
+ if name.startswith('PY_') \
+ and name[3:] in renamed_variables:
+
+ name = name[3:]
+ if name not in done:
+ done[name] = value
+
+
else:
# bogus variable reference; just drop it since we can't deal
- del notdone[name]
+ variables.remove(name)
+
# save the results in the global dictionary
vars.update(done)
return vars
@@ -279,7 +324,7 @@
vars['SO'] = '.pyd'
vars['EXE'] = '.exe'
vars['VERSION'] = _PY_VERSION_SHORT_NO_DOT
- vars['BINDIR'] = os.path.dirname(os.path.abspath(sys.executable))
+ vars['BINDIR'] = os.path.dirname(realpath(sys.executable))
#
# public APIs
@@ -328,9 +373,7 @@
def get_scheme_names():
"""Returns a tuple containing the schemes names."""
- schemes = _SCHEMES.sections()
- schemes.sort()
- return tuple(schemes)
+ return tuple(sorted(_SCHEMES.sections()))
def get_path_names():
"""Returns a tuple containing the paths names."""
@@ -379,7 +422,6 @@
_CONFIG_VARS['py_version_nodot'] = _PY_VERSION[0] + _PY_VERSION[2]
_CONFIG_VARS['base'] = _PREFIX
_CONFIG_VARS['platbase'] = _EXEC_PREFIX
- _CONFIG_VARS['userbase'] = _getuserbase()
_CONFIG_VARS['projectbase'] = _PROJECT_BASE
if os.name in ('nt', 'os2'):
@@ -387,8 +429,17 @@
if os.name == 'posix':
_init_posix(_CONFIG_VARS)
+ # Setting 'userbase' is done below the call to the
+ # init function to enable using 'get_config_var' in
+ # the init-function.
+ if sys.version >= '2.6':
+ _CONFIG_VARS['userbase'] = _getuserbase()
+
if 'srcdir' not in _CONFIG_VARS:
_CONFIG_VARS['srcdir'] = _PROJECT_BASE
+ else:
+ _CONFIG_VARS['srcdir'] = realpath(_CONFIG_VARS['srcdir'])
+
# Convert srcdir into an absolute path if it appears necessary.
# Normally it is relative to the build directory. However, during
@@ -608,8 +659,7 @@
cflags = get_config_vars().get('CFLAGS')
archs = re.findall('-arch\s+(\S+)', cflags)
- archs.sort()
- archs = tuple(archs)
+ archs = tuple(sorted(set(archs)))
if len(archs) == 1:
machine = archs[0]
@@ -647,3 +697,22 @@
def get_python_version():
return _PY_VERSION_SHORT
+
+def _print_dict(title, data):
+ for index, (key, value) in enumerate(sorted(data.items())):
+ if index == 0:
+ print '%s: ' % (title)
+ print '\t%s = "%s"' % (key, value)
+
+def _main():
+ """Display all information sysconfig detains."""
+ print 'Platform: "%s"' % get_platform()
+ print 'Python version: "%s"' % get_python_version()
+ print 'Current installation scheme: "%s"' % _get_default_scheme()
+ print ''
+ _print_dict('Paths', get_paths())
+ print
+ _print_dict('Variables', get_config_vars())
+
+if __name__ == '__main__':
+ _main()
diff --git a/src/distutils2/_backport/tests/test_sysconfig.py b/src/distutils2/_backport/tests/test_sysconfig.py
--- a/src/distutils2/_backport/tests/test_sysconfig.py
+++ b/src/distutils2/_backport/tests/test_sysconfig.py
@@ -1,29 +1,30 @@
-"""Tests for 'site'.
+"""Tests for sysconfig."""
-Tests assume the initial paths in sys.path once the interpreter has begun
-executing have not been removed.
-
-"""
+import os
import sys
-import os
+import subprocess
import shutil
from copy import copy, deepcopy
from ConfigParser import RawConfigParser
+from StringIO import StringIO
-from test.test_support import run_unittest, TESTFN
+from distutils2._backport import sysconfig
+from distutils2._backport.sysconfig import (
+ _expand_globals, _expand_vars, _get_default_scheme, _subst_vars,
+ get_config_var, get_config_vars, get_path, get_paths, get_platform,
+ get_scheme_names, _main, _SCHEMES)
-import distutils2._backport.sysconfig
-from distutils2._backport.sysconfig import (get_paths, get_platform,
- get_config_vars, _expand_globals,
- get_path, get_path_names,
- _get_default_scheme, _subst_vars, _expand_vars,
- get_scheme_names, _CONFIG_FILE)
-from distutils2.tests.support import unittest
+from distutils2.tests.support import unittest, EnvironGuard
+from test.test_support import TESTFN, unlink
+try:
+ from test.test_support import skip_unless_symlink
+except ImportError:
+ skip_unless_symlink = unittest.skip(
+ 'requires test.test_support.skip_unless_symlink')
-class TestSysConfig(unittest.TestCase):
+class TestSysConfig(EnvironGuard, unittest.TestCase):
def setUp(self):
- """Make a copy of sys.path"""
super(TestSysConfig, self).setUp()
self.sys_path = sys.path[:]
self.makefile = None
@@ -39,15 +40,14 @@
self.name = os.name
self.platform = sys.platform
self.version = sys.version
+ self.maxint = sys.maxint
self.sep = os.sep
self.join = os.path.join
self.isabs = os.path.isabs
self.splitdrive = os.path.splitdrive
- self._config_vars = copy(distutils2._backport.sysconfig._CONFIG_VARS)
- self.old_environ = deepcopy(os.environ)
+ self._config_vars = copy(sysconfig._CONFIG_VARS)
def tearDown(self):
- """Restore sys.path"""
sys.path[:] = self.sys_path
if self.makefile is not None:
os.unlink(self.makefile)
@@ -59,19 +59,12 @@
os.name = self.name
sys.platform = self.platform
sys.version = self.version
+ sys.maxint = self.maxint
os.sep = self.sep
os.path.join = self.join
os.path.isabs = self.isabs
os.path.splitdrive = self.splitdrive
- distutils2._backport.sysconfig._CONFIG_VARS = copy(self._config_vars)
- for key, value in self.old_environ.items():
- if os.environ.get(key) != value:
- os.environ[key] = value
-
- for key in os.environ.keys():
- if key not in self.old_environ:
- del os.environ[key]
-
+ sysconfig._CONFIG_VARS = copy(self._config_vars)
super(TestSysConfig, self).tearDown()
def _set_uname(self, uname):
@@ -87,6 +80,10 @@
elif os.path.isdir(path):
shutil.rmtree(path)
+ # TODO use a static list or remove the test
+ #def test_get_path_names(self):
+ # self.assertEqual(get_path_names(), sysconfig._SCHEME_KEYS)
+
def test_nested_var_substitution(self):
# Assert that the {curly brace token} expansion pattern will replace
# only the inner {something} on nested expressions like {py{something}} on
@@ -101,12 +98,16 @@
scheme = get_paths()
default_scheme = _get_default_scheme()
wanted = _expand_vars(default_scheme, None)
- wanted = wanted.items()
- wanted.sort()
- scheme = scheme.items()
- scheme.sort()
+ wanted = sorted(wanted.items())
+ scheme = sorted(scheme.items())
self.assertEqual(scheme, wanted)
+ def test_get_path(self):
+ # xxx make real tests here
+ for scheme in _SCHEMES.sections():
+ for name, _ in _SCHEMES.items(scheme):
+ get_path(name, scheme)
+
def test_get_config_vars(self):
cvars = get_config_vars()
self.assertIsInstance(cvars, dict)
@@ -140,42 +141,34 @@
'\n[GCC 4.0.1 (Apple Computer, Inc. build 5341)]')
sys.platform = 'darwin'
self._set_uname(('Darwin', 'macziade', '8.11.1',
- ('Darwin Kernel Version 8.11.1: '
- 'Wed Oct 10 18:23:28 PDT 2007; '
- 'root:xnu-792.25.20~1/RELEASE_I386'), 'PowerPC'))
+ ('Darwin Kernel Version 8.11.1: '
+ 'Wed Oct 10 18:23:28 PDT 2007; '
+ 'root:xnu-792.25.20~1/RELEASE_I386'), 'PowerPC'))
os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.3'
get_config_vars()['CFLAGS'] = ('-fno-strict-aliasing -DNDEBUG -g '
'-fwrapv -O3 -Wall -Wstrict-prototypes')
- maxint = sys.maxint
- try:
- sys.maxint = 2147483647
- self.assertEqual(get_platform(), 'macosx-10.3-ppc')
- sys.maxint = 9223372036854775807
- self.assertEqual(get_platform(), 'macosx-10.3-ppc64')
- finally:
- sys.maxint = maxint
+ sys.maxint = 2147483647
+ self.assertEqual(get_platform(), 'macosx-10.3-ppc')
+ sys.maxint = 9223372036854775807
+ self.assertEqual(get_platform(), 'macosx-10.3-ppc64')
self._set_uname(('Darwin', 'macziade', '8.11.1',
- ('Darwin Kernel Version 8.11.1: '
- 'Wed Oct 10 18:23:28 PDT 2007; '
- 'root:xnu-792.25.20~1/RELEASE_I386'), 'i386'))
+ ('Darwin Kernel Version 8.11.1: '
+ 'Wed Oct 10 18:23:28 PDT 2007; '
+ 'root:xnu-792.25.20~1/RELEASE_I386'), 'i386'))
get_config_vars()['MACOSX_DEPLOYMENT_TARGET'] = '10.3'
os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.3'
get_config_vars()['CFLAGS'] = ('-fno-strict-aliasing -DNDEBUG -g '
'-fwrapv -O3 -Wall -Wstrict-prototypes')
- maxint = sys.maxint
- try:
- sys.maxint = 2147483647
- self.assertEqual(get_platform(), 'macosx-10.3-i386')
- sys.maxint = 9223372036854775807
- self.assertEqual(get_platform(), 'macosx-10.3-x86_64')
- finally:
- sys.maxint = maxint
+ sys.maxint = 2147483647
+ self.assertEqual(get_platform(), 'macosx-10.3-i386')
+ sys.maxint = 9223372036854775807
+ self.assertEqual(get_platform(), 'macosx-10.3-x86_64')
# macbook with fat binaries (fat, universal or fat64)
os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.4'
@@ -233,16 +226,62 @@
# XXX more platforms to tests here
def test_get_config_h_filename(self):
- config_h = distutils2._backport.sysconfig.get_config_h_filename()
+ config_h = sysconfig.get_config_h_filename()
self.assertTrue(os.path.isfile(config_h), config_h)
def test_get_scheme_names(self):
- wanted = ('nt', 'nt_user', 'os2', 'os2_home', 'posix_home',
- 'posix_prefix', 'posix_user')
+ wanted = ('nt', 'nt_user', 'os2', 'os2_home', 'osx_framework_user',
+ 'posix_home', 'posix_prefix', 'posix_user')
self.assertEqual(get_scheme_names(), wanted)
+ @skip_unless_symlink
+ def test_symlink(self):
+ # On Windows, the EXE needs to know where pythonXY.dll is at so we have
+ # to add the directory to the path.
+ if sys.platform == 'win32':
+ os.environ['Path'] = ';'.join((
+ os.path.dirname(sys.executable), os.environ['Path']))
+
+ # Issue 7880
+ def get(python):
+ cmd = [python, '-c',
+ 'import sysconfig; print(sysconfig.get_platform())']
+ p = subprocess.Popen(cmd, stdout=subprocess.PIPE, env=os.environ)
+ return p.communicate()
+ real = os.path.realpath(sys.executable)
+ link = os.path.abspath(TESTFN)
+ os.symlink(real, link)
+ try:
+ self.assertEqual(get(real), get(link))
+ finally:
+ unlink(link)
+
+ @unittest.skipIf(sys.version < '2.6', 'requires Python 2.6 or higher')
+ def test_user_similar(self):
+ # Issue 8759 : make sure the posix scheme for the users
+ # is similar to the global posix_prefix one
+ base = get_config_var('base')
+ user = get_config_var('userbase')
+ for name in ('stdlib', 'platstdlib', 'purelib', 'platlib'):
+ global_path = get_path(name, 'posix_prefix')
+ user_path = get_path(name, 'posix_user')
+ self.assertEqual(user_path, global_path.replace(base, user))
+
+ def test_main(self):
+ # just making sure _main() runs and returns things in the stdout
+ self.addCleanup(setattr, sys, 'stdout', sys.stdout)
+ sys.stdout = StringIO()
+ _main()
+ self.assertGreater(len(sys.stdout.getvalue().split('\n')), 0)
+
+ @unittest.skipIf(sys.platform == 'win32', 'does not apply to Windows')
+ def test_ldshared_value(self):
+ ldflags = sysconfig.get_config_var('LDFLAGS')
+ ldshared = sysconfig.get_config_var('LDSHARED')
+
+ self.assertIn(ldflags, ldshared)
+
def test_expand_globals(self):
-
config = RawConfigParser()
config.add_section('globals')
config.set('globals', 'foo', 'ok')
@@ -262,9 +301,5 @@
def test_suite():
return unittest.makeSuite(TestSysConfig)
-def test_main():
- run_unittest(test_suite())
-
-if __name__ == "__main__":
- test_main()
-
+if __name__ == '__main__':
+ unittest.main(defaultTest='test_suite')
diff --git a/src/distutils2/command/build_ext.py b/src/distutils2/command/build_ext.py
--- a/src/distutils2/command/build_ext.py
+++ b/src/distutils2/command/build_ext.py
@@ -11,7 +11,8 @@
from distutils2.util import get_platform
from distutils2.core import Command
-from distutils2.errors import *
+from distutils2.errors import (CCompilerError, CompileError, DistutilsError,
+ DistutilsPlatformError, DistutilsSetupError)
from distutils2.compiler.ccompiler import customize_compiler
from distutils2.util import newer_group
from distutils2.extension import Extension
@@ -173,7 +174,8 @@
self.swig = None
self.swig_cpp = None
self.swig_opts = None
- self.user = None
+ if HAS_USER_SITE:
+ self.user = None
def finalize_options(self):
self.set_undefined_options('build',
@@ -323,7 +325,7 @@
self.swig_opts = self.swig_opts.split(' ')
# Finally add the user include and library directories if requested
- if self.user:
+ if HAS_USER_SITE and self.user:
user_include = os.path.join(USER_BASE, "include")
user_lib = os.path.join(USER_BASE, "lib")
if os.path.isdir(user_include):
diff --git a/src/distutils2/command/install.py b/src/distutils2/command/install.py
--- a/src/distutils2/command/install.py
+++ b/src/distutils2/command/install.py
@@ -18,6 +18,13 @@
from distutils2.util import convert_path, change_root, get_platform
from distutils2.errors import DistutilsOptionError
+# compatibility with 2.4 and 2.5
+if sys.version < '2.6':
+ HAS_USER_SITE = False
+else:
+ HAS_USER_SITE = True
+
+
class install(Command):
description = "install everything from build directory"
@@ -98,10 +105,10 @@
boolean_options = ['compile', 'force', 'skip-build', 'no-distinfo',
'requested', 'no-record']
- if sys.version >= '2.6':
+ if HAS_USER_SITE:
user_options.append(
('user', None,
- "install in user site-package [%s]" %
+ "install in user site-packages directory [%s]" %
get_path('purelib', '%s_user' % os.name)))
boolean_options.append('user')
@@ -114,9 +121,8 @@
self.prefix = None
self.exec_prefix = None
self.home = None
- # This attribute is used all over the place, so it's best to
- # define it even in < 2.6
- self.user = 0
+ if HAS_USER_SITE:
+ self.user = 0
# These select only the installation base; it's up to the user to
# specify the installation scheme (currently, that means supplying
@@ -135,8 +141,9 @@
self.install_lib = None # set to either purelib or platlib
self.install_scripts = None
self.install_data = None
- self.install_userbase = get_config_var('userbase')
- self.install_usersite = get_path('purelib', '%s_user' % os.name)
+ if HAS_USER_SITE:
+ self.install_userbase = get_config_var('userbase')
+ self.install_usersite = get_path('purelib', '%s_user' % os.name)
self.compile = None
self.optimize = None
@@ -216,8 +223,9 @@
raise DistutilsOptionError(
"must supply either home or prefix/exec-prefix -- not both")
- if self.user and (self.prefix or self.exec_prefix or self.home or
- self.install_base or self.install_platbase):
+ if HAS_USER_SITE and self.user and (
+ self.prefix or self.exec_prefix or self.home or
+ self.install_base or self.install_platbase):
raise DistutilsOptionError(
"can't combine user with prefix/exec_prefix/home or "
"install_base/install_platbase")
@@ -251,8 +259,8 @@
# about needing recursive variable expansion (shudder).
py_version = sys.version.split()[0]
- prefix, exec_prefix, srcdir = get_config_vars('prefix', 'exec_prefix',
- 'srcdir')
+ prefix, exec_prefix, srcdir, projectbase = get_config_vars(
+ 'prefix', 'exec_prefix', 'srcdir', 'projectbase')
metadata = self.distribution.metadata
self.config_vars = {
@@ -267,10 +275,13 @@
'sys_exec_prefix': exec_prefix,
'exec_prefix': exec_prefix,
'srcdir': srcdir,
+ 'projectbase': projectbase,
}
- self.config_vars['userbase'] = self.install_userbase
- self.config_vars['usersite'] = self.install_usersite
+ if HAS_USER_SITE:
+ self.config_vars['userbase'] = self.install_userbase
+ self.config_vars['usersite'] = self.install_usersite
+
self.expand_basedirs()
self.dump_dirs("post-expand_basedirs()")
@@ -287,7 +298,7 @@
self.dump_dirs("post-expand_dirs()")
# Create directories in the home dir:
- if self.user:
+ if HAS_USER_SITE and self.user:
self.create_home_path()
# Pick the actual directory to install all modules to: either
@@ -303,8 +314,9 @@
# Convert directories from Unix /-separated syntax to the local
# convention.
self.convert_paths('lib', 'purelib', 'platlib',
- 'scripts', 'data', 'headers',
- 'userbase', 'usersite')
+ 'scripts', 'data', 'headers')
+ if HAS_USER_SITE:
+ self.convert_paths('userbase', 'usersite')
# Well, we're not actually fully completely finalized yet: we still
# have to deal with 'extra_path', which is the hack for allowing
@@ -345,7 +357,7 @@
"installation scheme is incomplete")
return
- if self.user:
+ if HAS_USER_SITE and self.user:
if self.install_userbase is None:
raise DistutilsPlatformError(
"user base directory is not specified")
@@ -373,7 +385,7 @@
def finalize_other(self):
"""Finalize options for non-posix platforms"""
- if self.user:
+ if HAS_USER_SITE and self.user:
if self.install_userbase is None:
raise DistutilsPlatformError(
"user base directory is not specified")
@@ -486,7 +498,7 @@
def create_home_path(self):
"""Create directories under ~."""
- if not self.user:
+ if HAS_USER_SITE and not self.user:
return
home = convert_path(os.path.expanduser("~"))
for name, path in self.config_vars.iteritems():
diff --git a/src/distutils2/tests/test_install.py b/src/distutils2/tests/test_install.py
--- a/src/distutils2/tests/test_install.py
+++ b/src/distutils2/tests/test_install.py
@@ -1,11 +1,8 @@
"""Tests for distutils.command.install."""
import os
-import os.path
import sys
-import site
-from distutils2._backport import sysconfig
from distutils2._backport.sysconfig import (get_scheme_names,
get_config_vars,
_SCHEMES,
@@ -174,11 +171,12 @@
cmd.home = 'home'
self.assertRaises(DistutilsOptionError, cmd.finalize_options)
- # can't combine user with with prefix/exec_prefix/home or
- # install_(plat)base
- cmd.prefix = None
- cmd.user = 'user'
- self.assertRaises(DistutilsOptionError, cmd.finalize_options)
+ if sys.version >= '2.6':
+ # can't combine user with with prefix/exec_prefix/home or
+ # install_(plat)base
+ cmd.prefix = None
+ cmd.user = 'user'
+ self.assertRaises(DistutilsOptionError, cmd.finalize_options)
def test_record(self):
--
Repository URL: http://hg.python.org/distutils2
More information about the Python-checkins
mailing list