%if 0%{?fedora} || 0%{?rhel} >= 8
%bcond_without python3
%else # 0#{?fedora} || 0#{?rhel} >= 8
%bcond_with python3
%endif # 0#{?fedora} || 0#{?rhel} >= 8
%global pypi_name speedtest-cli
%global global_desc Command line interface for testing internet bandwidth using speedtest.net
Name: python-%{pypi_name}
Version: 1.0.2
Release: 8%{?dist}
Summary: %{global_desc}
License: ASL 2.0
URL: https://pypi.python.org/pypi/%{pypi_name}
Source0: https://files.pythonhosted.org/packages/source/s/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
BuildArch: noarch
BuildRequires: help2man
%description
%{global_desc}.
%package -n python2-%{pypi_name}
Summary: %{global_desc}
BuildRequires: python2-devel
BuildRequires: python2-setuptools
%{?python_provide:%python_provide python2-%{pypi_name}}
%description -n python2-%{pypi_name}
%{global_desc}.
%if %{with python3}
%package -n python3-%{pypi_name}
Summary: %{global_desc}
BuildRequires: python3-devel
BuildRequires: python3-setuptools
%{?python_provide:%python_provide python3-%{pypi_name}}
%description -n python3-%{pypi_name}
%{global_desc}.
%endif # with python3
%prep
%autosetup -n %{pypi_name}-%{version}
%{__rm} -fr *.egg-info
%build
%py2_build
%if %{with python3}
%py3_build
%endif # with python3
%install
%{__mkdir} -p %{buildroot}%{_mandir}/man1
%py2_install
for f in $(%{_bindir}/find %{buildroot}%{_bindir} -type f -name '*')
do
/bin/ln -f ${f} ${f}-%{python2_version}
done
for f in $(%{_bindir}/find %{buildroot}%{python2_sitelib} -type f -name '*.py')
do
%{__sed} -i.old -e 's~#![ \t]*.*/bin/env[ \t]*python~#!%{__python2}~g' ${f}
%{__chmod} -c 0755 ${f}
/bin/touch -r ${f}.old ${f} && rm -f ${f}.old
done
%if %{with python3}
for f in $(%{_bindir}/find %{buildroot}%{_bindir} -type f -not -name '*-%{python2_version}')
do
%{__rm} -f ${f}
done
%py3_install
for f in $(%{_bindir}/find %{buildroot}%{_bindir} -type f -not -name '*-%{python2_version}')
do
/bin/ln -f ${f} ${f}-%{python3_version}
done
for f in $(%{_bindir}/find %{buildroot}%{python3_sitelib} -type f -name '*.py')
do
%{__sed} -i.old -e 's~#![ \t]*.*/bin/env[ \t]*python~#!%{__python3}~g' ${f}
%{__chmod} -c 0755 ${f}
/bin/touch -r ${f}.old ${f} && rm -f ${f}.old
done
export PYTHONPATH="%{buildroot}%{python3_sitelib}"
%else # with python3
export PYTHONPATH="%{buildroot}%{python2_sitelib}"
%endif # with python3
for f in $(%{_bindir}/find %{buildroot}%{_bindir} -type f -name '*' | /bin/sort )
do
of="$(/bin/basename ${f}).1"
%{_bindir}/help2man -s 1 -N -o %{buildroot}%{_mandir}/man1/${of} ${f}
done
unset PYTHONPATH
%{_bindir}/find %{buildroot} -type f -name '*.pyc' -print -delete
%{_bindir}/find %{buildroot} -type f -name '*.pyo' -print -delete
%files -n python2-%{pypi_name}
%license LICENSE
%doc PKG-INFO README.rst
%if %{with python3}
%{_bindir}/speedtest*-%{python2_version}
%{_mandir}/man1/speedtest*-%{python2_version}.1*
%else # !with python3
%{_bindir}/speedtest*
%{_mandir}/man1/speedtest*.1*
%endif # !with python3
%{python2_sitelib}/speedtest*.py*
%{python2_sitelib}/speedtest_cli-%{version}-py%{python2_version}.egg-info
%if %{with python3}
%files -n python3-%{pypi_name}
%license LICENSE
%doc PKG-INFO README.rst
%exclude %{_bindir}/speedtest*-%{python2_version}
%exclude %{_mandir}/man1/speedtest*-%{python2_version}.1*
%{_bindir}/speedtest*
%{_mandir}/man1/speedtest*.1*
%{python3_sitelib}/speedtest*.py
%{python3_sitelib}/speedtest_cli-%{version}-py%{python3_version}.egg-info
%{python3_sitelib}/__pycache__/speedtest*.cpython-%{python3_version_nodots}*.pyc
%endif # with python3
%changelog
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.2-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.2-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.2-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 1.0.2-5
- Rebuilt for Python 3.7
* Mon Feb 12 2018 Iryna Shcherbina <ishcherb@redhat.com> - 1.0.2-4
- Update Python 2 dependency declarations to new packaging standards
(See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Mon Feb 20 2017 Björn Esser <besser82@fedoraproject.org> - 1.0.2-1
- Initial import (rhbz#1425203)
* Mon Feb 20 2017 Björn Esser <besser82@fedoraproject.org> - 1.0.2-0.1
- Initial rpm-release (rhbz#1425203)