1
0

Accepting request 622946 from devel:languages:python

- update to 0.3.10 
- add _u_p37_tests.patch
 * Performance improvements
 * Coroutine support (forwarded request 622945 from mimi_vx)

OBS-URL: https://build.opensuse.org/request/show/622946
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-freezegun?expand=0&rev=3
This commit is contained in:
Dominique Leuenberger 2018-07-17 07:37:43 +00:00 committed by Git OBS Bridge
commit 66b015f621
5 changed files with 76 additions and 13 deletions

55
_u_p37_tests.patch Normal file
View File

@ -0,0 +1,55 @@
From 4fdad69659f15a9e62cf4f6c15c9f319276cf9b0 Mon Sep 17 00:00:00 2001
From: Jonas Obrist <jonas.obrist@hde.co.jp>
Date: Tue, 6 Mar 2018 12:21:38 +0900
Subject: [PATCH] add support for Python 3.7 uuid module changes
Python 3.7 removed uuid._uuid_generate_time. It now has
uuid._load_system_functions and uuid._generate_time_safe.
_generate_time_safe is set by calling _load_system_functions (subsequent
calls to that function are no-op). This change detects the missing
uuid._uuid_generate_time attribute and uses the new attribute/function
if they're missing.
---
freezegun/api.py | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/freezegun/api.py b/freezegun/api.py
index eb09932..a88a392 100644
--- a/freezegun/api.py
+++ b/freezegun/api.py
@@ -27,8 +27,14 @@
try:
real_uuid_generate_time = uuid._uuid_generate_time
-except (AttributeError, ImportError):
+ uuid_generate_time_attr = '_uuid_generate_time'
+except AttributeError:
+ uuid._load_system_functions()
+ real_uuid_generate_time = uuid._generate_time_safe
+ uuid_generate_time_attr = '_generate_time_safe'
+except ImportError:
real_uuid_generate_time = None
+ uuid_generate_time_attr = None
try:
real_uuid_create = uuid._UuidCreate
@@ -482,7 +488,8 @@ def start(self):
time.localtime = fake_localtime
time.gmtime = fake_gmtime
time.strftime = fake_strftime
- uuid._uuid_generate_time = None
+ if uuid_generate_time_attr:
+ setattr(uuid, uuid_generate_time_attr, None)
uuid._UuidCreate = None
uuid._last_timestamp = None
@@ -573,7 +580,8 @@ def stop(self):
time.localtime = time.localtime.previous_localtime_function
time.strftime = time.strftime.previous_strftime_function
- uuid._uuid_generate_time = real_uuid_generate_time
+ if uuid_generate_time_attr:
+ setattr(uuid, uuid_generate_time_attr, real_uuid_generate_time)
uuid._UuidCreate = real_uuid_create
uuid._last_timestamp = None

3
freezegun-0.3.10.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:703caac155dcaad61f78de4cb0666dca778d854dfb90b3699930adee0559a622
size 20398

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:783ccccd7f60968bfe49ad9e114c18ea2b63831faaaf61c1f1f71ddfde1c0eee
size 18118

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Sun Jul 15 20:55:20 UTC 2018 - mimi.vx@gmail.com
- update to 0.3.10
- add _u_p37_tests.patch
* Performance improvements
* Coroutine support
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Feb 23 20:12:29 UTC 2018 - tbechtold@suse.com Fri Feb 23 20:12:29 UTC 2018 - tbechtold@suse.com

View File

@ -16,31 +16,30 @@
# #
%bcond_without tests
%{?!python_module:%define python_module() python-%{**} python3-%{**}} %{?!python_module:%define python_module() python-%{**} python3-%{**}}
%bcond_without tests
Name: python-freezegun Name: python-freezegun
Version: 0.3.9 Version: 0.3.10
Release: 0 Release: 0
Url: https://github.com/spulec/freezegun
Summary: Mock time date for Python Summary: Mock time date for Python
License: Apache-2.0 License: Apache-2.0
Group: Development/Languages/Python Group: Development/Languages/Python
URL: https://github.com/spulec/freezegun
Source: https://files.pythonhosted.org/packages/source/f/freezegun/freezegun-%{version}.tar.gz Source: https://files.pythonhosted.org/packages/source/f/freezegun/freezegun-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-build Patch0: _u_p37_tests.patch
BuildRequires: %{python_module devel} BuildRequires: %{python_module devel}
BuildRequires: %{python_module python-dateutil > 2.0} BuildRequires: %{python_module python-dateutil > 2.0}
BuildRequires: %{python_module setuptools} BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module six} BuildRequires: %{python_module six}
BuildRequires: fdupes BuildRequires: fdupes
BuildRequires: python-rpm-macros BuildRequires: python-rpm-macros
Requires: python-python-dateutil > 2.0
Requires: python-six
BuildArch: noarch
%if %{with tests} %if %{with tests}
BuildRequires: %{python_module mock} BuildRequires: %{python_module mock}
BuildRequires: %{python_module nose} BuildRequires: %{python_module nose}
%endif %endif
Requires: python-python-dateutil > 2.0
Requires: python-six
BuildArch: noarch
%python_subpackages %python_subpackages
%description %description
@ -49,6 +48,7 @@ time by mocking the datetime module.
%prep %prep
%setup -q -n freezegun-%{version} %setup -q -n freezegun-%{version}
%patch0 -p1
%build %build
%python_build %python_build
@ -63,8 +63,8 @@ time by mocking the datetime module.
%endif %endif
%files %{python_files} %files %{python_files}
%defattr(-,root,root,-) %license LICENSE
%doc LICENSE README.rst %doc README.rst
%{python_sitelib}/* %{python_sitelib}/*
%changelog %changelog