diff options
| -rw-r--r-- | distutils2/_backport/tests/test_sysconfig.py | 11 | ||||
| -rw-r--r-- | distutils2/command/install_data.py | 2 | ||||
| -rw-r--r-- | distutils2/compiler/bcppcompiler.py | 6 | ||||
| -rw-r--r-- | distutils2/tests/__init__.py | 8 | ||||
| -rw-r--r-- | distutils2/tests/support.py | 5 | ||||
| -rw-r--r-- | distutils2/tests/test_command_install_dist.py | 10 | ||||
| -rw-r--r-- | distutils2/tests/test_command_register.py | 12 | ||||
| -rw-r--r-- | distutils2/util.py | 22 |
8 files changed, 45 insertions, 31 deletions
diff --git a/distutils2/_backport/tests/test_sysconfig.py b/distutils2/_backport/tests/test_sysconfig.py index 32c467f..2987732 100644 --- a/distutils2/_backport/tests/test_sysconfig.py +++ b/distutils2/_backport/tests/test_sysconfig.py @@ -15,7 +15,7 @@ from distutils2._backport.sysconfig import ( get_scheme_names, _main, _SCHEMES) from distutils2.tests import unittest, TESTFN, unlink -from distutils2.tests.support import EnvironGuard +from distutils2.tests.support import EnvironRestorer from test.test_support import TESTFN, unlink try: @@ -24,7 +24,10 @@ except ImportError: skip_unless_symlink = unittest.skip( 'requires test.test_support.skip_unless_symlink') -class TestSysConfig(EnvironGuard, unittest.TestCase): + +class TestSysConfig(EnvironRestorer, unittest.TestCase): + + restore_environ = ['MACOSX_DEPLOYMENT_TARGET', 'PATH'] def setUp(self): super(TestSysConfig, self).setUp() @@ -245,8 +248,8 @@ class TestSysConfig(EnvironGuard, unittest.TestCase): # 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'])) + os.environ['PATH'] = ';'.join(( + os.path.dirname(sys.executable), os.environ['PATH'])) # Issue 7880 def get(python): diff --git a/distutils2/command/install_data.py b/distutils2/command/install_data.py index ed71450..78cb6e2 100644 --- a/distutils2/command/install_data.py +++ b/distutils2/command/install_data.py @@ -4,10 +4,10 @@ import os, sys from shutil import Error -from sysconfig import get_paths, format_value from distutils2 import logger from distutils2.util import convert_path from distutils2.command.cmd import Command +from distutils2._backport.sysconfig import get_paths, format_value class install_data(Command): diff --git a/distutils2/compiler/bcppcompiler.py b/distutils2/compiler/bcppcompiler.py index 0b764f2..d44468b 100644 --- a/distutils2/compiler/bcppcompiler.py +++ b/distutils2/compiler/bcppcompiler.py @@ -351,7 +351,5 @@ class BCPPCompiler(CCompiler) : self.mkpath(os.path.dirname(output_file)) try: self.spawn(pp_args) - except PackagingExecError: - msg = sys.exc_info()[1] - print(msg) - raise CompileError(msg) + except PackagingExecError, exc: + raise CompileError(exc) diff --git a/distutils2/tests/__init__.py b/distutils2/tests/__init__.py index 901be43..b14d349 100644 --- a/distutils2/tests/__init__.py +++ b/distutils2/tests/__init__.py @@ -16,6 +16,7 @@ Utility code is included in distutils2.tests.support. import os import sys import unittest2 as unittest +from distutils2.tests.support import TESTFN # XXX move helpers to support, add tests for them, remove things that # duplicate test.support (or keep them for the backport; needs thinking) @@ -130,3 +131,10 @@ def unload(name): del sys.modules[name] except KeyError: pass + + +def unlink(filename): + try: + os.unlink(filename) + except OSError: + pass diff --git a/distutils2/tests/support.py b/distutils2/tests/support.py index cf96d31..1134f4c 100644 --- a/distutils2/tests/support.py +++ b/distutils2/tests/support.py @@ -503,3 +503,8 @@ def unload(name): except KeyError: pass +try: + from test.test_support import skip_unless_symlink +except ImportError: + skip_unless_symlink = unittest.skip( + 'requires test.test_support.skip_unless_symlink') diff --git a/distutils2/tests/test_command_install_dist.py b/distutils2/tests/test_command_install_dist.py index 4f18720..d942860 100644 --- a/distutils2/tests/test_command_install_dist.py +++ b/distutils2/tests/test_command_install_dist.py @@ -3,17 +3,17 @@ import os import sys -from sysconfig import (get_scheme_names, get_config_vars, - _SCHEMES, get_config_var, get_path) - -_CONFIG_VARS = get_config_vars() - from distutils2.command.install_dist import install_dist from distutils2.dist import Distribution from distutils2.errors import PackagingOptionError from distutils2.tests import unittest, support +from distutils2._backport.sysconfig import ( + get_scheme_names, get_config_vars, _SCHEMES, get_config_var, get_path) + +_CONFIG_VARS = get_config_vars() + class InstallTestCase(support.TempdirManager, support.LoggingCatcher, diff --git a/distutils2/tests/test_command_register.py b/distutils2/tests/test_command_register.py index 6f6e98e..ddf606c 100644 --- a/distutils2/tests/test_command_register.py +++ b/distutils2/tests/test_command_register.py @@ -120,7 +120,7 @@ class RegisterTestCase(support.TempdirManager, # Password : 'password' # Save your login (y/N)? : 'y' inputs = Inputs('1', 'tarek', 'y') - register_module.input = inputs + register_module.raw_input = inputs cmd.ensure_finalized() cmd.run() @@ -168,7 +168,7 @@ class RegisterTestCase(support.TempdirManager, # this test runs choice 2 cmd = self._get_cmd() inputs = Inputs('2', 'tarek', 'tarek@ziade.org') - register_module.input = inputs + register_module.raw_input = inputs # let's run the command # FIXME does this send a real request? use a mock server cmd.ensure_finalized() @@ -185,7 +185,7 @@ class RegisterTestCase(support.TempdirManager, # this test runs choice 3 cmd = self._get_cmd() inputs = Inputs('3', 'tarek@ziade.org') - register_module.input = inputs + register_module.raw_input = inputs cmd.ensure_finalized() cmd.run() @@ -208,7 +208,7 @@ class RegisterTestCase(support.TempdirManager, cmd.ensure_finalized() cmd.strict = True inputs = Inputs('1', 'tarek', 'y') - register_module.input = inputs + register_module.raw_input = inputs self.assertRaises(PackagingSetupError, cmd.run) # metadata is OK but long_description is broken @@ -229,7 +229,7 @@ class RegisterTestCase(support.TempdirManager, cmd.ensure_finalized() cmd.strict = True inputs = Inputs('1', 'tarek', 'y') - register_module.input = inputs + register_module.raw_input = inputs cmd.ensure_finalized() cmd.run() @@ -237,7 +237,7 @@ class RegisterTestCase(support.TempdirManager, cmd = self._get_cmd() cmd.ensure_finalized() inputs = Inputs('1', 'tarek', 'y') - register_module.input = inputs + register_module.raw_input = inputs cmd.ensure_finalized() cmd.run() diff --git a/distutils2/util.py b/distutils2/util.py index bfb8e38..691e18a 100644 --- a/distutils2/util.py +++ b/distutils2/util.py @@ -1,34 +1,34 @@ """Miscellaneous utility functions.""" -import codecs import os import re import csv import sys import errno +import codecs import shutil import string -try: - import hashlib -except ImportError: #<2.5 - from _backport import hashlib import tarfile import zipfile import posixpath import subprocess import sysconfig -try: - from glob import iglob as std_iglob -except ImportError:#<2.5 - from glob import glob as std_iglob from fnmatch import fnmatchcase from inspect import getsource from ConfigParser import RawConfigParser +try: + from glob import iglob as std_iglob +except ImportError: + from glob import glob as std_iglob +try: + import hashlib +except ImportError: + from distutils2._backport import hashlib from distutils2 import logger from distutils2.errors import (PackagingPlatformError, PackagingFileError, - PackagingByteCompileError, PackagingExecError, - InstallationException, PackagingInternalError) + PackagingByteCompileError, PackagingExecError, + InstallationException, PackagingInternalError) _PLATFORM = None _DEFAULT_INSTALLER = 'distutils2' |
