Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 483232

Summary: =app-portage/mirrorselect-? with =dev-lang/python-3.2 - TypeError: 'module' object is not callable
Product: Portage Development Reporter: ewomer <ewomer>
Component: ToolsAssignee: Portage Tools Team <tools-portage>
Status: RESOLVED FIXED    
Severity: normal CC: alicef, andre, eandry, gentoo_bugs_peep, jdavid.ibp, Martin.vGagern, mike.desimone, mplichta, tomboy64, zerochaos
Priority: Normal    
Version: unspecified   
Hardware: AMD64   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: Fix url parse
Fix url parse (tested version)
mirrorselect-9999.ebuild working ebuild for testing
Fix url_parse for python3
My emerge --info
mirrorselect-9999 emerge log
mirrorselect-9999 build log
0003-Fix-url_parse.patch.out
E-build for applying patch to 2.2.0.1

Description ewomer 2013-09-01 03:10:41 UTC
Running mirror select with python 3.2 set for system in eselect fails with
TypeError: 'module' object is not callable.

```
mirrorselect -s3 -b10 -o -D
* Downloading a list of mirrors... Got 221 mirrors.
* Downloading 100k files from each mirror... [1 of 221]Traceback (most recent call last):
  File "/usr/bin/mirrorselect-python3.2", line 61, in <module>
    MirrorSelect().main(sys.argv)
  File "/usr/lib64/python3.2/site-packages/mirrorselect/main.py", line 411, in main
    urls = self.select_urls(hosts, options)
  File "/usr/lib64/python3.2/site-packages/mirrorselect/main.py", line 374, in select_urls
    selector = Deep(hosts, options, self.output)
  File "/usr/lib64/python3.2/site-packages/mirrorselect/selectors.py", line 273, in __init__
    self.deeptest()
  File "/usr/lib64/python3.2/site-packages/mirrorselect/selectors.py", line 293, in deeptest
    mytime, ignore = self.deeptime(host, maxtime)
  File "/usr/lib64/python3.2/site-packages/mirrorselect/selectors.py", line 332, in deeptime
    url_parts = url_parse(url)
TypeError: 'module' object is not callable
```

Reproducible: Always

Steps to Reproduce:
1.run mirrorselect with python3.2
2.
3.
Actual Results:  
Fails with TypeError: 'module' object is not callable message

Expected Results:  
mirrors tested and the best three choosen.
Comment 1 Alice Ferrazzi Gentoo Infrastructure gentoo-dev 2013-09-01 05:09:31 UTC
patch for make it work:


--- /usr/lib/python3.2/site-packages/mirrorselect/selectors.py_backup   2013-09-01 13:18:09.000000000 +0900
+++ /usr/lib/python3.2/site-packages/mirrorselect/selectors.py  2013-09-01 14:05:44.000000000 +0900
@@ -329,7 +329,7 @@ class Deep(object):
                else:
                        url = url + '/distfiles/mirrorselect-test'
 
-               url_parts = url_parse(url)
+               url_parts = url_parse.urlparse(url)
 
                class TimeoutException(Exception):
                        pass
Comment 2 ewomer 2013-09-01 06:02:21 UTC
Greate, works now, just need to get the a patch to work nicely with the ebuld.
I created a new patch to get it to work but it fails.


***************************
=======================================
patching file mirrorselect/selectors.py
Hunk #1 FAILED at 329.
1 out of 1 hunk FAILED -- saving rejects to file mirrorselect/selectors.py.rej

patch program exited with status 1
=======================================
********************************

Here is the patch I used.

*******************************
diff -Napur a/mirrorselect/selectors.py b/mirrorselect/selectors.py
--- a/mirrorselect/selectors.py 2012-12-15 21:34:54.000000000 -0500
+++ b/mirrorselect/selectors.py 2013-09-01 01:33:49.531460407 -0400
@@ -329,7 +329,7 @@ class Deep(object):
                else:
                        url = url + '/distfiles/mirrorselect-test'
 
-               url_parts = url_parse(url)
+               url_parts = url_parse.urlparse(url)
 
                class TimeoutException(Exception):
                        pass

**********************************

Here is the realavent section in the ebuild
*********************************************

python_prepare_all()  {

        python_export_best
        epatch "${FILESDIR}/${PV}-Fix-url_parse.patch"
        eprefixify setup.py mirrorselect/main.py
        echo Now setting version... VERSION="${PVR}" "${PYTHON}" setup.py set_version
        VERSION="${PVR}" "${PYTHON}" setup.py set_version || die "setup.py set_version failed"
}

*************************************
Comment 3 Tom Wijsman (TomWij) (RETIRED) gentoo-dev 2013-09-01 07:51:37 UTC
Please comment with the output of `emerge --info app-portage/mirrorselect`

Also, as a side note, please attach patches in the future; thank you in advance.
Comment 4 Alice Ferrazzi Gentoo Infrastructure gentoo-dev 2013-09-01 08:53:58 UTC
Created attachment 357548 [details, diff]
Fix url parse
Comment 5 Alice Ferrazzi Gentoo Infrastructure gentoo-dev 2013-09-01 09:15:46 UTC
Created attachment 357550 [details, diff]
Fix url parse (tested version)
Comment 6 Alice Ferrazzi Gentoo Infrastructure gentoo-dev 2013-09-01 09:16:26 UTC
Created attachment 357552 [details]
mirrorselect-9999.ebuild working ebuild for testing
Comment 7 Alice Ferrazzi Gentoo Infrastructure gentoo-dev 2013-09-01 09:17:38 UTC
please try new patch and ebuild and as TomWij said comment with the output of your `emerge --info app-portage/mirrorselect
Comment 8 Zac Medico gentoo-dev 2013-09-01 17:15:15 UTC
Created attachment 357574 [details, diff]
Fix url_parse for python3

This fixes it to work with any version of python (including python2).
Comment 9 ewomer 2013-09-02 18:25:56 UTC
Failed with git error.

----------------------------------------
* Package:    app-portage/mirrorselect-9999
 * Repository: starvald_emeralian
 * USE:        amd64 elibc_glibc kernel_linux multilib_abi_amd64 python_targets_python2_7 python_targets_python3_2 userland_GNU
 * FEATURES:   preserve-libs sandbox userpriv usersandbox
>>> ABI=amd64
>>> Unpacking source...
Cloning into bare repository '/home/distfiles/egit-src/mirrorselect.git'...
fatal: Unable to look up git.overlays.gentoo.org (port 9418) (Name or service not known)
 * ERROR: app-portage/mirrorselect-9999::starvald_emeralian failed (unpack phase):
 *   git-2_initial_clone: can't fetch from git://git.overlays.gentoo.org/proj/mirrorselect.git
 * 
 * Call stack:
 *     ebuild.sh, line   94:  Called src_unpack
 *   environment, line 4264:  Called git-2_src_unpack
 *   environment, line 2781:  Called git-2_fetch
 *   environment, line 2582:  Called git-2_initial_clone
 *   environment, line 2675:  Called die
 * The specific snippet of code:
 *       [[ -n ${EGIT_REPO_URI_SELECTED} ]] || die "${FUNCNAME}: can't fetch from ${EGIT_REPO_URI}"
 * 
 * If you need support, post the output of `emerge --info '=app-portage/mirrorselect-9999::starvald_emeralian'`,
 * the complete build log and the output of `emerge -pqv '=app-portage/mirrorselect-9999::starvald_emeralian'`.
 * The complete build log is located at '/var/log/portage/app-portage:mirrorselect-9999:20130902-181648.log'.
 * The ebuild environment file is located at '/var/tmp/portage/app-portage/mirrorselect-9999/temp/environment'.
 * Working directory: '/var/tmp/portage/app-portage/mirrorselect-9999/work'
 * S: '/var/tmp/portage/app-portage/mirrorselect-9999/work/mirrorselect-9999'
Comment 10 ewomer 2013-09-02 18:26:35 UTC
Created attachment 357698 [details]
My emerge --info
Comment 11 Alice Ferrazzi Gentoo Infrastructure gentoo-dev 2013-09-03 14:41:19 UTC
is still not working ? you tried again ?

>fatal: Unable to look up git.overlays.gentoo.org (port 9418) (Name or service >not known)
> * ERROR: app-portage/mirrorselect-9999::starvald_emeralian failed (unpack >phase):
> *   git-2_initial_clone: can't fetch from >git://git.overlays.gentoo.org/proj/mirrorselect.git

From your build log looks like you cannot fetch git://git.overlays.gentoo.org/proj/mirrorselect.git because of network problem
Comment 12 Alice Ferrazzi Gentoo Infrastructure gentoo-dev 2013-09-03 14:48:04 UTC
@Zac Medico I tested your patch and is working in python 2.7 and 3.2
Comment 13 ewomer 2013-09-03 18:38:55 UTC
Created attachment 357782 [details]
mirrorselect-9999 emerge log

Yes it worked. I might need to check out my network. or is gentoo having issues?
Comment 14 Zac Medico gentoo-dev 2013-09-03 19:50:17 UTC
(In reply to salamanderrake from comment #13)
> Created attachment 357782 [details]
> mirrorselect-9999 emerge log
> 
> Yes it worked. I might need to check out my network. or is gentoo having
> issues?

It works for me too now. I think the server may have been down temporarily.
Comment 15 Brian Dolbec (RETIRED) gentoo-dev 2013-10-17 14:43:35 UTC
fixed in vcs:

http://git.overlays.gentoo.org/gitweb/?p=proj/mirrorselect.git;a=commit;h=e8bd46886261aca42917e0d627a0a49b337b02f5

available in mirrorselect-9999 now.
Comment 16 ewomer 2013-12-01 02:02:57 UTC
Created attachment 364308 [details]
mirrorselect-9999 build log

This is the output for emerging mirrorselect-9999.
Comment 17 ewomer 2013-12-01 02:03:46 UTC
Created attachment 364310 [details]
0003-Fix-url_parse.patch.out

The failed patch .out file.
Comment 18 Brian Dolbec (RETIRED) gentoo-dev 2013-12-01 02:41:48 UTC
You don't need to patch the -9999 version.  It contains teh fix already, that is why the patch failed.

Clean out your modified -9999 ebuild and re-emerge.
Comment 19 ewomer 2013-12-01 15:51:20 UTC
You were right, once I removed the mirrorselect from the local overlay it emerged without a hitch, thanks.
Comment 20 André Terpstra 2014-01-07 18:41:05 UTC
I still have this issue with app-portage/mirrorselect-2.2.0.1

It happens both with python 3.2 and 3.3. Once I "eselect python set python2.7" it runs well. Note that I have enabled all three python implementations in make.conf.
Comment 21 Mike DeSimone 2014-01-20 15:13:09 UTC
I'm seeing this bug, too, using app-portage/mirrorselect-2.2.0.1. /usr/bin/python currently points to Python 3.3.3 (latest stable). The patch posted 2013-09-01 by Zac Medico fixes the bug.

BTW, the current -9999 ebuild fails with:

---

# mirrorselect -D -s4 -b4
Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.3/mirrorselect", line 58, in <module>
    from mirrorselect.main import MirrorSelect
  File "/usr/lib64/python3.3/site-packages/mirrorselect/main.py", line 42, in <module>
    from mirrorselect.selectors import Deep, Shallow, Interactive
  File "/usr/lib64/python3.3/site-packages/mirrorselect/selectors.py", line 405
    except HTTPError, e:
                    ^
SyntaxError: invalid syntax
Comment 22 Jeroen Roovers (RETIRED) gentoo-dev 2014-01-25 15:54:47 UTC
*** Bug 499230 has been marked as a duplicate of this bug. ***
Comment 23 Pavel 2014-04-09 19:53:44 UTC
Occurs on 3.3 and 3.4 as well
Comment 24 Philippe Chaintreuil 2014-07-03 20:33:08 UTC
Created attachment 380134 [details]
E-build for applying patch to 2.2.0.1

I ran into this bug today.  Setting aside all the "-9999" issues that are going back and forth above, I've attached a "-r1" ebuild that is a copy of the 2.2.0.1 (which is the stable ebuild right now for most arches), that applies zmedico's patch #357574 comment #8 from above.  (It expects that patch to be named "files/mirrorselect-2.2.0.1-urlparse.patch".)

It would be nice if this could get in and stabilized while the dependencies for 2.2.2/9999 are being worked on.