aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2012-05-13 22:01:51 -0700
committerZac Medico <zmedico@gentoo.org>2012-05-13 22:01:51 -0700
commit2c191d17c5c879c51aeb1c6043d9185b9a5887c0 (patch)
treea3fcbe096816732f89d079c75e58c552deeb157c /pym/portage/dbapi
parentgetbinpkg: fix base64 usage for python3 (diff)
downloadportage-2c191d17c5c879c51aeb1c6043d9185b9a5887c0.tar.gz
portage-2c191d17c5c879c51aeb1c6043d9185b9a5887c0.tar.bz2
portage-2c191d17c5c879c51aeb1c6043d9185b9a5887c0.zip
binhost: http auth for python3 (bug #413983)
This uses the code from commit 58a8cd1bb943522bc53d02c008ee8eff798bfaaa as a fallback for python3 when the default urlopen function fails. This has been tested and is known to work with thttpd password authentication (it works unencrypted and also when encrypted with stunnel).
Diffstat (limited to 'pym/portage/dbapi')
-rw-r--r--pym/portage/dbapi/bintree.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py
index 4ac48c9df..08fdad02b 100644
--- a/pym/portage/dbapi/bintree.py
+++ b/pym/portage/dbapi/bintree.py
@@ -16,6 +16,7 @@ portage.proxy.lazyimport.lazyimport(globals(),
'portage.util:atomic_ofstream,ensure_dirs,normalize_path,' + \
'writemsg,writemsg_stdout',
'portage.util.listdir:listdir',
+ 'portage.util._urlopen:urlopen@_urlopen',
'portage.versions:best,catpkgsplit,catsplit,_pkg_str',
)
@@ -45,10 +46,8 @@ import warnings
from itertools import chain
try:
from urllib.parse import urlparse
- from urllib.request import urlopen as urllib_request_urlopen
except ImportError:
from urlparse import urlparse
- from urllib import urlopen as urllib_request_urlopen
if sys.hexversion >= 0x3000000:
basestring = str
@@ -845,7 +844,7 @@ class binarytree(object):
# slash, so join manually...
url = base_url.rstrip("/") + "/Packages"
try:
- f = urllib_request_urlopen(url)
+ f = _urlopen(url)
except IOError:
path = parsed_url.path.rstrip("/") + "/Packages"