Bug 1314047

Summary: doclifter: Switch to Python 3
Product: [Fedora] Fedora Reporter: Tomas Orsava <torsava>
Component: doclifterAssignee: Mario Blättermann <mario.blaettermann>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 25CC: mario.blaettermann, mhroncok, pviktori
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-12-12 11:00:45 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1285816    

Description Tomas Orsava 2016-03-02 19:30:03 UTC
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 Mario Blättermann 2016-03-20 20:54:48 UTC
The latest version 2.17 has been built for Rawhide:
http://koji.fedoraproject.org/koji/taskinfo?taskID=13401553

A build for f24 is also done, but I'm not sure if I should switch to the Python 3 version right now. After some tests with a locally built package under f23, I don't see any peculiarities so far in doclifter itself. The batch script "manlifter" included in the package doesn't work either:

$ manlifter
  File "/usr/bin/manlifter", line 181
    except OSError, e:
                  ^
SyntaxError: invalid syntax


This is the appropriate part of the Python file:

def deploy(source, target):
    try:
        os.rename(source, target)
    except OSError, e:
        return(3, "Rename of %s to %s failed, errno = %d" % (source, target, e.errno,))
    return (0, "")


Unfortunately, I don't have any Python skills. Any help is very appreciated.

Comment 2 Petr Viktorin (pviktori) 2016-03-21 12:55:57 UTC
Indeed, the manlifter script is not ported, despite the NEWS entry for 2.16 saying otherwise.

Can you bring this up with the upstream? I can try writing a patch but I'd need to get familiar with the code first.

Comment 3 Mario Blättermann 2016-03-21 18:30:07 UTC
I've contacted the upstream developer Eric S. Raymond, waiting for the answer.

Comment 4 Mario Blättermann 2016-03-22 10:50:51 UTC
I've got an answer from Eric:


1. I ported doclifter to run under 2 or 3, but somehow forgot to do the same
to manlifter.  Your error is Python 3 tripping over Python 2 exception
syntax. Sorry.

2. When I rectified that error, I tripped over this bug:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=764848

It seems that in some Python 3 versions, including 3.4.2~rc1-1 and
the 3.4.3 version I'm running, the subprocess.getstatusoutput() function
has a bug that can confuse manlifter into thinking the called doclifter
process received signal 2 (SIGINT) when it was actually trying to return
termination status 2.

The head version in the repository is now fully ported to run under 2 or 3,
but because of this bug I have set the shebang line to call "python2".  Is
this a satisfactory workaround under Red Hat?  If it is, I'll ship a 2.18
point release for you to package.

At some future date, when it is esrablished that the bug has been fixed, you
can change the shebang line to call "python" and it should work.


Any idea how to fix it ?

Comment 5 Petr Viktorin (pviktori) 2016-03-24 20:07:13 UTC
I think it's satisfactory; as Eric says, changing the shebang could be done in Fedora's specfile.

I can't reproduce the error on Pyhon 3.4.3 in Fedora 24. (I tried with subprocess.getstatusoutput("exit 2") and subprocess.getstatusoutput("sleep 500") and killing the sleep with SIGINT, and I got (2, '') and (-2, '') respectively.)

Comment 6 Petr Viktorin (pviktori) 2016-03-24 20:07:36 UTC
err, I meant Fedora 23

Comment 7 Mario Blättermann 2016-03-24 20:23:20 UTC
Strange, with the same python version 3.4.3 I still get the same syntax error. That's why I won't switch back to a Py2/py3 mix to get it running for me in f23; I will keep the current v2.16 there.

I'll do a test installation of f24 next days. If it works there for me, then I will push the built package to testing.

Comment 8 Mario Blättermann 2016-03-30 11:01:23 UTC
Just tested on a fresh f24 alpha, I get the same error message from manlifter. It is strange that the error message is not always reproducible, see comment #5. I've set the shebang in manlifter explicitely to /usr/bin/python3 because /usr/bin/python still links to the Python2 interpreter. Changing it to the latter would lead to a mix of Py2 and Py3 in the package. What to do?

BTW, I don't have a Rawhide to test whether it would work there. But I'm afraid it would also fail, Rawhide has the same Python3 version (3.5.1).

Comment 9 Mario Blättermann 2016-03-30 11:23:52 UTC
It works fine with Python2 so far. But it needs root permissions to create the subdirectory "xmlman" for the xml'ed man pages. I haven't used manlifter for some time, don't know anymore if this is the default behavior.

Comment 10 Jan Kurik 2016-07-26 04:39:25 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 25 development cycle.
Changing version to '25'.

Comment 11 Fedora End Of Life 2017-11-16 19:40:04 UTC
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 12 Fedora End Of Life 2017-12-12 11:00:45 UTC
Fedora 25 changed to end-of-life (EOL) status on 2017-12-12. Fedora 25 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 13 Miro Hrončok 2017-12-12 12:20:51 UTC
This was switched already:

Sat Feb 27 2016 Mario Blättermann <mario.blaettermann> - 2.16-1
- New upstream version
- Switch to Python 3

Thanks, Mario.