Blame python-speedtest-cli.spec

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