From 4cdf02f750a8a6e64c87c517d54c845d0bef51f8 Mon Sep 17 00:00:00 2001 From: Alexandre Detiste Date: Sat, 18 Apr 2026 15:33:21 +0200 Subject: [PATCH] trim Python2 from sample specfile --- .gitignore | 3 +- python-bitmath.spec | 81 ++---------------------------------------- python-bitmath.spec.in | 79 ++-------------------------------------- 3 files changed, 5 insertions(+), 158 deletions(-) diff --git a/.gitignore b/.gitignore index 0229c8e..05e1093 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,7 @@ dist rpm-build # python -*.py[cod] +*.pyc # C extensions *.so @@ -36,7 +36,6 @@ pip-log.txt .coverage coverage.xml .tox -nosetests.xml # Translations *.mo diff --git a/python-bitmath.spec b/python-bitmath.spec index f8ece3b..51999f0 100644 --- a/python-bitmath.spec +++ b/python-bitmath.spec @@ -1,24 +1,9 @@ -%if 0%{?rhel} && 0%{?rhel} <= 6 -%{!?__python2: %global __python2 /usr/bin/python2} -%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} -%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} -%{!?py2_build: %global py2_build python setup.py build} -%{!?py2_install: %global py2_install python setup.py install -O1 --root=$RPM_BUILD_ROOT} -%endif - -%if 0%{?fedora} -%{!?python3_version: %global python3_version %(%{__python3} -c "import sys; sys.stdout.write(sys.version[:3])")} -%global with_python3 1 -%else -%global with_python3 0 -%endif - %global _short_name bitmath %global _short_release 1 Name: python-bitmath Summary: Aids representing and manipulating file sizes in various prefix notations -Version: 1.3.3 +Version: 2.0.0 Release: %{_short_release}%{?dist} Group: Development/Libraries @@ -27,20 +12,8 @@ Source0: https://github.com/tbielawa/bitmath/archive/%{version}.%{_short_release Url: https://github.com/tbielawa/bitmath BuildArch: noarch -BuildRequires: python2-mock -BuildRequires: python2-nose -BuildRequires: python2-progressbar -BuildRequires: python2-setuptools -BuildRequires: python2-devel -%if 0%{?with_python3} BuildRequires: python3-devel -BuildRequires: python3-mock -BuildRequires: python3-nose BuildRequires: python3-setuptools -%endif -%{?el6:Requires: python-argparse} -%{?el6:BuildRequires: python-argparse} -%{?el6:BuildRequires: python-unittest2} %description bitmath simplifies many facets of interacting with file sizes in @@ -65,34 +38,6 @@ always at 100%. ###################################################################### # Sub-package setup -%package -n python2-bitmath -Summary: Aids representing and manipulating file sizes in various prefix notations -%{?python_provide:%python_provide python2-bitmath} - -%description -n python2-bitmath -bitmath simplifies many facets of interacting with file sizes in -various units. Examples include: converting between SI and NIST prefix -units (GiB to kB), converting between units of the same type (SI to -SI, or NIST to NIST), basic arithmetic operations (subtracting 42KiB -from 50GiB), and rich comparison operations (1024 Bytes == 1KiB), -bitwise operations, sorting, automatic best human-readable prefix -selection, and completely customizable formatting. - -In addition to the conversion and math operations, bitmath provides -human readable representations of values which are suitable for use in -interactive shells as well as larger scripts and applications. It can -also read the capacity of system storage devices. bitmath can parse -strings (like "1 KiB") into proper objects and has support for -integration with the argparse module as a custom argument type and the -progressbar module as a custom file transfer speed widget. - -bitmath is thoroughly unittested, with almost 200 individual tests (a -number which is always increasing). bitmath's test-coverage is almost -always at 100%. - -#--------------------------------------------------------------------- - -%if 0%{?with_python3} %package -n python3-bitmath Summary: Aids representing and manipulating file sizes in various prefix notations %{?python_provide:%python_provide python3-bitmath} @@ -117,22 +62,17 @@ progressbar module as a custom file transfer speed widget. bitmath is thoroughly unittested, with almost 200 individual tests (a number which is always increasing). bitmath's test-coverage is almost always at 100%. -%endif # with_python3 ###################################################################### %check -nosetests -v - -%if 0%{?with_python3} # We can't run the progressbar and argparse tests in python3 until # progressbar has a python3 package available :( # # Skip those tests for now and run the rest -nosetests-%{python3_version} -e 'test_FileTransferSpeed' \ +pytest -e 'test_FileTransferSpeed' \ -e 'test_BitmathType_' \ -I '.*test_argparse_type.py' \ -I '.*test_progressbar.py' -v -%endif # with_python3 ###################################################################### %prep @@ -140,22 +80,14 @@ nosetests-%{python3_version} -e 'test_FileTransferSpeed' \ ###################################################################### %build -%py2_build -%if 0%{?with_python3} %py3_build -%endif ###################################################################### %install -%py2_install -mv $RPM_BUILD_ROOT/%{_bindir}/bitmath $RPM_BUILD_ROOT/%{_bindir}/bitmath-2.7 - -%if 0%{?with_python3} %py3_install pushd $RPM_BUILD_ROOT/%{_bindir}/ ln -s bitmath bitmath-%{python3_version} popd -%endif # with_python3 mkdir -p $RPM_BUILD_ROOT/%{_mandir}/man1/ cp -v *.1 $RPM_BUILD_ROOT/%{_mandir}/man1/ @@ -164,14 +96,6 @@ cp -v -r docsite/source/* $RPM_BUILD_ROOT/%{_docdir}/%{name}/docs/ rm -f $RPM_BUILD_ROOT/%{_docdir}/%{name}/docs/NEWS.rst ###################################################################### -%files -n python2-bitmath -%{python2_sitelib}/* -%doc README.rst NEWS.rst LICENSE -%doc %{_mandir}/man1/bitmath.1* -%doc %{_docdir}/%{name}/docs/ -%{_bindir}/bitmath-2.7 - -%if 0%{?with_python3} %files -n python3-bitmath %{python3_sitelib}/* %doc README.rst NEWS.rst LICENSE @@ -179,7 +103,6 @@ rm -f $RPM_BUILD_ROOT/%{_docdir}/%{name}/docs/NEWS.rst %doc %{_docdir}/%{name}/docs/ %{_bindir}/bitmath %{_bindir}/bitmath-%{python3_version} -%endif # with_python3 ###################################################################### %changelog diff --git a/python-bitmath.spec.in b/python-bitmath.spec.in index bed1b0b..3a9a67e 100644 --- a/python-bitmath.spec.in +++ b/python-bitmath.spec.in @@ -1,18 +1,3 @@ -%if 0%{?rhel} && 0%{?rhel} <= 6 -%{!?__python2: %global __python2 /usr/bin/python2} -%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} -%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} -%{!?py2_build: %global py2_build python setup.py build} -%{!?py2_install: %global py2_install python setup.py install -O1 --root=$RPM_BUILD_ROOT} -%endif - -%if 0%{?fedora} -%{!?python3_version: %global python3_version %(%{__python3} -c "import sys; sys.stdout.write(sys.version[:3])")} -%global with_python3 1 -%else -%global with_python3 0 -%endif - %global _short_name bitmath %global _short_release 1 @@ -27,20 +12,9 @@ Source0: https://github.com/tbielawa/bitmath/archive/%{version}.%{_short_release Url: https://github.com/tbielawa/bitmath BuildArch: noarch -BuildRequires: python2-mock -BuildRequires: python2-nose -BuildRequires: python2-progressbar -BuildRequires: python2-setuptools -BuildRequires: python2-devel -%if 0%{?with_python3} BuildRequires: python3-devel -BuildRequires: python3-mock -BuildRequires: python3-nose +BuildRequires: python3-pytest BuildRequires: python3-setuptools -%endif -%{?el6:Requires: python-argparse} -%{?el6:BuildRequires: python-argparse} -%{?el6:BuildRequires: python-unittest2} %description bitmath simplifies many facets of interacting with file sizes in @@ -65,34 +39,6 @@ always at 100%. ###################################################################### # Sub-package setup -%package -n python2-bitmath -Summary: Aids representing and manipulating file sizes in various prefix notations -%{?python_provide:%python_provide python2-bitmath} - -%description -n python2-bitmath -bitmath simplifies many facets of interacting with file sizes in -various units. Examples include: converting between SI and NIST prefix -units (GiB to kB), converting between units of the same type (SI to -SI, or NIST to NIST), basic arithmetic operations (subtracting 42KiB -from 50GiB), and rich comparison operations (1024 Bytes == 1KiB), -bitwise operations, sorting, automatic best human-readable prefix -selection, and completely customizable formatting. - -In addition to the conversion and math operations, bitmath provides -human readable representations of values which are suitable for use in -interactive shells as well as larger scripts and applications. It can -also read the capacity of system storage devices. bitmath can parse -strings (like "1 KiB") into proper objects and has support for -integration with the argparse module as a custom argument type and the -progressbar module as a custom file transfer speed widget. - -bitmath is thoroughly unittested, with almost 200 individual tests (a -number which is always increasing). bitmath's test-coverage is almost -always at 100%. - -#--------------------------------------------------------------------- - -%if 0%{?with_python3} %package -n python3-bitmath Summary: Aids representing and manipulating file sizes in various prefix notations %{?python_provide:%python_provide python3-bitmath} @@ -117,22 +63,18 @@ progressbar module as a custom file transfer speed widget. bitmath is thoroughly unittested, with almost 200 individual tests (a number which is always increasing). bitmath's test-coverage is almost always at 100%. -%endif # with_python3 ###################################################################### %check -nosetests -v -%if 0%{?with_python3} # We can't run the progressbar and argparse tests in python3 until # progressbar has a python3 package available :( # # Skip those tests for now and run the rest -nosetests-%{python3_version} -e 'test_FileTransferSpeed' \ +pytest -e 'test_FileTransferSpeed' \ -e 'test_BitmathType_' \ -I '.*test_argparse_type.py' \ -I '.*test_progressbar.py' -v -%endif # with_python3 ###################################################################### %prep @@ -140,22 +82,14 @@ nosetests-%{python3_version} -e 'test_FileTransferSpeed' \ ###################################################################### %build -%py2_build -%if 0%{?with_python3} %py3_build -%endif ###################################################################### %install -%py2_install -mv $RPM_BUILD_ROOT/%{_bindir}/bitmath $RPM_BUILD_ROOT/%{_bindir}/bitmath-2.7 - -%if 0%{?with_python3} %py3_install pushd $RPM_BUILD_ROOT/%{_bindir}/ ln -s bitmath bitmath-%{python3_version} popd -%endif # with_python3 mkdir -p $RPM_BUILD_ROOT/%{_mandir}/man1/ cp -v *.1 $RPM_BUILD_ROOT/%{_mandir}/man1/ @@ -164,14 +98,6 @@ cp -v -r docsite/source/* $RPM_BUILD_ROOT/%{_docdir}/%{name}/docs/ rm -f $RPM_BUILD_ROOT/%{_docdir}/%{name}/docs/NEWS.rst ###################################################################### -%files -n python2-bitmath -%{python2_sitelib}/* -%doc README.rst NEWS.rst LICENSE -%doc %{_mandir}/man1/bitmath.1* -%doc %{_docdir}/%{name}/docs/ -%{_bindir}/bitmath-2.7 - -%if 0%{?with_python3} %files -n python3-bitmath %{python3_sitelib}/* %doc README.rst NEWS.rst LICENSE @@ -179,7 +105,6 @@ rm -f $RPM_BUILD_ROOT/%{_docdir}/%{name}/docs/NEWS.rst %doc %{_docdir}/%{name}/docs/ %{_bindir}/bitmath %{_bindir}/bitmath-%{python3_version} -%endif # with_python3 ###################################################################### %changelog