aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>2012-05-01 21:51:16 +0200
committerArfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>2012-05-01 21:51:16 +0200
commit0a9cc38a66ded0cf0e5b534cb24b970fc9c21920 (patch)
tree85ac09a67f008adf2ab8f85ab6f20e051c642ca1 /pym/portage/dbapi/bintree.py
parentQuote atoms in die message for bug #414201. (diff)
downloadportage-0a9cc38a66ded0cf0e5b534cb24b970fc9c21920.tar.gz
portage-0a9cc38a66ded0cf0e5b534cb24b970fc9c21920.tar.bz2
portage-0a9cc38a66ded0cf0e5b534cb24b970fc9c21920.zip
Bug #413983: Add portage.util.urlopen(), which transparently
handles authentication in the way compatible with Python 3.
Diffstat (limited to 'pym/portage/dbapi/bintree.py')
-rw-r--r--pym/portage/dbapi/bintree.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py
index 2295b9f59..810163d0f 100644
--- a/pym/portage/dbapi/bintree.py
+++ b/pym/portage/dbapi/bintree.py
@@ -1,4 +1,4 @@
-# Copyright 1998-2011 Gentoo Foundation
+# Copyright 1998-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
__all__ = ["bindbapi", "binarytree"]
@@ -26,6 +26,7 @@ from portage.dep import Atom, use_reduce, paren_enclose
from portage.exception import AlarmSignal, InvalidPackageName, \
PermissionDenied, PortageException
from portage.localization import _
+from portage.util import urlopen
from portage import _movefile
from portage import os
from portage import _encodings
@@ -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
@@ -843,7 +842,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"