app-portage/esearch doesn't work well with python3 being used for the symlink /usr/bin/python: #esync fails completely, and $esearch shows very strange size informations i #eupdatedb ran under python3 (eg. 20,3.7,958,984,375 kB instead of 203 kB). This could be fixed by changing the shebang line in the scripts from 'python' to 'python2'. A patch for the ebuild is below.
--- a/app-portage/esearch/esearch-1.0-r2.ebuild +++ b/app-portage/esearch/esearch-1.0-r2.ebuild @@ -4,7 +4,7 @@ EAPI="3" SUPPORT_PYTHON_ABIS="1" -RESTRICT_PYTHON_ABIS="2.[45] 2.7-pypy-* *-jython" +RESTRICT_PYTHON_ABIS="3.* 2.[45] 2.7-pypy-* *-jython" PYTHON_USE_WITH="readline" PYTHON_NONVERSIONED_EXECUTABLES=(".*") @@ -42,8 +42,8 @@ src_compile() { } src_install() { - python_convert_shebangs -r "" build-*/scripts-* distutils_src_install + python_convert_shebangs -r "2" "$D" dodoc eupdatedb.cron || die "dodoc failed"
How exactly does esync fail? The -l, --layman-sync will not work in py3 unless it runs layman in a terminal, layman is py2 only so still. I don't recall if I put a py3 check in there, I'll look later. Need to go to work now.
esearch is intended to work properly with python3, so we need to find and fix the issues instead of working around them by specifying python 2.
Ok, so this are the problems I found with esearch/py3: * esearch itself works fine, but if eupdatedb ran under py3, the file sizes are displayed very strange, as already mentioned above * esync doesn't work: It first calls emerge --sync and eupdatedb, which both run without problems. But then, in the phase "Searching for changes", it aborts with this error message: Traceback (most recent call last): File "/usr/bin/esync", line 5, in <module> main() File "/usr/lib64/python3.2/site-packages/esearch/sync.py", line 291, in main success = sync(config) File "/usr/lib64/python3.2/site-packages/esearch/sync.py", line 247, in sync items.sort(lambda x, y: cmp(x[0], y[0])) TypeError: must use keyword argument for key function
The codeline causing the problem: items.sort(lambda x, y: cmp(x[0], y[0]))
I solved the esync issue by replacing this line with items.sort(key=lambda x: x[0]) Looks like this syntax also works for python2, so you can just change it in the src, fuzzyray. I created a pull request at github for fixing the issue. Now, let's look at the file size problem.
I merged the pull request in github. The size issue is going to be caused by nit using floor division. Something similar to the following fix: https://github.com/fuzzyray/esearch/commit/78b62a5b6058037b54f2dae0025e01f0900b1380
Yes, I also found this and created a pull request again, only a few minutes ago. I'm surprised that I as a total python noob was able to find that :)
Both fixes are in the git repo now, which is available via the esearch-9999 ebuild. But as most users won't use this, maybe it's time for a new release?
esearch-1.1, available in portage since April 13, fixes the issue.