[cig-commits] r18478 - in cs/merlin/branches/v1/merlin: . tests

tan2 at geodynamics.org tan2 at geodynamics.org
Fri May 27 09:52:37 PDT 2011


Author: tan2
Date: 2011-05-27 09:52:36 -0700 (Fri, 27 May 2011)
New Revision: 18478

Modified:
   cs/merlin/branches/v1/merlin/__init__.py
   cs/merlin/branches/v1/merlin/tests/test_resources.py
Log:
replaced uses of ImmutableSet with frozenset to prevent DeprecationWarning

Modified: cs/merlin/branches/v1/merlin/__init__.py
===================================================================
--- cs/merlin/branches/v1/merlin/__init__.py	2011-05-27 16:50:11 UTC (rev 18477)
+++ cs/merlin/branches/v1/merlin/__init__.py	2011-05-27 16:52:36 UTC (rev 18478)
@@ -172,9 +172,13 @@
 """
 
 import sys, os, zipimport, time, re, imp, new
-from sets import ImmutableSet
 from os import utime, rename, unlink    # capture these to bypass sandboxing
 from os import open as os_open
+try:
+    frozenset
+except NameError:
+    # For Python 2.3
+    from sets import ImmutableSet as frozenset
 
 def get_supported_platform():
     """Return this platform's maximum compatible version.
@@ -2533,7 +2537,7 @@
         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)
 

Modified: cs/merlin/branches/v1/merlin/tests/test_resources.py
===================================================================
--- cs/merlin/branches/v1/merlin/tests/test_resources.py	2011-05-27 16:50:11 UTC (rev 18477)
+++ cs/merlin/branches/v1/merlin/tests/test_resources.py	2011-05-27 16:52:36 UTC (rev 18478)
@@ -1,7 +1,10 @@
 from unittest import TestCase, makeSuite
 from merlin import *
 import merlin, 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"""
@@ -337,7 +340,7 @@
         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):



More information about the CIG-COMMITS mailing list