diff options
-rw-r--r-- | pkg_resources.py | 45 | ||||
-rw-r--r-- | setuptools/tests/test_resources.py | 8 |
2 files changed, 48 insertions, 5 deletions
diff --git a/pkg_resources.py b/pkg_resources.py index 4cf81d7b..bfe92e3a 100644 --- a/pkg_resources.py +++ b/pkg_resources.py @@ -14,10 +14,31 @@ method. """ import sys, os, zipimport, time, re, imp, new -from sets import ImmutableSet + +try: + frozenset +except NameError: + from sets import ImmutableSet as frozenset + from os import utime, rename, unlink # capture these to bypass sandboxing from os import open as os_open + + + + + + + + + + + + + + + + def get_supported_platform(): """Return this platform's maximum compatible version. @@ -39,6 +60,26 @@ def get_supported_platform(): pass # not Mac OS X return plat + + + + + + + + + + + + + + + + + + + + __all__ = [ # Basic resource access and distribution/entry point discovery 'require', 'run_script', 'get_provider', 'get_distribution', @@ -2387,7 +2428,7 @@ class Requirement: self.index, self.extras = index, tuple(map(safe_extra,extras)) self.hashCmp = ( self.key, tuple([(op,parsed) for parsed,trans,op,ver in index]), - ImmutableSet(self.extras) + frozenset(self.extras) ) self.__hash = hash(self.hashCmp) diff --git a/setuptools/tests/test_resources.py b/setuptools/tests/test_resources.py index a4b20de1..1b15a9eb 100644 --- a/setuptools/tests/test_resources.py +++ b/setuptools/tests/test_resources.py @@ -1,7 +1,10 @@ from unittest import TestCase, makeSuite from pkg_resources import * import pkg_resources, sys -from sets import ImmutableSet +try: + frozenset +except NameError: + from sets import ImmutableSet as frozenset class Metadata(EmptyProvider): """Mock object to return metadata as if from an on-disk distribution""" @@ -18,7 +21,6 @@ class Metadata(EmptyProvider): def get_metadata_lines(self,name): return yield_lines(self.get_metadata(name)) - class DistroTests(TestCase): def testCollection(self): @@ -337,7 +339,7 @@ class RequirementsTests(TestCase): self.assertEqual(hash(r1), hash(r2)) self.assertEqual( hash(r1), hash(("twisted", ((">=",parse_version("1.2")),), - ImmutableSet(["foo","bar"]))) + frozenset(["foo","bar"]))) ) def testVersionEquality(self): |