aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGES.txt2
-rw-r--r--distribute.egg-info/entry_points.txt3
-rw-r--r--pkg_resources.py7
-rwxr-xr-xsetuptools/command/install_scripts.py4
-rw-r--r--setuptools/command/test.py6
-rw-r--r--setuptools/command/upload_docs.py6
-rwxr-xr-xsetuptools/sandbox.py19
-rw-r--r--setuptools/tests/test_easy_install.py10
-rw-r--r--setuptools/tests/test_sandbox.py11
-rw-r--r--setuptools/tests/test_upload_docs.py22
10 files changed, 54 insertions, 36 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index b347ae94..eec6a3da 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -6,7 +6,7 @@ CHANGES
0.6.12
------
-*
+* Issue 149: Fixed various failures on 2.3/2.4
------
0.6.11
diff --git a/distribute.egg-info/entry_points.txt b/distribute.egg-info/entry_points.txt
index 1c9f123d..3b205225 100644
--- a/distribute.egg-info/entry_points.txt
+++ b/distribute.egg-info/entry_points.txt
@@ -8,6 +8,7 @@ saveopts = setuptools.command.saveopts:saveopts
egg_info = setuptools.command.egg_info:egg_info
register = setuptools.command.register:register
upload_docs = setuptools.command.upload_docs:upload_docs
+upload = setuptools.command.upload:upload
install_egg_info = setuptools.command.install_egg_info:install_egg_info
alias = setuptools.command.alias:alias
easy_install = setuptools.command.easy_install:easy_install
@@ -32,7 +33,7 @@ depends.txt = setuptools.command.egg_info:warn_depends_obsolete
[console_scripts]
easy_install = setuptools.command.easy_install:main
-easy_install-2.6 = setuptools.command.easy_install:main
+easy_install-2.3 = setuptools.command.easy_install:main
[setuptools.file_finders]
svn_cvs = setuptools.command.sdist:_default_revctrl
diff --git a/pkg_resources.py b/pkg_resources.py
index 6d96f5c2..6ec51fa0 100644
--- a/pkg_resources.py
+++ b/pkg_resources.py
@@ -191,9 +191,10 @@ def _macosx_vers(_cache=[]):
import plistlib
plist = '/System/Library/CoreServices/SystemVersion.plist'
if os.path.exists(plist):
- plist_content = plistlib.readPlist(plist)
- if 'ProductVersion' in plist_content:
- version = plist_content['ProductVersion']
+ if hasattr(plistlib, 'readPlist'):
+ plist_content = plistlib.readPlist(plist)
+ if 'ProductVersion' in plist_content:
+ version = plist_content['ProductVersion']
_cache.append(version.split('.'))
return _cache[0]
diff --git a/setuptools/command/install_scripts.py b/setuptools/command/install_scripts.py
index ac797883..6ce1b993 100755
--- a/setuptools/command/install_scripts.py
+++ b/setuptools/command/install_scripts.py
@@ -12,8 +12,8 @@ class install_scripts(_install_scripts):
self.no_ep = False
def run(self):
- from setuptools.command.easy_install import (get_script_args,
- sys_executable)
+ from setuptools.command.easy_install import get_script_args
+ from setuptools.command.easy_install import sys_executable
self.run_command("egg_info")
if self.distribution.scripts:
diff --git a/setuptools/command/test.py b/setuptools/command/test.py
index b7aef969..0399f5bf 100644
--- a/setuptools/command/test.py
+++ b/setuptools/command/test.py
@@ -31,7 +31,11 @@ class ScanningLoader(TestLoader):
submodule = module.__name__+'.'+file
else:
continue
- tests.append(self.loadTestsFromName(submodule))
+ try:
+ tests.append(self.loadTestsFromName(submodule))
+ except Exception, e:
+ import pdb; pdb.set_trace()
+ self.loadTestsFromName(submodule)
if len(tests)!=1:
return self.suiteClass(tests)
diff --git a/setuptools/command/upload_docs.py b/setuptools/command/upload_docs.py
index ea2bad7e..213f7b58 100644
--- a/setuptools/command/upload_docs.py
+++ b/setuptools/command/upload_docs.py
@@ -16,7 +16,11 @@ import sys
from distutils import log
from distutils.errors import DistutilsOptionError
-from distutils.command.upload import upload
+
+try:
+ from distutils.command.upload import upload
+except ImportError:
+ from setuptools.command.upload import upload
_IS_PYTHON3 = sys.version > '3'
diff --git a/setuptools/sandbox.py b/setuptools/sandbox.py
index 630d5792..13cbe109 100755
--- a/setuptools/sandbox.py
+++ b/setuptools/sandbox.py
@@ -152,13 +152,18 @@ class AbstractSandbox:
)
-_EXCEPTIONS = [os.devnull,]
+if hasattr(os, 'devnull'):
+ _EXCEPTIONS = [os.devnull,]
+else:
+ _EXCEPTIONS = []
-try:
- gen_py = os.path.dirname(__import__('win32com.gen_py', fromlist=['__name__']).__file__)
- _EXCEPTIONS.append(gen_py)
-except ImportError:
- pass
+if not sys.version < '2.5':
+ try:
+ gen_py = os.path.dirname(__import__('win32com.gen_py',
+ fromlist=['__name__']).__file__)
+ _EXCEPTIONS.append(gen_py)
+ except ImportError:
+ pass
class DirectorySandbox(AbstractSandbox):
"""Restrict operations to a single subdirectory - pseudo-chroot"""
@@ -204,7 +209,7 @@ class DirectorySandbox(AbstractSandbox):
def _exempted(self, filepath):
exception_matches = map(filepath.startswith, self._exceptions)
- return any(exception_matches)
+ return False not in exception_matches
def _remap_input(self,operation,path,*args,**kw):
"""Called for path inputs"""
diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py
index f2655d75..e02798c6 100644
--- a/setuptools/tests/test_easy_install.py
+++ b/setuptools/tests/test_easy_install.py
@@ -122,19 +122,19 @@ class TestEasyInstallTest(unittest.TestCase):
class TestPTHFileWriter(unittest.TestCase):
def test_add_from_cwd_site_sets_dirty(self):
- '''a pth file manager should set dirty
+ '''a pth file manager should set dirty
if a distribution is in site but also the cwd
'''
pth = PthDistributions('does-not_exist', [os.getcwd()])
- self.assertFalse(pth.dirty)
+ self.assert_(not pth.dirty)
pth.add(PRDistribution(os.getcwd()))
- self.assertTrue(pth.dirty)
+ self.assert_(pth.dirty)
def test_add_from_site_is_ignored(self):
pth = PthDistributions('does-not_exist', ['/test/location/does-not-have-to-exist'])
- self.assertFalse(pth.dirty)
+ self.assert_(not pth.dirty)
pth.add(PRDistribution('/test/location/does-not-have-to-exist'))
- self.assertFalse(pth.dirty)
+ self.assert_(not pth.dirty)
class TestUserInstallTest(unittest.TestCase):
diff --git a/setuptools/tests/test_sandbox.py b/setuptools/tests/test_sandbox.py
index 8b9e08e6..1609ee86 100644
--- a/setuptools/tests/test_sandbox.py
+++ b/setuptools/tests/test_sandbox.py
@@ -30,10 +30,11 @@ class TestSandbox(unittest.TestCase):
shutil.rmtree(self.dir)
def test_devnull(self):
+ if sys.version < '2.4':
+ return
sandbox = DirectorySandbox(self.dir)
sandbox.run(self._file_writer(os.devnull))
- @staticmethod
def _file_writer(path):
def do_write():
f = open(path, 'w')
@@ -41,6 +42,7 @@ class TestSandbox(unittest.TestCase):
f.close()
return do_write
+ _file_writer = staticmethod(_file_writer)
if has_win32com():
def test_win32com(self):
@@ -53,9 +55,10 @@ class TestSandbox(unittest.TestCase):
target = os.path.join(gen_py, 'test_write')
sandbox = DirectorySandbox(self.dir)
try:
- sandbox.run(self._file_writer(target))
- except SandboxViolation:
- self.fail("Could not create gen_py file due to SandboxViolation")
+ try:
+ sandbox.run(self._file_writer(target))
+ except SandboxViolation:
+ self.fail("Could not create gen_py file due to SandboxViolation")
finally:
if os.path.exists(target): os.remove(target)
diff --git a/setuptools/tests/test_upload_docs.py b/setuptools/tests/test_upload_docs.py
index 15db899f..8b2dc892 100644
--- a/setuptools/tests/test_upload_docs.py
+++ b/setuptools/tests/test_upload_docs.py
@@ -19,24 +19,24 @@ class TestUploadDocsTest(unittest.TestCase):
f.close()
self.old_cwd = os.getcwd()
os.chdir(self.dir)
-
+
self.upload_dir = os.path.join(self.dir, 'build')
os.mkdir(self.upload_dir)
-
+
# A test document.
f = open(os.path.join(self.upload_dir, 'index.html'), 'w')
f.write("Hello world.")
f.close()
-
+
# An empty folder.
os.mkdir(os.path.join(self.upload_dir, 'empty'))
-
+
if sys.version >= "2.6":
self.old_base = site.USER_BASE
site.USER_BASE = upload_docs.USER_BASE = tempfile.mkdtemp()
self.old_site = site.USER_SITE
site.USER_SITE = upload_docs.USER_SITE = tempfile.mkdtemp()
-
+
def tearDown(self):
os.chdir(self.old_cwd)
shutil.rmtree(self.dir)
@@ -49,17 +49,17 @@ class TestUploadDocsTest(unittest.TestCase):
def test_create_zipfile(self):
# Test to make sure zipfile creation handles common cases.
# This explicitly includes a folder containing an empty folder.
-
+
dist = Distribution()
-
+
cmd = upload_docs(dist)
cmd.upload_dir = self.upload_dir
zip_file = cmd.create_zipfile()
-
+
assert zipfile.is_zipfile(zip_file)
-
+
zip_f = zipfile.ZipFile(zip_file) # woh...
-
+
assert zip_f.namelist() == ['index.html']
-
+