From f8f9d99f7c0765d314fd68f9dd58c90e37a66918 Mon Sep 17 00:00:00 2001 From: Miro Hrončok Date: May 10 2018 10:32:42 +0000 Subject: Switch to Python 3 on Fedora > 28 and EL > 7 - Drop Groups - Switch to %{buildroot} - Switch to %py_build and _install --- diff --git a/fedpkg.spec b/fedpkg.spec index d1fef0a..9a247c6 100644 --- a/fedpkg.spec +++ b/fedpkg.spec @@ -5,25 +5,41 @@ Name: fedpkg Version: 1.32 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Fedora utility for working with dist-git -Group: Applications/System License: GPLv2+ URL: https://pagure.io/fedpkg Source0: https://pagure.io/releases/fedpkg/%{name}-%{version}.tar.bz2 BuildArch: noarch +# fedpkg command switched to python3 on Fedora 29 and RHEL > 7: +%if 0%{?fedora} > 28 || 0%{?rhel} > 7 +%bcond_with python2 +%else +%bcond_without python2 +%endif + BuildRequires: pkgconfig +BuildRequires: bash-completion +BuildRequires: git + +Requires: bodhi-client +Requires: fedora-packager +Requires: koji +Requires: redhat-rpm-config + +%if %{with python2} +# This package redefines __python and can use the python_ macros +%global __python %{__python2} + BuildRequires: python2-devel # We br these things for man page generation due to imports BuildRequires: python2-rpkg >= 1.51 -BuildRequires: bash-completion # This until fedora-cert gets fixed BuildRequires: python2-fedora # For testing -BuildRequires: git BuildRequires: python2-mock %if 0%{?rhel} @@ -48,21 +64,37 @@ BuildRequires: python2-bugzilla Requires: python2-bugzilla %endif -Requires: bodhi-client -Requires: fedora-packager -Requires: koji -Requires: redhat-rpm-config Requires: python2-rpkg >= 1.51 Requires: python2-fedora Requires: python2-openidc-client +%else # python3 +# This package redefines __python and can use the python_ macros +%global __python %{__python3} + +BuildRequires: python3-devel +BuildRequires: python3-rpkg >= 1.51 +# This until fedora-cert gets fixed +BuildRequires: python3-fedora +# For testing +BuildRequires: python3-mock +BuildRequires: python3-unittest2 +BuildRequires: python3-nose +BuildRequires: python3-setuptools +BuildRequires: python3-bugzilla + +Requires: python3-bugzilla +Requires: python3-rpkg >= 1.51 +Requires: python3-fedora +Requires: python3-openidc-client +%endif + %description Provides the fedpkg command for working with dist-git %package -n fedpkg-stage Summary: Fedora utility for working with dist-git -Group: Applications/System Requires: %{name} = %{version}-%{release} %description -n fedpkg-stage @@ -72,22 +104,27 @@ Provides the fedpkg command for working with dist-git %setup -q %build -%{__python} setup.py build +%py_build %{__python} doc/fedpkg_man_page.py > fedpkg.1 %install -%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT -%{__install} -d $RPM_BUILD_ROOT%{_mandir}/man1 -%{__install} -p -m 0644 fedpkg.1 $RPM_BUILD_ROOT%{_mandir}/man1 +%py_install +%{__install} -d %{buildroot}%{_mandir}/man1 +%{__install} -p -m 0644 fedpkg.1 %{buildroot}%{_mandir}/man1 %if 0%{?rhel} && 0%{?rhel} == 7 # The completion file must be named similarly to the command. -mv $RPM_BUILD_ROOT%{compdir}/fedpkg.bash $RPM_BUILD_ROOT%{compdir}/fedpkg +mv %{buildroot}%{compdir}/fedpkg.bash %{buildroot}%{compdir}/fedpkg %endif %check +%if 0%{?rhel} == 6 +# cannot use -m nose on EL6 (python 2.6) nosetests +%else +%{__python} -m nose +%endif @@ -99,8 +136,8 @@ nosetests %{_bindir}/%{name} %{_mandir}/*/* # For noarch packages: sitelib -%{python2_sitelib}/%{name} -%{python2_sitelib}/%{name}-%{version}-py*.egg-info +%{python_sitelib}/%{name} +%{python_sitelib}/%{name}-%{version}-py*.egg-info # zsh completion %{_datadir}/zsh/site-functions/_%{name} @@ -110,6 +147,12 @@ nosetests %changelog +* Thu May 10 2018 Miro Hrončok - 1.32-2 +- Switch to Python 3 on Fedora > 28 and EL > 7 +- Drop Groups +- Switch to %%{buildroot} +- Switch to %%py_build and _install + * Thu Mar 01 2018 Chenxiong Qi - 1.32-1 - Add requests-tests-repo command (mvadkert) - Use PDC instead of Bodhi to get the active release branches - #187 (mprahl)