Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 469076 - app-portage/esearch-1.3 - -e option fails with python:3.2
Summary: app-portage/esearch-1.3 - -e option fails with python:3.2
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Tools (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage Tools Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-08 15:36 UTC by Andreas Proteus
Modified: 2015-03-02 22:26 UTC (History)
0 users

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


Attachments
Output of emerge --info (emerge-info,5.77 KB, text/plain)
2013-05-08 15:36 UTC, Andreas Proteus
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Proteus 2013-05-08 15:36:08 UTC
Created attachment 347762 [details]
Output of emerge --info

Steps to reproduce:

eselect python set python3.2

esearch -e portage
traceback (most recent call last):
  File "/usr/bin/esearch", line 5, in <module>
    main()
  File "/usr/lib/python3.2/site-packages/esearch/search.py", line 530, in main
    success = output_results(config, regexlist, found)
  File "/usr/lib/python3.2/site-packages/esearch/search.py", line 445, in output_results
    True, searchdef, "", config, data)
  File "/usr/lib/python3.2/site-packages/esearch/search.py", line 110, in searchEbuilds
    pkgs.sort(mypkgcmp)
TypeError: must use keyword argument for key function

esearch -e works correctly with python2.7
Comment 1 Zac Medico gentoo-dev 2013-05-08 16:50:37 UTC
This should fix it for python-2.7 or greater:

--- /usr/lib/python3.2/site-packages/esearch/search.py
+++ /usr/lib/python3.2/site-packages/esearch/search.py
@@ -9,6 +9,7 @@
 
 from __future__ import print_function
 
+import functools
 from getopt import getopt, GetoptError
 import sys
 from os import listdir, getenv, system
@@ -107,7 +108,7 @@
                     data['defebuild'] = (searchdef, pkgs[-1][3])
         if not portdir:
             config['found_in_overlay'] = True
-        pkgs.sort(mypkgcmp)
+        pkgs.sort(key=functools.cmp_to_key(mypkgcmp))
         for pkg in pkgs:
             rev = ""
             if pkg[2] != "r0":

Alternatively, there's a portage.util.cmp_sort_key function that can be used for compatibility with python-2.6.
Comment 2 Andreas Proteus 2013-05-08 17:51:16 UTC
(In reply to comment #1)
The patch solved the problem.
It now works with both python3.2 and 2.7 
Thanks.
Comment 3 Paul Varner (RETIRED) gentoo-dev 2013-05-08 19:33:17 UTC
The fix has been committed to the git repository and can be tested with esearch-9999.

https://github.com/fuzzyray/esearch/commit/3978f923ac814aef014cf412b63d11fd94f60692
Comment 4 Paul Varner (RETIRED) gentoo-dev 2015-03-02 22:26:51 UTC
This was fixed with esearch-1.3-r1