Red Hat Bugzilla – Bug 1314047
doclifter: Switch to Python 3
Last modified: 2016-07-26 00:39:25 EDT
Upstream, this software supports Python 3. Please provide a Python 3
package for Fedora.
According to the Python packaging guidelines , 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 .
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!
The latest version 2.17 has been built for Rawhide:
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:
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):
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.
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.
I've contacted the upstream developer Eric S. Raymond, waiting for the answer.
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
2. When I rectified that error, I tripped over this bug:
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 ?
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.)
err, I meant Fedora 23
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.
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).
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.
This bug appears to have been reported against 'rawhide' during the Fedora 25 development cycle.
Changing version to '25'.