Bug 1314047 - doclifter: Switch to Python 3
doclifter: Switch to Python 3
Status: ASSIGNED
Product: Fedora
Classification: Fedora
Component: doclifter (Show other bugs)
25
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Mario Blättermann
Fedora Extras Quality Assurance
:
Depends On:
Blocks: PYTHON3
  Show dependency treegraph
 
Reported: 2016-03-02 14:30 EST by Tomas Orsava
Modified: 2016-07-26 00:39 EDT (History)
2 users (show)

See Also:
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: ---


Attachments (Terms of Use)

  None (edit)
Description Tomas Orsava 2016-03-02 14:30:03 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 Mario Blättermann 2016-03-20 16:54:48 EDT
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 2016-03-21 08:55:57 EDT
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 14:30:07 EDT
I've contacted the upstream developer Eric S. Raymond, waiting for the answer.
Comment 4 Mario Blättermann 2016-03-22 06:50:51 EDT
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 2016-03-24 16:07:13 EDT
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 2016-03-24 16:07:36 EDT
err, I meant Fedora 23
Comment 7 Mario Blättermann 2016-03-24 16:23:20 EDT
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 07:01:23 EDT
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 07:23:52 EDT
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 00:39:25 EDT
This bug appears to have been reported against 'rawhide' during the Fedora 25 development cycle.
Changing version to '25'.

Note You need to log in before you can comment on or make changes to this bug.