fc7287
%global srcname psutil
fc7287
%global sum A process and system utilities module for Python
fc7287
fc7287
# Filter Python modules from Provides
fc7287
%global __provides_exclude_from ^(%{python2_sitearch}|%{python3_sitearch})/.*\\.so$
fc7287
fc7287
# Prepared for Python 2 removal
fc7287
%bcond_with python2
fc7287
fc7287
# Possibility to disable tests
fc7287
%bcond_with tests
fc7287
fc7287
Name:           python-%{srcname}
fc7287
Version:        5.6.4
a16bf3
Release:        4%{?dist}
fc7287
Summary:        %{sum}
fc7287
fc7287
License:        BSD
fc7287
URL:            https://github.com/giampaolo/psutil
fc7287
Source0:        https://github.com/giampaolo/psutil/archive/release-%{version}.tar.gz#/%{srcname}-%{version}.tar.gz
fc7287
a16bf3
# Fix CVE-2019-18874: double free because of refcount mishandling
a16bf3
# Resolved upstream: https://github.com/giampaolo/psutil/commit/7d512c8e4442a896d56505be3e78f1156f443465
a16bf3
# and https://github.com/giampaolo/psutil/commit/3a9bccfd2c6d2e6538298cd3892058b1204056e0
a16bf3
Patch0:         CVE-2019-18874.patch
a16bf3
fc7287
# Exclude i686 arch. Due to a modularity issue it's being added to the
fc7287
# x86_64 compose of CRB, but we don't want to ship it at all.
fc7287
# See: https://projects.engineering.redhat.com/browse/RCM-72605
fc7287
ExcludeArch: i686
fc7287
fc7287
BuildRequires:  gcc
fc7287
BuildRequires:  python%{python3_pkgversion}-devel
fc7287
BuildRequires:  python%{python3_pkgversion}-rpm-macros
fc7287
# Test dependencies
fc7287
%if %{with tests}
fc7287
BuildRequires:  procps-ng
fc7287
BuildRequires:  python%{python3_pkgversion}-mock
fc7287
%endif
fc7287
fc7287
%if %{with python2}
fc7287
%if 0%{?fedora} < 32
fc7287
BuildRequires:  python2-mock
fc7287
BuildRequires:  python2-devel
fc7287
BuildRequires:  python2-ipaddress
fc7287
%else
fc7287
# This package has an exception to use Python 2 in Fedora 32+
fc7287
# The exception is for chromium (chrome-remote-desktop)
fc7287
# https://pagure.io/fesco/issue/2214
fc7287
BuildRequires:  python27
fc7287
BuildRequires:  python2-setuptools
fc7287
%endif
fc7287
%endif
fc7287
fc7287
%description
fc7287
psutil is a module providing an interface for retrieving information on all
fc7287
running processes and system utilization (CPU, memory, disks, network, users) in
fc7287
a portable way by using Python, implementing many functionalities offered by
fc7287
command line tools such as: ps, top, df, kill, free, lsof, free, netstat,
fc7287
ifconfig, nice, ionice, iostat, iotop, uptime, pidof, tty, who, taskset, pmap.
fc7287
fc7287
fc7287
%if %{with python2}
fc7287
%package -n python2-%{srcname}
fc7287
Summary:        %{sum}
fc7287
%{?python_provide:%python_provide python2-%{srcname}}
fc7287
Obsoletes:      python-%{srcname} < 3.1.1-3
fc7287
fc7287
%description -n python2-psutil
fc7287
psutil is a module providing an interface for retrieving information on all
fc7287
running processes and system utilization (CPU, memory, disks, network, users) in
fc7287
a portable way by using Python 3, implementing many functionalities offered by
fc7287
command line tools such as: ps, top, df, kill, free, lsof, free, netstat,
fc7287
ifconfig, nice, ionice, iostat, iotop, uptime, pidof, tty, who, taskset, pmap.
fc7287
%endif
fc7287
fc7287
%package -n python%{python3_pkgversion}-psutil
fc7287
Summary:        %{sum}
fc7287
%{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}}
fc7287
fc7287
%description -n python%{python3_pkgversion}-psutil
fc7287
psutil is a module providing an interface for retrieving information on all
fc7287
running processes and system utilization (CPU, memory, disks, network, users) in
fc7287
a portable way by using Python 3, implementing many functionalities offered by
fc7287
command line tools such as: ps, top, df, kill, free, lsof, free, netstat,
fc7287
ifconfig, nice, ionice, iostat, iotop, uptime, pidof, tty, who, taskset, pmap.
fc7287
fc7287
fc7287
%prep
a16bf3
%autosetup -p1 -n %{srcname}-release-%{version}
fc7287
fc7287
# Remove shebangs
fc7287
find psutil -name \*.py | while read file; do
fc7287
  sed -i.orig -e '1{/^#!/d}' $file && \
fc7287
  touch -r $file.orig $file && \
fc7287
  rm $file.orig
fc7287
done
fc7287
fc7287
fc7287
%build
fc7287
%if %{with python2}
fc7287
%py2_build
fc7287
%endif
fc7287
%py3_build
fc7287
fc7287
fc7287
%install
fc7287
%if %{with python2}
fc7287
%py2_install
fc7287
%endif
fc7287
%py3_install
fc7287
fc7287
fc7287
%check
fc7287
%if %{with tests}
fc7287
%if %{with python2} && 0%{?fedora} < 32
fc7287
make test-memleaks PYTHON=%{__python2}
fc7287
%endif
fc7287
make test-memleaks PYTHON=%{__python3}
fc7287
%endif
fc7287
fc7287
fc7287
%if %{with python2}
fc7287
%files -n python2-%{srcname}
fc7287
%license LICENSE
fc7287
%doc CREDITS HISTORY.rst README.rst
fc7287
%{python2_sitearch}/%{srcname}/
fc7287
%{python2_sitearch}/*.egg-info
fc7287
%endif
fc7287
fc7287
fc7287
%files -n python%{python3_pkgversion}-%{srcname}
fc7287
%license LICENSE
fc7287
%doc CREDITS HISTORY.rst README.rst
fc7287
%{python3_sitearch}/%{srcname}/
fc7287
%{python3_sitearch}/*.egg-info
fc7287
fc7287
fc7287
%changelog
a16bf3
* Mon Jul 26 2021 Charalampos Stratakis <cstratak@redhat.com> - 5.6.4-4
a16bf3
- Security fix for CVE-2019-18874: double free because of refcount mishandling
a16bf3
Resolves: rhbz#1772014
a16bf3
fc7287
* Thu Dec 12 2019 Tomas Orsava <torsava@redhat.com> - 5.6.4-3
fc7287
- Exclude unsupported i686 arch
fc7287
fc7287
* Wed Nov 20 2019 Lumír Balhar <lbalhar@redhat.com> - 5.6.4-2
fc7287
- Adjusted for Python 3.8 module in RHEL 8
fc7287
fc7287
* Wed Nov 06 2019 Lumír Balhar <lbalhar@redhat.com> - 5.6.4-1
fc7287
- New upstream release 5.6.4
fc7287
- bcond for Python 2 subpackage and tests
fc7287
- Enabled tests
fc7287
fc7287
* Sun Oct 06 2019 Kevin Fenzi <kevin@scrye.com> - 5.6.3-5
fc7287
- Add python2-setuptools to BuildRequires to fix egg info. Fixes bug #1750362
fc7287
fc7287
* Tue Sep 03 2019 Miro Hrončok <mhroncok@redhat.com> - 5.6.3-4
fc7287
- Reduce unused build dependencies
fc7287
fc7287
* Fri Aug 16 2019 Miro Hrončok <mhroncok@redhat.com> - 5.6.3-3
fc7287
- Rebuilt for Python 3.8
fc7287
fc7287
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 5.6.3-2
fc7287
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
fc7287
fc7287
* Sun Jun 30 2019 Kevin Fenzi <kevin@scrye.com> - 5.6.3-1
fc7287
- Update to 5.6.3 Fixes bug #1567102
fc7287
fc7287
* Thu Feb 28 2019 Yatin Karel <ykarel@redhat.com> - 5.5.1-1
fc7287
- Update to 5.5.1 (Resolves #1567102)
fc7287
fc7287
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 5.4.3-7
fc7287
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
fc7287
fc7287
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 5.4.3-6
fc7287
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
fc7287
fc7287
* Sun Jun 17 2018 Miro Hrončok <mhroncok@redhat.com> - 5.4.3-5
fc7287
- Rebuilt for Python 3.7
fc7287
fc7287
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 5.4.3-4
fc7287
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
fc7287
fc7287
* Mon Jan 29 2018 Iryna Shcherbina <ishcherb@redhat.com> - 5.4.3-3
fc7287
- Update Python 2 dependency declarations to new packaging standards
fc7287
  (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)
fc7287
fc7287
* Mon Jan 22 2018 Gwyn Ciesla <limburgher@gmail.com> - 5.4.3-2
fc7287
- Disable tests entirely.
fc7287
fc7287
* Mon Jan 22 2018 Gwyn Ciesla <limburgher@gmail.com> - 5.4.3-1
fc7287
- 5.4.3
fc7287
fc7287
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 5.2.2-3
fc7287
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
fc7287
fc7287
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 5.2.2-2
fc7287
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
fc7287
fc7287
* Sun Apr 23 2017 Kevin Fenzi <kevin@scrye.com> - 5.2.2-1
fc7287
- Update to 5.2.2. Fixes bug #1441010
fc7287
fc7287
* Sat Mar 25 2017 Kevin Fenzi <kevin@scrye.com> - 5.2.1-1
fc7287
- Update to 5.2.1. Fixes bug #1418489
fc7287
fc7287
* Sat Feb 25 2017 Kevin Fenzi <kevin@scrye.com> - 5.1.3-1
fc7287
- Update to 5.1.3. Fixes bug #1418489
fc7287
fc7287
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 5.0.1-2
fc7287
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
fc7287
fc7287
* Mon Jan 02 2017 Kevin Fenzi <kevin@scrye.com> - 5.0.1-1
fc7287
- Update to 5.0.1. Fixes bug #1389579
fc7287
- Disable failing test while upstream looks at it. 
fc7287
fc7287
* Wed Nov 09 2016 Kevin Fenzi <kevin@scrye.com> - 5.0.0-1
fc7287
- Update to 5.0.0. Fixes bug #1389579
fc7287
fc7287
* Tue Oct 25 2016 Kevin Fenzi <kevin@scrye.com> - 4.4.0-1
fc7287
- Update to 4.4.0. Fixes bug #1387942
fc7287
fc7287
* Sat Sep 03 2016 Kevin Fenzi <kevin@scrye.com> - 4.3.1-1
fc7287
- Update to 4.3.1. Fixes bug #1372500
fc7287
fc7287
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.3.0-2
fc7287
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
fc7287
fc7287
* Tue Jun 21 2016 Orion Poplawski <orion@cora.nwra.com> - 4.3.0-1
fc7287
- Update to 4.3.0
fc7287
fc7287
* Mon May 16 2016 Orion Poplawski <orion@cora.nwra.com> - 3.2.1-6
fc7287
- Use modern provides filter
fc7287
- Update URL
fc7287
- Use %%python3_pkgversion for EPEL7 compat
fc7287
fc7287
* Fri Mar 11 2016 Than Ngo <than@redhat.com> - 3.2.1-5
fc7287
- fix endian issue on s390x/ppc64
fc7287
fc7287
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 3.2.1-4
fc7287
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
fc7287
fc7287
* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.2.1-3
fc7287
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5
fc7287
fc7287
* Fri Sep  4 2015 Michel Alexandre Salim <salimma@fedoraproject.org> - 3.2.1-2
fc7287
- Add Obsoletes for old package
fc7287
fc7287
* Fri Sep  4 2015 Michel Alexandre Salim <salimma@fedoraproject.org> - 3.2.1-1
fc7287
- Update to 3.2.1
fc7287
- Update to latest Python guidelines (https://fedorahosted.org/fpc/ticket/281)
fc7287
fc7287
* Wed Jul 22 2015 Michel Alexandre Salim <salimma@fedoraproject.org> - 3.1.1-2
fc7287
- Restore *.so files
fc7287
- Enable tests
fc7287
fc7287
* Tue Jul 21 2015 Michel Alexandre Salim <salimma@fedoraproject.org> - 3.1.1-1
fc7287
- Update to 3.1.1
fc7287
fc7287
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.2.0-2
fc7287
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
fc7287
fc7287
* Wed Feb 18 2015 Ralph Bean <rbean@redhat.com> - 2.2.0-1
fc7287
- new version
fc7287
fc7287
* Wed Dec  3 2014 Michel Alexandre Salim <salimma@fedoraproject.org> - 2.1.3-1
fc7287
- Update to 2.1.3
fc7287
fc7287
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.1-5
fc7287
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
fc7287
fc7287
* Thu Jul 31 2014 Tom Callaway <spot@fedoraproject.org> - 1.2.1-4
fc7287
- fix license handling
fc7287
fc7287
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.1-3
fc7287
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
fc7287
fc7287
* Wed May 28 2014 Kalev Lember <kalevlember@gmail.com> - 1.2.1-2
fc7287
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4
fc7287
fc7287
* Mon Jan 06 2014 Mohamed El Morabity <melmorabity@fedoraproject.org> - 1.2.1-1
fc7287
- Update to 1.2.1
fc7287
fc7287
* Fri Aug 16 2013 Mohamed El Morabity <melmorabity@fedoraproject.org> - 1.0.1-1
fc7287
- Update to 1.0.1
fc7287
fc7287
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.7.1-2
fc7287
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
fc7287
fc7287
* Sun May 12 2013 Mohamed El Morabity <melmorabity@fedoraproject.org> - 0.7.1-1
fc7287
- Update to 0.7.1
fc7287
fc7287
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.6.1-2
fc7287
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
fc7287
fc7287
* Sun Aug 19 2012 Mohamed El Morabity <melmorabity@fedorapeople.org> - 0.6.1-1
fc7287
- Update to 0.6.1
fc7287
fc7287
* Sat Aug 04 2012 David Malcolm <dmalcolm@redhat.com> - 0.5.1-3
fc7287
- rebuild for https://fedoraproject.org/wiki/Features/Python_3.3
fc7287
fc7287
* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5.1-2
fc7287
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
fc7287
fc7287
* Sun Jul 01 2012 Mohamed El Morabity <melmorabity@fedoraproject.org> - 0.5.1-1
fc7287
- Update to 0.5.1
fc7287
fc7287
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.4.1-2
fc7287
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
fc7287
fc7287
* Fri Dec 16 2011 Mohamed El Morabity <melmorabity@fedoraproject.org> - 0.4.1-1
fc7287
- Update to 0.4.1
fc7287
fc7287
* Sun Nov 20 2011 Mohamed El Morabity <melmorabity@fedoraproject.org> - 0.4.0-1
fc7287
- Update to 0.4.0
fc7287
fc7287
* Mon Jul 18 2011 Mohamed El Morabity <melmorabity@fedoraproject.org> - 0.3.0-1
fc7287
- Update to 0.3.0
fc7287
fc7287
* Wed Mar 23 2011 Mohamed El Morabity <melmorabity@fedoraproject.org> - 0.2.1-1
fc7287
- Update to 0.2.1
fc7287
- Spec cleanup
fc7287
fc7287
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.0-2
fc7287
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
fc7287
fc7287
* Mon Nov 22 2010 Mohamed El Morabity <melmorabity@fedoraproject.org> - 0.2.0-1
fc7287
- Update to 0.2.0
fc7287
fc7287
* Wed Aug 25 2010 Thomas Spura <tomspur@fedoraproject.org> - 0.1.3-5
fc7287
- rebuild with python3.2
fc7287
  http://lists.fedoraproject.org/pipermail/devel/2010-August/141368.html
fc7287
fc7287
* Fri Jul 30 2010 Thomas Spura <tomspur@fedoraproject.org> - 0.1.3-4
fc7287
- bump, because previous build nvr already existed in F-14
fc7287
fc7287
* Thu Jul 22 2010 David Malcolm <dmalcolm@redhat.com> - 0.1.3-3
fc7287
- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild
fc7287
fc7287
* Tue Apr 13 2010 ELMORABITY Mohamed <melmorabity@fedoraproject.org> 0.1.3-2
fc7287
- Add missing popd in %%build
fc7287
fc7287
* Sat Mar 27 2010 ELMORABITY Mohamed <melmorabity@fedoraproject.org> 0.1.3-1
fc7287
- Update to 0.1.3
fc7287
- Remove useless call to 2to3 and corresponding BuildRequires
fc7287
  python2-tools (this version supports Python 3)
fc7287
fc7287
* Sat Feb 20 2010 ELMORABITY Mohamed <melmorabity@fedoraproject.org> 0.1.2-4
fc7287
- Change python-utils BuildRequires for python2-utils
fc7287
fc7287
* Sat Feb 20 2010 ELMORABITY Mohamed <melmorabity@fedoraproject.org> 0.1.2-3
fc7287
- Add python3 subpackage
fc7287
fc7287
* Thu Jan 14 2010 ELMORABITY Mohamed <melmorabity@fedoraproject.org> 0.1.2-2
fc7287
- Drop no-shebang patch for a sed command
fc7287
- Drop test suite from %%doc tag
fc7287
fc7287
* Fri Jan  8 2010 ELMORABITY Mohamed <melmorabity@fedoraproject.org> 0.1.2-1
fc7287
- Initial RPM release