#19 Switch to Python 3 on Fedora > 28 and EL > 7
Merged 5 years ago by cqi. Opened 5 years ago by churchyard.
rpms/ churchyard/fedpkg py3_  into  master

file modified
+59 -16
@@ -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}

here

+ 

  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 @@ 

  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}

or here

+ 

+ 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 @@ 

  %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 @@ 

  %{_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
cqi commented 5 years ago

Why use unversioned python_sitelib instead?

Because it's python2 or python3 depending on the conditional at the top and __python definition.

cqi commented 5 years ago

I see. Thanks.

  # zsh completion

  %{_datadir}/zsh/site-functions/_%{name}

  
@@ -110,6 +147,12 @@ 

  

  

  %changelog

+ * Thu May 10 2018 Miro Hrončok <mhroncok@redhat.com> - 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 <cqi@redhat.com> - 1.32-1

  - Add requests-tests-repo command (mvadkert)

  - Use PDC instead of Bodhi to get the active release branches - #187 (mprahl)

  • Drop Groups
  • Switch to %{buildroot}
  • Switch to %py_build and _install

Why use unversioned python_sitelib instead?

Because it's python2 or python3 depending on the conditional at the top and __python definition.

Pull-Request has been merged by cqi

5 years ago

I suppose a new release is on it's way? Because without https://pagure.io/fedpkg/pull-request/207 and https://pagure.io/fedpkg/pull-request/214 this fedpkg update work.

@churchyard Please try fedpkg-1.33 which is now in bodhi updates.

I've seen it. Thanks. I will rebuild in my Copr with the condition changed so i can test this on Fedora 28.

Metadata