python-podman/python-podman.spec
Lokesh Mandvekar ffa67d5bf4 adjust build conditionals
Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
2022-03-09 14:53:39 -05:00

74 lines
1.8 KiB
RPMSpec

%global pypi_name podman
%global desc %{pypi_name} is a library of bindings to use the RESTful API for Podman.
%global built_tag v4.0.0
%global built_tag_strip %(b=%{built_tag}; echo ${b:1})
%global gen_version %(b=%{built_tag_strip}; echo ${b/-/"~"})
Name: python-%{pypi_name}
Epoch: 3
Version: %{gen_version}
Release: %autorelease
Summary: RESTful API for Podman
License: ASL 2.0
URL: https://github.com/containers/%{pypi_name}-py
Source0: %{url}/releases/download/%{built_tag}/%{pypi_name}-%{version}.tar.gz
BuildArch: noarch
%description
%desc
%package -n python%{python3_pkgversion}-%{pypi_name}
BuildRequires: git-core
BuildRequires: python%{python3_pkgversion}-devel
# Handle rhel/centos 8 stream conditionals for podman4 copr
%if 0%{?rhel} <= 8
BuildRequires: python%{python3_pkgversion}-pytoml
BuildRequires: python%{python3_pkgversion}-pyxdg
BuildRequires: python%{python3_pkgversion}-requests
BuildRequires: python%{python3_pkgversion}-setuptools
Requires: python%{python3_pkgversion}-pytoml
Requires: python%{python3_pkgversion}-pyxdg
Requires: python%{python3_pkgversion}-requests
%else
BuildRequires: pyproject-rpm-macros
%endif
Provides: %{pypi_name}-py = %{version}-%{release}
Summary: %{summary}
%{?python_provide:%python_provide python%{python3_pkgversion}-%{pypi_name}}
%description -n python%{python3_pkgversion}-%{pypi_name}
%desc
%prep
%autosetup -Sgit_am -n %{pypi_name}-%{built_tag_strip}
%if 0%{?fedora} || 0%{?rhel} >= 9
%generate_buildrequires
%pyproject_buildrequires %{?with_tests:-t}
%endif
%build
export PBR_VERSION="0.0.0"
%if 0%{?rhel} <= 8
%py3_build
%else
%pyproject_wheel
%endif
%install
export PBR_VERSION="0.0.0"
%if 0%{?rhel} <= 8
%py3_install
%else
%pyproject_install
%pyproject_save_files %{pypi_name}
%endif
%files -n python%{python3_pkgversion}-%{pypi_name} -f %{pyproject_files}
%license LICENSE
%doc README.md
%changelog
%autochangelog