Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 192383 - Extend app-admin/python-updater to detect leftovers from python.eclass
Summary: Extend app-admin/python-updater to detect leftovers from python.eclass
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-13 05:26 UTC by Leonardo Boshell (RETIRED)
Modified: 2012-05-09 04:36 UTC (History)
1 user (show)

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


Attachments
python-updater-leftover_compiled_files.patch (python-updater-leftover_compiled_files.patch,2.10 KB, patch)
2007-09-13 05:27 UTC, Leonardo Boshell (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Leonardo Boshell (RETIRED) gentoo-dev 2007-09-13 05:26:47 UTC
Hi,

Currently python-updater lacks the ability to detect certain packages that create .py[co] files through python_mod_compile() or python_mod_optimize(). These packages can be problematic after a python upgrade, generally creating access violations. Bug #126799 exemplifies this.

With that in mind, I made a patch to make python-updater detect packages with leftover binaries created by python.eclass. It works by checking that the python "magic" string in such binaries is the same as the magic string from the current python.

Side note:
In addition to python and some common utilities (sed, grep, awk), this patch uses 'od', which I guess should be available on any system, but I mention it in case anyone on a BSD system cares to verify that this works, and if maybe it implies a new dependency for python-updater.

Thanks.
Comment 1 Leonardo Boshell (RETIRED) gentoo-dev 2007-09-13 05:27:44 UTC
Created attachment 130785 [details, diff]
python-updater-leftover_compiled_files.patch
Comment 2 Tiziano Müller (RETIRED) gentoo-dev 2007-09-21 14:53:27 UTC
I don't see why this should be a problem of python_mod_{compile,optimize}, because nearly all python-modules call those functions (through the distutils eclass) they obviously work.
And for the leftover .py files we have python_mod_cleanup, so I'd suppose look for a reason why there are left over .pyc files.
Comment 3 Leonardo Boshell (RETIRED) gentoo-dev 2007-09-21 15:16:12 UTC
(In reply to comment #2)
> I don't see why this should be a problem of python_mod_{compile,optimize},

I'm not sure what you understand by the "problem" here, but it seems it's not the same thing I tried to describe.

The python_mod_{compile|optimize|cleanup} functions are fine, the ebuilds that use them are fine as well. The problem is that after upgrading python on a system, our recommendation is for users to run python-updater to keep the system sane, but one problem that python-updater doesn't handle is that some packages install .py[co] files (using the eclass, and not necessarily under /usr/lib*/python*) which are left broken after a python upgrade. gnome-doc-utils is one package that does this, for example.

Then, I guess by some auto-magic process handled by python, when a module is imported, the .pyc files are re-generated if they are from an old python and the corresponding .py is found.

This can happen when emerge is installing a package that depends on another package that hasn't been cleaned by python-updater. For example many gnome packages depend on gnome-doc-utils and users ofter run into this scenario, where emerge fails because of an access violation (python tries to re-generate the .pyc files on the root filesystem).


Please let me know if I'm not making myself clear, or if there's a better solution than extending python-updater to prevent the access violations.

Thanks.
Comment 4 Mike Gilbert gentoo-dev 2012-05-09 04:36:19 UTC
I don't understand how pyc files would be left behind here, unless the ebuild fails to run python_mod_cleanup.

If the ebuild installs python modules without calling python_mod_optimize, that should be fixed in the ebuild.