diff --git a/arrow-py37.patch b/arrow-py37.patch new file mode 100644 index 0000000..c8f2184 --- /dev/null +++ b/arrow-py37.patch @@ -0,0 +1,74 @@ +From 48f5332dcdb821b0625c256972c82e48f791f39a Mon Sep 17 00:00:00 2001 +From: "Kristijan \"Fremen\" Velkovski" +Date: Sun, 9 Sep 2018 10:17:46 +0000 +Subject: [PATCH 1/3] Python 3.7 support. + +--- + arrow/arrow.py | 14 +++++++------- + arrow/util.py | 8 -------- + 3 files changed, 11 insertions(+), 15 deletions(-) + +diff --git a/arrow/arrow.py b/arrow/arrow.py +index c8e2606..054889f 100644 +--- a/arrow/arrow.py ++++ b/arrow/arrow.py +@@ -195,7 +195,6 @@ def strptime(cls, date_str, fmt, tzinfo=None): + # factories: ranges and spans + + @classmethod +- @util.list_to_iter_deprecation + def range(cls, frame, start, end=None, tz=None, limit=None): + ''' Returns an iterator of :class:`Arrow ` objects, representing + points in time between two inputs. +@@ -267,7 +266,6 @@ def range(cls, frame, start, end=None, tz=None, limit=None): + + + @classmethod +- @util.list_to_iter_deprecation + def span_range(cls, frame, start, end, tz=None, limit=None): + ''' Returns an iterator of tuples, each :class:`Arrow ` objects, + representing a series of timespans between two inputs. +@@ -319,7 +317,6 @@ def span_range(cls, frame, start, end, tz=None, limit=None): + return (r.span(frame) for r in _range) + + @classmethod +- @util.list_to_iter_deprecation + def interval(cls, frame, start, end, interval=1, tz=None): + ''' Returns an iterator of tuples, each :class:`Arrow ` objects, + representing a series of intervals between two inputs. +@@ -360,10 +357,13 @@ def interval(cls, frame, start, end, interval=1, tz=None): + + spanRange = iter(cls.span_range(frame, start, end, tz)) + while True: +- intvlStart, intvlEnd = next(spanRange) # StopIteration when exhausted +- for _ in range(interval-1): +- _, intvlEnd = next(spanRange) # StopIteration when exhausted +- yield intvlStart, intvlEnd ++ try: ++ intvlStart, intvlEnd = next(spanRange) ++ for _ in range(interval-1): ++ _, intvlEnd = next(spanRange) ++ yield intvlStart, intvlEnd ++ except StopIteration: ++ return + + # representations + +diff --git a/arrow/util.py b/arrow/util.py +index 088e5df..5f804c4 100644 +--- a/arrow/util.py ++++ b/arrow/util.py +@@ -99,12 +99,4 @@ def wrapper(self, *args, **kwargs): + del _wrap_method + + +-def list_to_iter_deprecation(f): +- warn_text = '{0}() will return an iterator in a future release, convert to list({0}())'.format(f.__name__) +- @functools.wraps(f) +- def wrapper(*args, **kwargs): +- return list_to_iter_shim(f(*args, **kwargs), warn_text=warn_text) +- return wrapper +- +- + __all__ = ['total_seconds', 'is_timestamp', 'isstr', 'list_to_iter_shim', 'list_to_iter_deprecation'] + diff --git a/python-arrow.changes b/python-arrow.changes index af8068d..454228c 100644 --- a/python-arrow.changes +++ b/python-arrow.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Jan 22 08:55:58 UTC 2019 - Tomáš Chvátal + +- Add patch to work with python 3.7: + * arrow-py37.patch + ------------------------------------------------------------------- Sun Jan 20 04:31:54 UTC 2019 - Arun Persaud diff --git a/python-arrow.spec b/python-arrow.spec index a364f99..6459523 100644 --- a/python-arrow.spec +++ b/python-arrow.spec @@ -24,8 +24,9 @@ Release: 0 Summary: Better dates and times for Python License: Apache-2.0 Group: Development/Languages/Python -URL: http://crsmithdev.com/arrow +URL: https://github.com/crsmithdev/arrow Source: https://files.pythonhosted.org/packages/source/a/arrow/arrow-%{version}.tar.gz +Patch0: arrow-py37.patch BuildRequires: %{python_module chai} BuildRequires: %{python_module nose} BuildRequires: %{python_module python-dateutil} @@ -56,6 +57,7 @@ Arrow is heavily inspired by moment.js and requests. %prep %setup -q -n arrow-%{version} +%patch0 -p1 rm -rf arrow.egg-info %build @@ -63,7 +65,7 @@ rm -rf arrow.egg-info %install %python_install -%python_expand %fdupes -s %{buildroot}%{$python_sitelib} +%python_expand %fdupes %{buildroot}%{$python_sitelib} %check %python_expand PYTHONPATH="%{buildroot}%{$python_sitelib}:$PYTHONPATH" $python %{_bindir}/nosetests