- Update to 0.3.11:

* Performance improvements
    * Fix nesting time.time
    * Add nanosecond property
- Remove nose dependency by adding denose.patch

- Remove superfluous devel dependency for noarch package

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-freezegun?expand=0&rev=17
This commit is contained in:
Matej Cepl 2019-01-10 14:59:27 +00:00 committed by Git OBS Bridge
parent 78f7ef5367
commit 5f7003500d
6 changed files with 1175 additions and 72 deletions

View File

@ -1,55 +0,0 @@
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

1150
denose.patch Normal file

File diff suppressed because it is too large Load Diff

View File

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

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

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

View File

@ -1,3 +1,17 @@
-------------------------------------------------------------------
Thu Jan 10 14:29:14 CET 2019 - mcepl@suse.com
- Update to 0.3.11:
* Performance improvements
* Fix nesting time.time
* Add nanosecond property
- Remove nose dependency by adding denose.patch
-------------------------------------------------------------------
Tue Dec 4 12:48:13 UTC 2018 - Matej Cepl <mcepl@suse.com>
- Remove superfluous devel dependency for noarch package
-------------------------------------------------------------------
Tue Sep 4 16:32:05 UTC 2018 - Matěj Cepl <mcepl@suse.com>

View File

@ -1,7 +1,7 @@
#
# spec file for package python-freezegun
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -12,24 +12,23 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%bcond_without tests
Name: python-freezegun
Version: 0.3.10
Version: 0.3.11
Release: 0
Summary: Mock time date for Python
License: Apache-2.0
Group: Development/Languages/Python
URL: https://github.com/spulec/freezegun
Source: https://files.pythonhosted.org/packages/source/f/freezegun/freezegun-%{version}.tar.gz
Patch0: _u_p37_tests.patch
# https://github.com/spulec/freezegun/issues/259
Patch1: remove_dependency_on_mock.patch
BuildRequires: %{python_module devel}
# gh#spulec/freezegun#259
Patch0: remove_dependency_on_mock.patch
# gh#spulec/freezegun#280 Removal of nose dependency
Patch1: denose.patch
BuildRequires: %{python_module python-dateutil > 2.0}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module six}
@ -38,10 +37,7 @@ BuildRequires: python-rpm-macros
Requires: python-python-dateutil > 2.0
Requires: python-six
BuildArch: noarch
%if %{with tests}
BuildRequires: %{python_module nose}
BuildRequires: python2-mock
%endif
%python_subpackages
%description
@ -59,10 +55,8 @@ time by mocking the datetime module.
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%if %{with tests}
%check
%python_expand nosetests-%{$python_bin_suffix}
%endif
%python_exec -munittest discover -v
%files %{python_files}
%license LICENSE