Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.

Bug 1314043

Summary: dnsyo: Switch to Python 3
Product: [Fedora] Fedora Reporter: Tomas Orsava <torsava>
Component: dnsyoAssignee: Rick Elrod <relrod>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 27CC: ishcherb, jrowens.fedora, pviktori, relrod
Target Milestone: ---Flags: dkrejci: needinfo? (relrod)
dkrejci: needinfo? (relrod)
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On:    
Bug Blocks: 1285816, 1312032    
Attachments:
Description Flags
pure python3 spec patch none

Description Tomas Orsava 2016-03-02 14:22:11 EST
Upstream, this software supports Python 3. Please provide a Python 3
package for Fedora.


According to the Python packaging guidelines [0], software must be
packaged for Python 3 if upstream supports it.
The guidelines give detailed information on how to do this, and even
provide an example spec file [1].

Since users aren't expected to import this tool from Python code,
you can just switch to /usr/bin/python3. Alternatively, if you want or
need to keep a Python 2 version, the current best practice is to provide
subpackages -- this is called "Common SRPM" in the guidelines.

It's ok to do this in Rawhide only, however, it would be greatly
appreciated if you could push it to Fedora 24 as well.


If anything is unclear, or if you need any kind of assistance with the
porting, you can ask on IRC (#fedora-python on Freenode), or reply here.
We'll be happy to help!


[0] https://fedoraproject.org/wiki/Packaging:Python
[1] https://fedoraproject.org/wiki/Packaging:Python#Example_common_spec_file
Comment 1 Dominika Krejčí 2016-04-22 10:57:43 EDT
Hello Ricky,

Do you need any help adding Python 3 support to the RPM?

If you need more instructions, a [guide] for porting Python-based RPMs is available.

[guide] http://python-rpm-porting.readthedocs.org/en/latest/index.html
Comment 2 Jan Kurik 2016-07-26 00:58:27 EDT
This bug appears to have been reported against 'rawhide' during the Fedora 25 development cycle.
Changing version to '25'.
Comment 3 J. Randall Owens 2016-08-17 00:23 EDT
Created attachment 1191466 [details]
pure python3 spec patch

The new koji build 2.0.7-1.fc26 Requires all the python2 and python3 stuff to install, and includes both dnsyo (for python2) and python3-dnsyo. Is this what we want? I'd think we'd want either just python3 in this one, or separate python2 & python3 subpackages, from vague impressions I've gotten of the packages I've installed and updated. But python certainly isn't my thing, much less the multiversioning of it, so I could be very wrong. If you do want just the python3, though, here's a spec patch for that (not that it isn't obvious & simple, if this were one's goal).
Comment 4 J. Randall Owens 2016-08-17 00:43:35 EDT
After a quick scan of https://fedoraproject.org/wiki/Packaging:Python , it looks like the following apply to building python packages:

"Must: If you build for more than one python runtime you must use the %python_provide macro.
"Must: If you build for a single python runtime you must add %python_provide python-$module so that the current default python is provided from the unversioned python package."

And the %python_provide is what give you the python2-foo & python3-foo provides for the subpackages. I think the page just kind of assumes that it's obvious you have to provide subpackages, to the point that they don't even come right out and say so. Or maybe I'm reading too much into it.

Anyway, it looks as though yes, it should either be python3-only 'dnsyo', or build two subpackages, 'python2-dnsyo' & 'python3-dnsyo'.
Comment 5 Petr Viktorin 2016-08-17 07:33:15 EDT
Hello,
The general idea is:
- If the package has a Python library that people can import from their code, it's better to include both the Python2 and the Python3 version. That way people aren't forced to switch to py3 immediately, but have some transition period.
- If the package is just used for the script in /usr/bin, you can just switch it to py3 entirely.

The Reviewer checklist in the guidelines is targetting libraries (without saying so – that's a bug in the guidelines – sorry!)
Comment 6 Rick Elrod 2016-08-17 16:55:56 EDT
(In reply to Petr Viktorin from comment #5)
> - If the package is just used for the script in /usr/bin, you can just
> switch it to py3 entirely.

I suppose I can do that, but then I have to maintain two separate specfiles for the epel vs fedora branches, right? So it might be easier to just keep both in the specfile for now so it can keep being shared/merged cleanly between the branches.

I'll take a closer look at this later tonight.
Comment 7 Dominika Krejčí 2016-10-05 11:17:48 EDT
Hello Ricky, how is it going? Do you need some help?
Comment 8 Iryna Shcherbina 2017-11-10 10:28:43 EST
Hi Ricky,

dnsyo still requires both Python stacks:

$ dnf repoquery --disablerepo=* --enablerepo=rawhide --requires dnsyo
/usr/bin/python
/usr/bin/python3
PyYAML
python(abi) = 2.7
python(abi) = 3.6
python-dns
python-requests
python3-PyYAML
python3-dns
python3-requests


I have prepared a Pagure PR to switch dnsyo to Python 3 in Fedora only:

https://src.fedoraproject.org/rpms/dnsyo/pull-request/1

I would ask you to have a look at it and comment or merge at will. Details and scratch builds are in the PR description.
Comment 9 Fedora End Of Life 2017-11-16 14:38:54 EST
This message is a reminder that Fedora 25 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 25. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '25'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 25 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.
Comment 10 J. Randall Owens 2017-11-16 17:14:14 EST
dnsyo-2.0.7-4.fc27.noarch still requires both python(abi) 2.7 & 3.6, /usr/bin/python & /usr/bin/python3, etc.