Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 448896 - dev-python/pygobject-3.4.2-r1 (and others): py-compile coming from <automake-1.12.6 are broken with py3
Summary: dev-python/pygobject-3.4.2-r1 (and others): py-compile coming from <automake-...
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Linux Gnome Desktop Team
Depends on:
Reported: 2012-12-27 17:26 UTC by Chris Mayo
Modified: 2013-09-29 08:44 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---

patch to dev-python/pygobject-3.4.2-r1 (pygobject-3.4.2-r1.ebuild-bytecompile.patch,457 bytes, text/plain)
2012-12-27 17:26 UTC, Chris Mayo
py-compile automake-1.11 vs automake-1.12 (py-compile.patch,1.88 KB, patch)
2012-12-28 00:12 UTC, Mike Gilbert
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Mayo 2012-12-27 17:26:26 UTC
Created attachment 333508 [details]
patch to dev-python/pygobject-3.4.2-r1

With Python 3.3 packages installed by dev-python/pygobject-3.4.2-r1 are byte-compiled as per Python 2:

$ qlist dev-python/pygobject-3.4.2-r1 | grep pyc


Fixed for me with the attached patch that zaps py-compile (previous python.eclass ebuild used to have python_clean_py-compile_files) and uses python_optimize.
Comment 1 Gilles Dartiguelongue (RETIRED) gentoo-dev 2012-12-27 23:08:24 UTC
@python team, what's your opinion on this ?
Comment 2 Mike Gilbert gentoo-dev 2012-12-27 23:44:12 UTC
py-compile is Doing It Wrong, but what else is new?

Chris's patch seems reasonable.
Comment 3 Pacho Ramos gentoo-dev 2012-12-27 23:55:28 UTC
Maybe python_clean_py-compile_files from python.eclass could be imported to python-utils-r1.eclass to prevent people from going back to stop byte compiling with random ways on every ebuild (like occurred in the past)
Comment 4 Alexandre Rostovtsev (RETIRED) gentoo-dev 2012-12-27 23:57:11 UTC
(In reply to comment #2)
> py-compile is Doing It Wrong, but what else is new?

For reference: what is py-compile doing wrong? How are python-3.3 modules supposed to be byte-compiled?
Comment 5 Mike Gilbert gentoo-dev 2012-12-28 00:04:55 UTC
(In reply to comment #4)

It is overriding the "cfile" name in py_compile.compile(file, cfile, ...). If it did not specify a value for cfile, the py_compile module should automatically put the py[co] files in the correct place.
Comment 6 Mike Gilbert gentoo-dev 2012-12-28 00:12:08 UTC
Created attachment 333538 [details, diff]
py-compile automake-1.11 vs automake-1.12

This has actually been fixed in automake-1.12. See attached patch.
Comment 7 Mike Gilbert gentoo-dev 2012-12-28 00:27:56 UTC
(In reply to comment #4)

To expand on this:

Up to python3.1, byte compiling a module called "dir/" produces a file called "dir/module.pyc".

From python3.2 forward, byte-compiling a module called "dir/" should produce a file like "dir/__pycache__/module.cpython-32.pyc".

The py-compile program from automake-1.11 and earlier does not account for the newer behavior.
Comment 8 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2012-12-28 10:47:30 UTC
(In reply to comment #6)
> Created attachment 333538 [details, diff] [details, diff]
> py-compile automake-1.11 vs automake-1.12
> This has actually been fixed in automake-1.12. See attached patch.

Considering this, I'd rather add a func to update py-compile. But not sure if the eclass is the right place to do.

Maybe something like elibtoolize in autotools.eclass should do this?
Comment 9 Chris Mayo 2012-12-28 12:11:08 UTC
Looks like it was only fixed in the very latest automake-1.12.6:

Bugs fixed in 1.12.6:

* Python-related bugs:

  - The default installation location for python modules has been improved
    for Python 3 on Debian and Ubuntu systems, changing from:




    This change should ensure modules installed using the default ${prefix}
    "/usr/local" are found by default by system python 3.x installations.
    See automake bug#10227.

  - Python byte-compilation supports the new layout mandated by PEP-3147,
    with its __pycache__ directory (automake bug#8847).
Comment 10 SpanKY gentoo-dev 2012-12-28 19:03:04 UTC
(In reply to comment #8)

elibtoolize is only for patching libtool related files
Comment 11 Pacho Ramos gentoo-dev 2013-09-29 08:44:19 UTC
This should be fixed now since ebuild doesn't force older automake versions and, then, latest one will be used (and latest one in stable is already fixed)