14
0
forked from pool/python-pyperf

Accepting request 782891 from devel:languages:python

py38 fix

OBS-URL: https://build.opensuse.org/request/show/782891
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pyperf?expand=0&rev=2
This commit is contained in:
2020-03-09 13:17:57 +00:00
committed by Git OBS Bridge
6 changed files with 67 additions and 17 deletions

View File

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

3
pyperf-1.7.0.tar.gz Normal file
View File

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

View File

@@ -1,3 +1,23 @@
-------------------------------------------------------------------
Mon Mar 9 10:35:44 UTC 2020 - Tomáš Chvátal <tchvatal@suse.com>
- Add patches to work with py3.8:
* python-retcode.patch
* python38.patch
-------------------------------------------------------------------
Mon Mar 9 09:21:24 UTC 2020 - Tomáš Chvátal <tchvatal@suse.com>
- Update to 1.7.0:
* metadata: add ``python_compiler``
* Windows: inherit ``SystemDrive`` environment variable by default.
* Fix tests on ARM and PPC: cpu_model_name metadata is no longer required
on Linux.
* tests: Do not allow test suite to execute without unittest2 on Python2,
otherwise man failures occur due to missing 'assertRegex'.
* doc: Update old/dead links.
* Travis CI: drop Python 3.4 support.
-------------------------------------------------------------------
Sat Oct 12 16:36:04 UTC 2019 - John Vandenberg <jayvdb@gmail.com>

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-pyperf
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -12,20 +12,26 @@
# 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-%{**}}
Name: python-pyperf
Version: 1.6.1
Version: 1.7.0
Release: 0
License: MIT
Summary: Python module to run and analyze benchmarks
Url: https://github.com/vstinner/pyperf
Group: Development/Languages/Python
License: MIT
URL: https://github.com/vstinner/pyperf
Source: https://files.pythonhosted.org/packages/source/p/pyperf/pyperf-%{version}.tar.gz
BuildRequires: python-rpm-macros
Patch0: python38.patch
Patch1: python-retcode.patch
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-six
Recommends: python-psutil
BuildArch: noarch
# SECTION test requirements
BuildRequires: %{python_module mock}
BuildRequires: %{python_module psutil}
@@ -35,15 +41,10 @@ BuildRequires: python2-contextlib2
BuildRequires: python2-statistics
BuildRequires: python2-unittest2
# /SECTION
BuildRequires: fdupes
Requires: python-six
Recommends: python-psutil
%ifpython2
Requires: python2-contextlib2
Requires: python2-statistics
%endif
BuildArch: noarch
%python_subpackages
%description
@@ -51,6 +52,7 @@ Python module to run and analyze benchmarks.
%prep
%setup -q -n pyperf-%{version}
%autopatch -p1
%build
%python_build
@@ -60,8 +62,7 @@ Python module to run and analyze benchmarks.
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
# See https://github.com/vstinner/pyperf/issues/58 for test_collect_metadata failure
%pytest -k 'not test_collect_metadata'
%pytest
%files %{python_files}
%doc README.rst

15
python-retcode.patch Normal file
View File

@@ -0,0 +1,15 @@
Index: pyperf-1.7.0/pyperf/tests/test_system.py
===================================================================
--- pyperf-1.7.0.orig/pyperf/tests/test_system.py
+++ pyperf-1.7.0/pyperf/tests/test_system.py
@@ -18,7 +18,9 @@ class SystemTests(unittest.TestCase):
# The return code is either 0 if the system is tuned or 2 if the
# system isn't
- self.assertIn(proc.returncode, (0, 2), msg=proc)
+ # Also it can return 1 if /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
+ # is not available
+ self.assertIn(proc.returncode, (0, 1, 2), msg=proc)
if __name__ == "__main__":

14
python38.patch Normal file
View File

@@ -0,0 +1,14 @@
Index: pyperf-1.7.0/pyperf/_collect_metadata.py
===================================================================
--- pyperf-1.7.0.orig/pyperf/_collect_metadata.py
+++ pyperf-1.7.0/pyperf/_collect_metadata.py
@@ -92,7 +92,8 @@ def collect_python_metadata(metadata):
metadata['timer'] = ('%s, resolution: %s'
% (info.implementation,
format_timedelta(info.resolution)))
- elif pyperf.perf_counter == time.clock:
+ elif (hasattr(time, 'clock')
+ and pyperf.perf_counter == time.clock):
metadata['timer'] = 'time.clock()'
elif pyperf.perf_counter == time.time:
metadata['timer'] = 'time.time()'