Bug 1024805 - mock: Use Python 3 instead of Python 2
Summary: mock: Use Python 3 instead of Python 2
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: mock
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miroslav Suchý
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On: PY3DNF 1024806 1136366
Blocks: PY3PACKAGER
TreeView+ depends on / blocked
 
Reported: 2013-10-30 13:15 UTC by Miro Hrončok
Modified: 2014-11-18 16:23 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-11-18 16:23:26 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Miro Hrončok 2013-10-30 13:15:38 UTC
Hi, we would like to use Python 3 on the default installation instead of Python 2 on Fedora 22.

https://fedoraproject.org/wiki/Changes/Python_3_as_Default

While this package is not in minimal buildroot, it belongs to fedora-packager stack. We would like to switch to Python 3 there as well.

The goal here is, that for F22 you should use Python 3 instead of Python 2 in this package.

Please, help us update to Python 3 flawlessly.

Check if upstream already support Python 3, if yes, use it and add the support to the package.

If upstream doesn't support Python 3 yet, encourage it to do so by sending patches and offering your help.

When upstream is dead or unwilling to support Python 3, say so and we can solve the problem together.

Chances are, that you ARE the upstream. In that case, everything is easier, just do it yourself.

There is a table on wiki, that should list your package. Chances are, that you can see an upstream link that covers the problem. Anyway, please update the table with information you know.

https://fedoraproject.org/wiki/User:Churchyard/python3#fedora-packager

I offer my help with this task, so if you have no idea, how to work on this, or it is just not your priority, don't hesitate to ask for help.

(As you've already realized, this is a bulk text, so if something is not quite exact about your package, sorry for that, just ask)

Comment 1 Clark Williams 2013-11-04 17:17:00 UTC
Interesting. I started looking at what it would take to port mock to python3 last week and now I actually have a request for it :)

I created a work-python3 branch in my local git tree, ran 2to3 over the mock directory and then started looking at the changes. 

So far I have two things that are show-stoppers:

1. Figuring out how to tell rpm to use python3 to byte-compile modules when packaging.

2. Translating the trace_decorator code. 

I'm sure more things will crop up as we move forward.

The question is, should we try and maintain 2 and 3 simultaneously or should we do a cut-over to 3 at some point?

Comment 2 Miro Hrončok 2013-11-04 17:46:51 UTC
I believe that RPM bytecompiles python3 modules by default, see for example this log:

http://kojipkgs.fedoraproject.org/packages/python-setuptools/0.9.8/2.fc20/data/logs/noarch/build.log

(search for byte-compiling)

I think that dropping Python 2 support is not yet a very good idea for systems with doesn't offer Python 3, such as RHEL/CentOS.

It's relatively easy to keep one code working with Pythons 2.6, 2.7 and 3.3.

This is a very good text about it:

http://lucumr.pocoo.org/2013/5/21/porting-to-python-3-redux/

Comment 3 Miroslav Suchý 2014-10-15 13:52:00 UTC
Thanks to msimacek work, mock and mockchain are python3 ready.
If you change 
  #!/usr/bin/python
in both scripts to
  #!/usr/bin/python3
it will work.

I do not want to change it for current RHELs and stable Fedora and F21, which is just before release.

I changed those shebang by sed in spec file for F22. Commit e75d55b.

However there is one problem. There is no lvm2-python3-libs yet (see bug 1136366).

Therefore build of mock-lvm subpackage is temporary disabled for F22. I hope I can enable it before we cut next release.

Comment 4 Pierre-YvesChibon 2014-10-27 17:11:06 UTC
By curiosity, from which version of mock is the API compatible py3 ?

Comment 5 Miroslav Suchý 2014-10-27 18:50:45 UTC
mock-1.2.0 is the first version which works under python3

Comment 6 Miroslav Suchý 2014-11-18 16:23:26 UTC
rawhide version of mock now run under python3


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