Use time.monotonic if available (Python3 > 3.2)

Resolves: rhbz#1294335
This commit is contained in:
Matthias Runge 2016-08-29 08:33:29 +02:00
parent 358d51eff3
commit 528d2fd96a
2 changed files with 28 additions and 27 deletions

16
fasteners-monotonic.patch Normal file
View File

@ -0,0 +1,16 @@
diff --git a/fasteners/_utils.py b/fasteners/_utils.py
index c5418d7..e0eff38 100644
--- a/fasteners/_utils.py
+++ b/fasteners/_utils.py
@@ -19,7 +19,10 @@
import logging
import time
-from monotonic import monotonic as now # noqa
+try:
+ from time import monotonic as now
+except ImportError:
+ from monotonic import monotonic as now
# log level for low-level debugging
BLATHER = 5

View File

@ -6,12 +6,13 @@
Name: python-%{pypi_name}
Version: 0.14.1
Release: 5%{?dist}
Release: 6%{?dist}
Summary: A python package that provides useful locks
License: ASL 2.0
URL: https://github.com/harlowja/fasteners
Source0: https://codeload.github.com/harlowja/fasteners/tar.gz/%{version}#/%{pypi_name}-%{version}.tar.gz
Patch0: fasteners-monotonic.patch
BuildArch: noarch
@ -56,41 +57,20 @@ A python package that provides useful locks.
%prep
%setup -qc
mv %{pypi_name}-%{version} python2
pushd python2
# copy LICENSE etc. to top level dir
cp -a LICENSE ..
cp -a README.rst ..
popd
%if 0%{?with_python3}
cp -a python2 python3
%endif
%autosetup -p1 -n %{pypi_name}-%{version}
%build
pushd python2
%{__python2} setup.py build
popd
%py2_build
%if 0%{?with_python3}
pushd python3
%{__python3} setup.py build
popd
%py3_build
%endif # with_python3
%install
pushd python2
%{__python2} setup.py install --skip-build --root %{buildroot}
popd
%py2_install
%if 0%{?with_python3}
pushd python3
%{__python3} setup.py install --skip-build --root %{buildroot}
popd
%py3_install
%endif # with_python3
%check
@ -116,6 +96,11 @@ nosetests-%{python3_version}
%changelog
* Mon Aug 29 2016 Matthias Runge <mrunge@redhat.com> - 0.14.1-6
- Use time.monotonic if available (Python3 > 3.2)
patch thanks to Ville Skyttä (rhbz#1294335)
- modernize spec
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.14.1-5
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages