From bd9e598863b19778838d88d27767a476fa8dc966 Mon Sep 17 00:00:00 2001 From: Thomas Crain Date: Tue, 25 Jan 2022 12:11:31 -0800 Subject: [PATCH] Upgrade python-psutil to 5.9.0 (#2000) --- .../disable-tests-python-psutil.patch | 106 ++++++++++++++---- .../python-psutil.signatures.json | 2 +- SPECS/python-psutil/python-psutil.spec | 47 ++++---- cgmanifest.json | 4 +- 4 files changed, 115 insertions(+), 44 deletions(-) diff --git a/SPECS/python-psutil/disable-tests-python-psutil.patch b/SPECS/python-psutil/disable-tests-python-psutil.patch index 27571a9d3d..11c8e4d4b7 100644 --- a/SPECS/python-psutil/disable-tests-python-psutil.patch +++ b/SPECS/python-psutil/disable-tests-python-psutil.patch @@ -1,24 +1,90 @@ -diff -ruN a/psutil/tests/test_contracts.py b/psutil/tests/test_contracts.py ---- a/psutil/tests/test_contracts.py 2020-03-18 17:18:07.804721589 -0700 -+++ b/psutil/tests/test_contracts.py 2020-03-18 17:23:11.009295171 -0700 -@@ -329,6 +329,8 @@ - else: - return attr +From 2a24bb358bb20f86dbb0cc892a5cb5d853258ef5 Mon Sep 17 00:00:00 2001 +From: Thomas Crain +Date: Tue, 25 Jan 2022 11:44:00 -0800 +Subject: [PATCH] Disable unreliable tests in Mariner chroot + +--- + psutil/tests/test_linux.py | 7 +++++-- + psutil/tests/test_misc.py | 1 + + psutil/tests/test_system.py | 2 ++ + 3 files changed, 8 insertions(+), 2 deletions(-) + +diff --git a/psutil/tests/test_linux.py b/psutil/tests/test_linux.py +index 20e28d2..fd0dcdd 100755 +--- a/psutil/tests/test_linux.py ++++ b/psutil/tests/test_linux.py +@@ -1289,6 +1289,7 @@ class TestRootFsDeviceFinder(PsutilTestCase): + finder.ask_sys_class_block() -+ #Disabling the test as it will fail while running in chroot + @unittest.skipIf(GITHUB_ACTIONS, "unsupported on GITHUB_ACTIONS") + @unittest.skip("Disable the test") - def test_fetch_all(self): - valid_procs = 0 - default = object() -diff -ruN a/psutil/tests/test_posix.py b/psutil/tests/test_posix.py ---- a/psutil/tests/test_posix.py 2020-03-18 17:17:35.865049056 -0700 -+++ b/psutil/tests/test_posix.py 2020-03-18 17:21:27.346504885 -0700 -@@ -369,6 +369,8 @@ - @unittest.skipIf(APPVEYOR or TRAVIS and not psutil.users(), - "unreliable on APPVEYOR or TRAVIS") - @retry_on_failure() -+ #Disabling the test as it will fail while running in chroot + def test_comparisons(self): + finder = RootFsDeviceFinder() + self.assertIsNotNone(finder.find()) +@@ -1311,11 +1312,13 @@ class TestRootFsDeviceFinder(PsutilTestCase): + + @unittest.skipIf(not which("findmnt"), "findmnt utility not available") + @unittest.skipIf(GITHUB_ACTIONS, "unsupported on GITHUB_ACTIONS") ++ @unittest.skip("Disable the test") + def test_against_findmnt(self): + psutil_value = RootFsDeviceFinder().find() + findmnt_value = sh("findmnt -o SOURCE -rn /") + self.assertEqual(psutil_value, findmnt_value) + ++ @unittest.skip("Disable the test") + def test_disk_partitions_mocked(self): + with mock.patch( + 'psutil._pslinux.cext.disk_partitions', +@@ -1521,8 +1524,7 @@ class TestMisc(PsutilTestCase): + # ===================================================================== + + +-@unittest.skipIf(not LINUX, "LINUX only") +-@unittest.skipIf(not HAS_BATTERY, "no battery") ++@unittest.skip("Disable the test") + class TestSensorsBattery(PsutilTestCase): + + @unittest.skipIf(not which("acpi"), "acpi utility not available") +@@ -1634,6 +1636,7 @@ class TestSensorsBattery(PsutilTestCase): + "/sys/class/power_supply/BAT0/capacity", b"88"): + self.assertEqual(psutil.sensors_battery().percent, 88) + ++ @unittest.skip("Disable the test") + def test_emulate_no_power(self): + # Emulate a case where /AC0/online file nor /BAT0/status exist. + with mock_open_exception( +diff --git a/psutil/tests/test_misc.py b/psutil/tests/test_misc.py +index d946eb6..204752b 100755 +--- a/psutil/tests/test_misc.py ++++ b/psutil/tests/test_misc.py +@@ -368,6 +368,7 @@ class TestMisc(PsutilTestCase): + + # XXX: https://github.com/pypa/setuptools/pull/2896 + @unittest.skipIf(APPVEYOR, "temporarily disabled due to setuptools bug") ++ @unittest.skip("Disable the test") + def test_setup_script(self): + setup_py = os.path.join(ROOT_DIR, 'setup.py') + if CI_TESTING and not os.path.exists(setup_py): +diff --git a/psutil/tests/test_system.py b/psutil/tests/test_system.py +index db2cb34..0e79db3 100755 +--- a/psutil/tests/test_system.py ++++ b/psutil/tests/test_system.py +@@ -200,6 +200,7 @@ class TestMiscAPIs(PsutilTestCase): + self.assertLess(bt, time.time()) + + @unittest.skipIf(CI_TESTING and not psutil.users(), "unreliable on CI") + @unittest.skip("Disable the test") def test_users(self): - out = sh("who") - lines = out.split('\n') + users = psutil.users() + self.assertNotEqual(users, []) +@@ -580,6 +581,7 @@ class TestDiskAPIs(PsutilTestCase): + def test_disk_usage_bytes(self): + psutil.disk_usage(b'.') + ++ @unittest.skip("Disable the test") + def test_disk_partitions(self): + def check_ntuple(nt): + self.assertIsInstance(nt.device, str) +-- +2.25.1 + diff --git a/SPECS/python-psutil/python-psutil.signatures.json b/SPECS/python-psutil/python-psutil.signatures.json index f636981f5d..25da942c25 100644 --- a/SPECS/python-psutil/python-psutil.signatures.json +++ b/SPECS/python-psutil/python-psutil.signatures.json @@ -1,5 +1,5 @@ { "Signatures": { - "python-psutil-5.6.3.tar.gz": "55b86dc0a9fc4e258ae5d86d6edf317432a4e3dc45c7324b8a82838b07e74f4a" + "python-psutil-5.9.0.tar.gz": "ea4f431c10100079f46a494894582edb43e395324f200bd82ecf60b60b46a929" } } \ No newline at end of file diff --git a/SPECS/python-psutil/python-psutil.spec b/SPECS/python-psutil/python-psutil.spec index 1fa3e4482e..938449616f 100644 --- a/SPECS/python-psutil/python-psutil.spec +++ b/SPECS/python-psutil/python-psutil.spec @@ -1,36 +1,35 @@ Summary: A library for retrieving information onrunning processes and system utilization Name: python-psutil -Version: 5.6.3 -Release: 6%{?dist} -Url: https://pypi.python.org/pypi/psutil +Version: 5.9.0 +Release: 1%{?dist} License: BSD -Group: Development/Languages/Python Vendor: Microsoft Corporation Distribution: Mariner -#Source0: https://github.com/giampaolo/psutil/archive/release-%{version}.tar.gz -Source0: %{name}-%{version}.tar.gz +Group: Development/Languages/Python +URL: https://pypi.python.org/pypi/psutil +Source0: https://github.com/giampaolo/psutil/archive/release-%{version}.tar.gz#/%{name}-%{version}.tar.gz +# A small number of tests do not reliably run in Mariner chroots- we can skip these tests Patch0: disable-tests-python-psutil.patch +BuildRequires: gcc +BuildRequires: python3-devel +%if %{with_check} +BuildRequires: coreutils +BuildRequires: curl-devel +BuildRequires: ncurses-term +BuildRequires: openssl-devel +BuildRequires: python3-pbr +BuildRequires: python3-pip +BuildRequires: python3-setuptools +BuildRequires: python3-six +BuildRequires: python3-test +%endif %description psutil (process and system utilities) is a cross-platform library for retrieving information on running processes and system utilization (CPU, memory, disks, network, sensors) in Python. %package -n python3-psutil Summary: A library for retrieving information onrunning processes and system utilization -BuildRequires: python3-devel -%if %{with_check} -BuildRequires: ncurses-term -BuildRequires: coreutils -BuildRequires: curl-devel -BuildRequires: openssl-devel -BuildRequires: python3-pip -BuildRequires: python3-six -BuildRequires: python3-test -BuildRequires: python3-setuptools -BuildRequires: python3-xml -BuildRequires: python3-pbr -%endif Requires: python3 -Requires: python3-libs %description -n python3-psutil psutil (process and system utilities) is a cross-platform library for retrieving information on running processes and system utilization (CPU, memory, disks, network, sensors) in Python. @@ -49,7 +48,7 @@ FreeBSD, OpenBSD and NetBSD, both 32-bit and 64-bit architectures, with Python v %check pip3 install linecache2 pytest mock unittest2 -LANG=en_US.UTF-8 make test PYTHON=python%{python3_version} +LANG=en_US.UTF-8 PYTHONPATH=%{buildroot}%{python3_sitelib} make test PYTHON=python%{python3_version} %files -n python3-psutil %defattr(-,root,root,-) @@ -57,6 +56,12 @@ LANG=en_US.UTF-8 make test PYTHON=python%{python3_version} %{python3_sitelib}/* %changelog +* Tue Jan 25 2022 Thomas Crain - 5.9.0-1 +- Upgrade to latest upstream version +- Update skipped tests patch +- Lint spec +- License verified + * Fri Dec 03 2021 Thomas Crain - 5.6.3-6 - Replace easy_install usage with pip in %%check sections diff --git a/cgmanifest.json b/cgmanifest.json index 5b09b7bb74..4ddcbd90ae 100644 --- a/cgmanifest.json +++ b/cgmanifest.json @@ -23694,8 +23694,8 @@ "type": "other", "other": { "name": "python-psutil", - "version": "5.6.3", - "downloadUrl": "https://github.com/giampaolo/psutil/archive/release-5.6.3.tar.gz" + "version": "5.9.0", + "downloadUrl": "https://github.com/giampaolo/psutil/archive/release-5.9.0.tar.gz" } } },