Commits

Mike Bayer committed c0945d2

- add in-place py3k compat

  • Participants
  • Parent commits 5aef7b7

Comments (0)

Files changed (7)

dogpile/core/__init__.py

-from dogpile import Dogpile, SyncReaderDogpile, NeedRegenerationException
-from nameregistry import NameRegistry
-from readwrite_lock import ReadWriteMutex
+from .dogpile import Dogpile, SyncReaderDogpile, NeedRegenerationException
+from .nameregistry import NameRegistry
+from .readwrite_lock import ReadWriteMutex
 
 __all__ = 'Dogpile', 'SyncReaderDogpile', 'NeedRegenerationException', 'NameRegistry', 'ReadWriteMutex'
 

dogpile/core/dogpile.py

-from util import threading
+from .util import threading
 import time
 import logging
-from readwrite_lock import ReadWriteMutex
+from .readwrite_lock import ReadWriteMutex
 
 log = logging.getLogger(__name__)
 

dogpile/core/nameregistry.py

-from util import threading
+from .util import threading
 import weakref
 
 class NameRegistry(object):

dogpile/core/readwrite_lock.py

-from util import threading
+from .util import threading
 
 import logging
 log = logging.getLogger(__name__)

dogpile/core/util.py

+import sys
+py3k = sys.version_info >= (3, 0)
+
 try:
     import threading
-    import thread
 except ImportError:
     import dummy_threading as threading
-    import dummy_thread as thread
 
 
 from setuptools import setup, find_packages
 
-extra = {}
-if sys.version_info >= (3, 0):
-    extra.update(
-        use_2to3=True,
-    )
-
 v = open(os.path.join(os.path.dirname(__file__), 'dogpile', 'core', '__init__.py'))
 VERSION = re.compile(r".*__version__ = '(.*?)'", re.S).match(v.read()).group(1)
 v.close()
       install_requires=[],
       test_suite='nose.collector',
       tests_require=['nose'],
-      **extra
 )

tests/core/test_nameregistry.py

         }
 
         def do_something(name):
-            for iteration in xrange(20):
-                name = baton.keys()[random.randint(0, 2)]
+            for iteration in range(20):
+                name = list(baton)[random.randint(0, 2)]
                 lock = registry.get(name)
                 lock.acquire()
                 try: