Summary: | Cannot use BINHOST when system python set to python3 | ||
---|---|---|---|
Product: | Portage Development | Reporter: | Albert W. Hopkins <marduk> |
Component: | Core | Assignee: | Portage team <dev-portage> |
Status: | RESOLVED OBSOLETE | ||
Severity: | normal | ||
Priority: | Normal | ||
Version: | 2.1 | ||
Hardware: | All | ||
OS: | Linux | ||
URL: | http://bugs.python.org/issue4608 | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- |
Description
Albert W. Hopkins
2011-04-17 02:28:33 UTC
Which protocol are you using for PORTAGE_BINHOST? (In reply to comment #1) > Which protocol are you using for PORTAGE_BINHOST? Using FTP. The function says it's supposed to return a file-like object: http://docs.python.org/dev/library/urllib.request.html#urllib.request.urlopen Since file-like objects typically support iteration, it seems odd that this one doesn't. I'll setup an ftp server and see if I can reproduce it. Given issues like bug 350139, we should consider making it always use FETCHCOMMAND instead of urlopen for the ftp protocol. Found this python bug. It's fixed, but perhaps not in Python 3.1.3? http://bugs.python.org/issue4608 Could you test with Python 3.2? (Python 3.2 will be unmasked probably in next month.) (In reply to comment #5) > Could you test with Python 3.2? > (Python 3.2 will be unmasked probably in next month.) Seems to still happen with Python 3.2: root@tp-db $ python --version Python 3.2 root@tp-db $ emerge -ngk postgresql-server Traceback (most recent call last): File "/usr/bin/emerge", line 43, in <module> retval = emerge_main() File "/usr/lib64/portage/pym/_emerge/main.py", line 1437, in emerge_main getbinpkgs="--getbinpkg" in myopts) File "/usr/lib64/portage/pym/portage/dbapi/bintree.py", line 511, in populate self._populate(getbinpkgs) File "/usr/lib64/portage/pym/portage/dbapi/bintree.py", line 816, in _populate rmt_idx.readHeader(f_dec) File "/usr/lib64/portage/pym/portage/getbinpkg.py", line 817, in readHeader self.header.update(self._readpkgindex(pkgfile, pkg_entry=False)) File "/usr/lib64/portage/pym/portage/getbinpkg.py", line 789, in _readpkgindex for line in pkgfile: File "/usr/lib64/python3.2/codecs.py", line 1027, in iterdecode for input in iterator: TypeError: 'addinfourl' object is not iterable root@tp-db $ grep BINHOST /etc/make.conf PORTAGE_BINHOST=ftp://192.168.122.1/vm-packages/ Perhaps it is not the python bug previously referenced. As the test case from that bug passes: root@tp-db $ cat test.py from urllib.request import urlopen for line in urlopen('http://python.org/'): print(line) break root@tp-db $ python3.2 test.py b'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n' However: root@tp-db $ python3.2 /usr/bin/emerge -ngk postgresql-server Traceback (most recent call last): File "/usr/bin/emerge", line 43, in <module> retval = emerge_main() File "/usr/lib64/portage/pym/_emerge/main.py", line 1437, in emerge_main getbinpkgs="--getbinpkg" in myopts) File "/usr/lib64/portage/pym/portage/dbapi/bintree.py", line 511, in populate self._populate(getbinpkgs) File "/usr/lib64/portage/pym/portage/dbapi/bintree.py", line 816, in _populate rmt_idx.readHeader(f_dec) File "/usr/lib64/portage/pym/portage/getbinpkg.py", line 817, in readHeader self.header.update(self._readpkgindex(pkgfile, pkg_entry=False)) File "/usr/lib64/portage/pym/portage/getbinpkg.py", line 789, in _readpkgindex for line in pkgfile: File "/usr/lib64/python3.2/codecs.py", line 1027, in iterdecode for input in iterator: TypeError: 'addinfourl' object is not iterable (In reply to comment #7) > root@tp-db $ cat test.py > from urllib.request import urlopen > for line in urlopen('http://python.org/'): > print(line) > break Modify the test case to point at $PORTAGE_BINHOST/Packages instead of http://python.org/. Oh, apparently it does not like the FTP protocol: root@tp-db $ cat test.py from urllib.request import urlopen for line in urlopen('ftp://gentoo.osuosl.org/pub/gentoo/releases/'): print(line) break root@tp-db $ python3.2 test.py Traceback (most recent call last): File "test.py", line 2, in <module> for line in urlopen('ftp://gentoo.osuosl.org/pub/gentoo/releases/'): TypeError: 'addinfourl' object is not iterable (In reply to comment #8) > (In reply to comment #7) > Modify the test case to point at $PORTAGE_BINHOST/Packages instead of > http://python.org/. root@tp-db $ cat test.py from urllib.request import urlopen for line in urlopen('ftp://192.168.122.1/vm-packages/Packages'): print(line) break root@tp-db $ python3.2 test.py Traceback (most recent call last): File "test.py", line 2, in <module> for line in urlopen('ftp://192.168.122.1/vm-packages/Packages'): TypeError: 'addinfourl' object is not iterable The Python bug is re-opened. Maybe this is fixed in Python 3.2.2. (In reply to comment #12) > Maybe this is fixed in Python 3.2.2. The code in comment #9 now works with 3.2.2. I haven't tested the BINHOST yet, but will hopefully in the next day or so. Works with 3.2.x now. Thanks. |