Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 413983
Collapse All | Expand All

(-)a/bin/repoman (-7 / +2 lines)
Lines 25-35 import textwrap Link Here
25
import time
25
import time
26
import platform
26
import platform
27
27
28
try:
29
	from urllib.request import urlopen as urllib_request_urlopen
30
except ImportError:
31
	from urllib import urlopen as urllib_request_urlopen
32
33
from itertools import chain
28
from itertools import chain
34
from stat import S_ISDIR
29
from stat import S_ISDIR
35
30
Lines 75-81 from portage.process import find_binary, spawn Link Here
75
from portage.output import bold, create_color_func, \
70
from portage.output import bold, create_color_func, \
76
	green, nocolor, red
71
	green, nocolor, red
77
from portage.output import ConsoleStyleFile, StyleWriter
72
from portage.output import ConsoleStyleFile, StyleWriter
78
from portage.util import cmp_sort_key, writemsg_level
73
from portage.util import cmp_sort_key, urlopen, writemsg_level
79
from portage.util._desktop_entry import validate_desktop_entry
74
from portage.util._desktop_entry import validate_desktop_entry
80
from portage.package.ebuild.digestgen import digestgen
75
from portage.package.ebuild.digestgen import digestgen
81
from portage.eapi import eapi_has_iuse_defaults, eapi_has_required_use
76
from portage.eapi import eapi_has_iuse_defaults, eapi_has_required_use
Lines 1051-1057 def fetch_metadata_dtd(): Link Here
1051
			"needs to be refetched, doing that now")
1046
			"needs to be refetched, doing that now")
1052
		print()
1047
		print()
1053
		try:
1048
		try:
1054
			url_f = urllib_request_urlopen(metadata_dtd_uri)
1049
			url_f = urlopen(metadata_dtd_uri)
1055
			msg_info = url_f.info()
1050
			msg_info = url_f.info()
1056
			last_modified = msg_info.get('last-modified')
1051
			last_modified = msg_info.get('last-modified')
1057
			if last_modified is not None:
1052
			if last_modified is not None:
(-)a/pym/portage/dbapi/bintree.py (-4 / +3 lines)
Lines 1-4 Link Here
1
# Copyright 1998-2011 Gentoo Foundation
1
# Copyright 1998-2012 Gentoo Foundation
2
# Distributed under the terms of the GNU General Public License v2
2
# Distributed under the terms of the GNU General Public License v2
3
3
4
__all__ = ["bindbapi", "binarytree"]
4
__all__ = ["bindbapi", "binarytree"]
Lines 26-31 from portage.dep import Atom, use_reduce, paren_enclose Link Here
26
from portage.exception import AlarmSignal, InvalidPackageName, \
26
from portage.exception import AlarmSignal, InvalidPackageName, \
27
	PermissionDenied, PortageException
27
	PermissionDenied, PortageException
28
from portage.localization import _
28
from portage.localization import _
29
from portage.util import urlopen
29
from portage import _movefile
30
from portage import _movefile
30
from portage import os
31
from portage import os
31
from portage import _encodings
32
from portage import _encodings
Lines 45-54 import warnings Link Here
45
from itertools import chain
46
from itertools import chain
46
try:
47
try:
47
	from urllib.parse import urlparse
48
	from urllib.parse import urlparse
48
	from urllib.request import urlopen as urllib_request_urlopen
49
except ImportError:
49
except ImportError:
50
	from urlparse import urlparse
50
	from urlparse import urlparse
51
	from urllib import urlopen as urllib_request_urlopen
52
51
53
if sys.hexversion >= 0x3000000:
52
if sys.hexversion >= 0x3000000:
54
	basestring = str
53
	basestring = str
Lines 843-849 class binarytree(object): Link Here
843
				# slash, so join manually...
842
				# slash, so join manually...
844
				url = base_url.rstrip("/") + "/Packages"
843
				url = base_url.rstrip("/") + "/Packages"
845
				try:
844
				try:
846
					f = urllib_request_urlopen(url)
845
					f = urlopen(url)
847
				except IOError:
846
				except IOError:
848
					path = parsed_url.path.rstrip("/") + "/Packages"
847
					path = parsed_url.path.rstrip("/") + "/Packages"
849
848
(-)a/pym/portage/glsa.py (-7 / +3 lines)
Lines 1-14 Link Here
1
# Copyright 2003-2011 Gentoo Foundation
1
# Copyright 2003-2012 Gentoo Foundation
2
# Distributed under the terms of the GNU General Public License v2
2
# Distributed under the terms of the GNU General Public License v2
3
3
4
from __future__ import absolute_import
4
from __future__ import absolute_import
5
5
6
import io
6
import io
7
import sys
7
import sys
8
try:
9
	from urllib.request import urlopen as urllib_request_urlopen
10
except ImportError:
11
	from urllib import urlopen as urllib_request_urlopen
12
import re
8
import re
13
import xml.dom.minidom
9
import xml.dom.minidom
14
10
Lines 18-24 from portage import _encodings Link Here
18
from portage import _unicode_decode
14
from portage import _unicode_decode
19
from portage import _unicode_encode
15
from portage import _unicode_encode
20
from portage.versions import pkgsplit, catpkgsplit, pkgcmp, best
16
from portage.versions import pkgsplit, catpkgsplit, pkgcmp, best
21
from portage.util import grabfile
17
from portage.util import grabfile, urlopen
22
from portage.const import CACHE_PATH
18
from portage.const import CACHE_PATH
23
from portage.localization import _
19
from portage.localization import _
24
from portage.dep import _slot_separator
20
from portage.dep import _slot_separator
Lines 476-482 class Glsa: Link Here
476
			myurl = "file://"+self.nr
472
			myurl = "file://"+self.nr
477
		else:
473
		else:
478
			myurl = repository + "glsa-%s.xml" % str(self.nr)
474
			myurl = repository + "glsa-%s.xml" % str(self.nr)
479
		self.parse(urllib_request_urlopen(myurl))
475
		self.parse(urlopen(myurl))
480
		return None
476
		return None
481
477
482
	def parse(self, myfile):
478
	def parse(self, myfile):
(-)a/pym/portage/util/__init__.py (-1 / +19 lines)
Lines 1-4 Link Here
1
# Copyright 2004-2011 Gentoo Foundation
1
# Copyright 2004-2012 Gentoo Foundation
2
# Distributed under the terms of the GNU General Public License v2
2
# Distributed under the terms of the GNU General Public License v2
3
3
4
__all__ = ['apply_permissions', 'apply_recursive_permissions',
4
__all__ = ['apply_permissions', 'apply_recursive_permissions',
Lines 26-31 import string Link Here
26
import sys
26
import sys
27
import traceback
27
import traceback
28
import glob
28
import glob
29
try:
30
	import urllib.parse as urllib_parse
31
	import urllib.request as urllib_request
32
	from urllib.parse import splituser as urllib_parse_splituser
33
except ImportError:
34
	import urlparse as urllib_parse
35
	import urllib2 as urllib_request
36
	from urllib import splituser as urllib_parse_splituser
29
37
30
import portage
38
import portage
31
portage.proxy.lazyimport.lazyimport(globals(),
39
portage.proxy.lazyimport.lazyimport(globals(),
Lines 1640-1642 def getlibpaths(root, env=None): Link Here
1640
	rval.append("/lib")
1648
	rval.append("/lib")
1641
1649
1642
	return [normalize_path(x) for x in rval if x]
1650
	return [normalize_path(x) for x in rval if x]
1651
1652
def urlopen(url):	
1653
	parse_result = urllib_parse.urlparse(url)
1654
	netloc = urllib_parse_splituser(parse_result.netloc)[1]
1655
	url = urllib_parse.urlunparse((parse_result.scheme, netloc, parse_result.path, parse_result.params, parse_result.query, parse_result.fragment))
1656
	auth_handler = urllib_request.HTTPBasicAuthHandler()
1657
	if parse_result.username is not None:
1658
		auth_handler.add_password(realm=None, uri=url, user=parse_result.username, passwd=parse_result.password)
1659
	opener = urllib_request.build_opener(auth_handler)
1660
	return opener.open(url)

Return to bug 413983