|
@@ -8,8 +8,11 @@ from itertools import repeat
|
|
|
from inspect import getargspec
|
|
|
from functools import partial as curry
|
|
|
from uuid import UUID, uuid4, _uuid_generate_random
|
|
|
-import ctypes
|
|
|
import operator
|
|
|
+try:
|
|
|
+ import ctypes
|
|
|
+except ImportError:
|
|
|
+ ctypes = None
|
|
|
|
|
|
noop = lambda *args, **kwargs: None
|
|
|
|
|
@@ -46,7 +49,7 @@ def gen_unique_id():
|
|
|
For now this is provided by :func:`uuid.uuid4`.
|
|
|
"""
|
|
|
# Workaround for http://bugs.python.org/issue4607
|
|
|
- if _uuid_generate_random:
|
|
|
+ if ctypes and _uuid_generate_random:
|
|
|
buffer = ctypes.create_string_buffer(16)
|
|
|
_uuid_generate_random(buffer)
|
|
|
return str(UUID(bytes=buffer.raw))
|