#1 Switch to Python 3 in Fedora (rhbz#1314043)
Opened 6 years ago by ishcherb. Modified 6 years ago
rpms/ ishcherb/dnsyo master  into  rawhide

Switch to Python 3 in Fedora (rhbz#1314043)
Iryna Shcherbina • 6 years ago  
file modified
+35 -56
@@ -1,10 +1,10 @@ 

  %if 0%{?fedora}

- %global with_python3 1

+ %bcond_without python3

  %endif

  

  Name:           dnsyo

  Version:        2.0.7

- Release:        6%{?dist}

+ Release:        7%{?dist}

  Summary:        Check DNS against many global DNS servers

  

  Group:          Applications/Internet
@@ -12,24 +12,13 @@ 

  URL:            http://samarudge.github.io/dnsyo/

  Source0:        https://pypi.python.org/packages/source/d/%{name}/%{name}-%{version}.tar.gz

  BuildArch:      noarch

- BuildRequires:  python2-devel

- BuildRequires:  python2-setuptools

- 

- # For manpage

- BuildRequires:  python2-dns

- BuildRequires:  python2-requests

- BuildRequires:  python2-pyyaml

- BuildRequires:  help2man

- 

- Requires:       python2-dns

- Requires:       python2-requests

- Requires:       python2-pyyaml

  

- %if 0%{?with_python3}

+ %if %{with python3}

  BuildRequires:  python3-devel

- Buildrequires:  python3-setuptools

+ BuildRequires:  python3-setuptools

  

  # For manpage.

+ BuildRequires:  help2man

  BuildRequires:  python3-requests

  BuildRequires:  python3-dns

  BuildRequires:  python3-PyYAML
@@ -37,22 +26,21 @@ 

  Requires:       python3-requests

  Requires:       python3-dns

  Requires:       python3-PyYAML

- %endif

  

- %description

- Query over 1500 global DNS servers and colate their results.

- Track the propagation of your domains around the world.

+ %else

  

+ BuildRequires:  python2-devel

+ BuildRequires:  python2-setuptools

  

- %if 0%{?with_python3}

- %package -n python3-dnsyo

- Summary:        Check DNS against many global DNS servers

- Group:          Applications/Internet

+ Requires:       python2-dns

+ Requires:       python2-requests

+ Requires:       PyYAML

+ %endif

  

- %description -n python3-dnsyo

+ %description

  Query over 1500 global DNS servers and colate their results.

  Track the propagation of your domains around the world.

- %endif

+ 

  

  %prep

  %setup -q
@@ -64,53 +52,44 @@ 

  # 'dnspython3' distribution on Fedora any more

  sed -i -e 's/dnspython3/dnspython/g' setup.py

  

- %build

- %{__python} setup.py build

  

- 

- %if 0%{?with_python3}

- cp -r . %{py3dir}

- pushd %{py3dir}

- %{__python3} setup.py build

- popd

+ %build

+ %if %{with python3}

+ %py3_build

+ %else

+ %py2_build

  %endif

  

- %install

  

+ %install

  # For manpage.

- export PYTHONPATH=%{buildroot}%{python_sitelib}:%{buildroot}%{python3_sitelib}

+ export PYTHONPATH=%{buildroot}%{python2_sitelib}:%{buildroot}%{python3_sitelib}

  mkdir -p %{buildroot}/%{_mandir}/man1

  

- %if 0%{?with_python3}

- pushd %{py3dir}

- %{__python3} setup.py install --skip-build --root %{buildroot}

- mv %{buildroot}/%{_bindir}/%{name} %{buildroot}/%{_bindir}/python3-%{name}

- popd

- 

- help2man -N --version-string=%{version} %{buildroot}/%{_bindir}/python3-%{name} > %{buildroot}/%{_mandir}/man1/python3-%{name}.1

- %endif

- 

- %{__python} setup.py install --skip-build --root %{buildroot}

- %if 0%{?fedora}

+ %if %{with python3}

+ %py3_install

  help2man -N --version-string=%{version} %{buildroot}/%{_bindir}/%{name} > %{buildroot}/%{_mandir}/man1/%{name}.1

+ %else

+ %py2_install

  %endif

  

+ 

  %files

- %if 0%{?fedora}

- %{_mandir}/man1/%{name}.1*

- %endif

- %{python_sitelib}/%{name}/

- %{python_sitelib}/%{name}-%{version}*

  %{_bindir}/%{name}

- 

- %if 0%{?with_python3}

- %{_mandir}/man1/python3-%{name}.1*

+ %if %{with python3}

+ %{_mandir}/man1/%{name}.1*

  %{python3_sitelib}/%{name}/

  %{python3_sitelib}/%{name}-%{version}*

- %{_bindir}/python3-%{name}

+ %else

+ %{python2_sitelib}/%{name}/

+ %{python2_sitelib}/%{name}-%{version}*

  %endif

  

+ 

  %changelog

+ * Fri Apr 13 2018 Iryna Shcherbina <ishcherb@redhat.com> - 2.0.7-7

+ - Switch to Python 3 in Fedora (rhbz#1314043)

+ 

  * Wed Feb 07 2018 Iryna Shcherbina <ishcherb@redhat.com> - 2.0.7-6

  - Update Python 2 dependency declarations to new packaging standards

    (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)

This PR aims at modernizing a specfile to use Python dedicated macros, and switch dnsyo to Python 3 in Fedora.

The change is made so, for Fedora the Python 3 version of dnsyo is built, and for epel branches the Python 2 version of dnsyo is build. This way the specfile can be shared between the branches.

Koji scratch build for rawhide: https://koji.fedoraproject.org/koji/taskinfo?taskID=23045505
Koji scratch build for epel7: https://koji.fedoraproject.org/koji/taskinfo?taskID=23045508

Thank you in advance for the review.

rebased onto 94223ee

6 years ago