Bug 1323247 - lcm: Provide a Python 3 subpackage
Summary: lcm: Provide a Python 3 subpackage
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: lcm
Version: 25
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Dan Callaghan
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3 PY3PATCH-AVAILABLE
TreeView+ depends on / blocked
 
Reported: 2016-04-01 15:51 UTC by Tomas Orsava
Modified: 2016-08-26 05:22 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-08-26 05:22:50 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Patch that adds Python 3 support (4.92 KB, patch)
2016-08-24 17:23 UTC, Tomas Orsava
no flags Details | Diff
Patch that adds Python 3 support (5.09 KB, patch)
2016-08-25 09:15 UTC, Tomas Orsava
no flags Details | Diff

Description Tomas Orsava 2016-04-01 15:51:15 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].

The current best practice is to provide subpackages for the two Python
versions (called "Common SRPM" in the guidelines). Alternatively, if
nothing depends on your Python2 package, you can just switch to Python 3
entirely.

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 15:52:35 UTC
Hello Dan,

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 04:12:08 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 25 development cycle.
Changing version to '25'.

Comment 3 Dan Callaghan 2016-08-15 08:42:16 UTC
Adding a Python 3 subpackage is not easy. The lcm build does not use setuptools, it builds with automake using AM_PATH_PYTHON which doesn't have any support for side-by-side Python 2 and Python 3 builds, it just builds for whatever is the first Python version it finds.

Comment 4 Tomas Orsava 2016-08-15 09:12:27 UTC
From my reading it seems there is a way to specify the Python version:

$ export PYTHON_VERSION=$(python -c "import sys; print(\"%s.%s\" % sys.version_info[:2])")

https://lcm-proj.github.io/build_instructions.html

Comment 5 Petr Viktorin (pviktori) 2016-08-15 09:27:17 UTC
Here's what I've seen packages do in similar cases:

- In build, copy the source to a separate directory, and do an extra build there passing python3 to configure. Then do the same in install. See [pyglet] for a very simple example. There might be ways to avoid building everything once.

- Create a new package just for the py3 bindings.

- Work with upstream to support side-by-side py2/py3 builds.

- Drop Python 2.


As always, let us know if you need help. If you'd like to invite others to solve this, you can set thit bug to block [PY3PATCH-REQUESTED].


[pyglet] http://pkgs.fedoraproject.org/cgit/rpms/python-pyglet.git/tree/python-pyglet.spec#n109
[PY3PATCH-REQUESTED] https://bugzilla.redhat.com/show_bug.cgi?id=1333765

Comment 6 Dan Callaghan 2016-08-23 23:50:21 UTC
A patch would be very welcome, I don't actually use lcm or have any experience with it, I've kind of ended up maintaining it by default because... reasons.

I guess the simplest (but most wasteful) option is just redo the whole build a second time with Python 3 enabled and then grab the modules out of that at the end.

Comment 7 Tomas Orsava 2016-08-24 16:53:11 UTC
I'll try to make a patch for that.

Comment 8 Tomas Orsava 2016-08-24 17:23:20 UTC
Created attachment 1193755 [details]
Patch that adds Python 3 support

Here's the patch!

%changelog:
- Added support for Python 3 — new subpackage lcm-python3
- The package is now being built two times, once with Python 2 bindings and
  the second time with Python 3 bindigs
- Renamed subpackage lcm-python to lcm-python2, added provides and obsoletes
  for the name lcm-python

What do you think?

Comment 9 Dan Callaghan 2016-08-25 03:47:37 UTC
Thanks Tomas.

I guess if we are renaming the -python subpackage we might as well switch the name around to the preferred naming style (python2-lcm / python3-lcm) right?

Also we can probably use the %{python_provide} macro to handle the Provides/Obsoletes.

Comment 10 Tomas Orsava 2016-08-25 09:15:27 UTC
Created attachment 1193932 [details]
Patch that adds Python 3 support

Oh, you're absolutely right, I thought there was a naming exception for bindings, I was mistaken.

Here's the updated version!

However, the explicit Provides and Obsoletes have to stay to provide the old name lcm-python.

Koji scratch build: http://koji.fedoraproject.org/koji/taskinfo?taskID=15373678

Comment 11 Dan Callaghan 2016-08-26 05:22:50 UTC
Thanks Tomas! Yes you are right, we need to explicitly Provide/Obsolete the lcm-python name.

Built in rawhide: http://koji.fedoraproject.org/koji/buildinfo?buildID=794528

I won't push this to stable releases, unless somebody particularly wants it.


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