pyodide/packages/python-dateutil/patches/dummy-thread-lock.patch

78 lines
2.3 KiB
Diff

diff -ru python-dateutil-2.7.2.orig/dateutil/tz/tz.py python-dateutil-2.7.2/dateutil/tz/tz.py
--- python-dateutil-2.7.2.orig/dateutil/tz/tz.py 2018-04-24 18:33:38.436301176 -0400
+++ python-dateutil-2.7.2/dateutil/tz/tz.py 2018-04-24 18:34:39.653365591 -0400
@@ -16,7 +16,6 @@
import six
from six import string_types
-from six.moves import _thread
from ._common import tzname_in_python2, _tzinfo
from ._common import tzrangebase, enfold
from ._common import _validate_fromutc_inputs
@@ -33,6 +32,14 @@
EPOCHORDINAL = EPOCH.toordinal()
+class _dummy_lock:
+ def __enter__(self, *args, **kwargs):
+ pass
+
+ def __exit__(self, *args, **kwargs):
+ pass
+
+
@six.add_metaclass(_TzSingleton)
class tzutc(datetime.tzinfo):
"""
@@ -1104,7 +1111,7 @@
self._comps = comps
self._cachedate = []
self._cachecomp = []
- self._cache_lock = _thread.allocate_lock()
+ self._cache_lock = _dummy_lock()
def _find_comp(self, dt):
if len(self._comps) == 1:
@@ -1407,7 +1414,7 @@
def __init__(self):
self.__instances = {}
- self._cache_lock = _thread.allocate_lock()
+ self._cache_lock = _dummy_lock()
def __call__(self, name=None):
with self._cache_lock:
diff -ur python-dateutil-2.7.2/dateutil/rrule.py python-dateutil-2.7.2.bak/dateutil/rrule.py
--- python-dateutil-2.7.2/dateutil/rrule.py 2018-03-24 11:53:31.000000000 -0400
+++ python-dateutil-2.7.2.bak/dateutil/rrule.py 2018-05-17 09:36:33.295290743 -0400
@@ -17,7 +17,20 @@
from fractions import gcd
from six import advance_iterator, integer_types
-from six.moves import _thread, range
+try:
+ from six.moves._thread import allocate_lock
+except ModuleNotFoundError:
+ class allocate_lock:
+ def locked(self):
+ return False
+
+ def release(self):
+ pass
+
+ def acquire(self):
+ pass
+
+from six.moves import range
import heapq
from ._common import weekday as weekdaybase
@@ -94,7 +107,7 @@
def __init__(self, cache=False):
if cache:
self._cache = []
- self._cache_lock = _thread.allocate_lock()
+ self._cache_lock = allocate_lock()
self._invalidate_cache()
else:
self._cache = None