%global srcname prometheus_client
Name: python-%{srcname}
Version: 0.6.0
Release: 3%{?dist}
Summary: The Python client for Prometheus
License: ASL 2.0
URL: https://github.com/prometheus/client_python
Source0: %{url}/archive/v%{version}/client_python-v%{version}.tar.gz
BuildArch: noarch
%description
%{summary}.
# This was mis-packaged in the past and provided a Python 2 and Python 3 variant
# despite it not being a library. Unfortunately a package depends on the Python 2
# build and uses it as a library. In the future there should only be a "twine"
# RPM.
%package -n python3-%{srcname}
Summary: %{summary}
Requires: %{py3_dist twisted}
Requires: %{py3_dist decorator}
BuildRequires: python3-devel
BuildRequires: %{py3_dist decorator}
BuildRequires: %{py3_dist pytest}
BuildRequires: %{py3_dist twisted}
%{?python_provide:%python_provide python3-%{srcname}}
%description -n python3-%{srcname}
%{summary}.
%prep
%autosetup -p1 -n client_python-%{version}
sed -i '1s=^#!/usr/bin/env python==' prometheus_client/*.py
sed -i '1s=^#!/usr/bin/python==' prometheus_client/*.py
sed -i '1s=^#!/usr/bin/python==' prometheus_client/twisted/*.py
sed -i '1s=^#!/usr/bin/python==' prometheus_client/bridge/*.py
sed -i '1s=^#!/usr/bin/python==' prometheus_client/openmetrics/*.py
%build
%py3_build
%install
%py3_install
# Unbundle "decorator"
rm -f %{buildroot}/%{python3_sitelib}/%{srcname}/decorator.py
rm -f %{buildroot}/%{python3_sitelib}/%{srcname}/__pycache__/decorator.cpython-%{python3_version_nodots}.opt-1.pyc
rm -f %{buildroot}/%{python3_sitelib}/%{srcname}/__pycache__/decorator.cpython-%{python3_version_nodots}.pyc
ln -s ../decorator.py %{buildroot}/%{python3_sitelib}/%{srcname}/decorator.py
ln -s ../../__pycache__/decorator.cpython-%{python3_version_nodots}.pyc \
%{buildroot}/%{python3_sitelib}/%{srcname}/__pycache__/decorator.cpython-%{python3_version_nodots}.pyc
ln -s ../../__pycache__/decorator.cpython-%{python3_version_nodots}.opt-1.pyc \
%{buildroot}/%{python3_sitelib}/%{srcname}/__pycache__/decorator.cpython-%{python3_version_nodots}.opt-1.pyc
%check
pytest-3
%files -n python3-%{srcname}
%license LICENSE
%doc README.md MAINTAINERS.md
%{python3_sitelib}/%{srcname}
%{python3_sitelib}/%{srcname}-%{version}-py%{python3_version}.egg-info
%changelog
* Sun Aug 18 2019 Miro Hrončok <mhroncok@redhat.com> - 0.6.0-3
- Rebuilt for Python 3.8
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.6.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Thu Feb 21 2019 mprahl <mprahl@redhat.com> - 0.6.0-1
- Update to 0.6.0
* Wed Feb 20 2019 mprahl <mprahl@redhat.com> - 0.5.0-2
- Remove #!/usr/bin/python line from prometheus_client/openmetrics/*.py
* Thu Feb 07 2019 mprahl <mprahl@redhat.com> - 0.5.0-1
- Update to 0.5.0
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Mon Jan 14 2019 Miro Hrončok <mhroncok@redhat.com> - 0.2.0-4
- Subpackage python2-prometheus_client has been removed
See https://fedoraproject.org/wiki/Changes/Mass_Python_2_Package_Removal
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 0.2.0-2
- Rebuilt for Python 3.7
* Sat Jun 09 2018 Jeremy Cline <jeremy@jcline.org> - 0.2.0-1
- Initial package