summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pym/portage/dbapi/bintree.py36
1 files changed, 14 insertions, 22 deletions
diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py
index e24c2d0bf..d8c40d4ef 100644
--- a/pym/portage/dbapi/bintree.py
+++ b/pym/portage/dbapi/bintree.py
@@ -1,14 +1,17 @@
-# Copyright 1998-2009 Gentoo Foundation
+# Copyright 1998-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
__all__ = ["bindbapi", "binarytree"]
import portage
portage.proxy.lazyimport.lazyimport(globals(),
+ 'portage.checksum:hashfunc_map,perform_multiple_checksums,verify_all',
'portage.dbapi.dep_expand:dep_expand',
'portage.dep:dep_getkey,isjustname,match_from_list',
'portage.output:EOutput,colorize',
+ 'portage.locks:lockfile,unlockfile',
'portage.package.ebuild.doebuild:_vdb_use_conditional_atoms',
+ 'portage.package.ebuild.fetch:_check_distfile',
'portage.update:update_dbentries',
'portage.util:atomic_ofstream,ensure_dirs,normalize_path,' + \
'writemsg,writemsg_stdout',
@@ -17,25 +20,31 @@ portage.proxy.lazyimport.lazyimport(globals(),
)
from portage.cache.mappings import slot_dict_class
+from portage.const import CACHE_PATH
from portage.dbapi.virtual import fakedbapi
from portage.dep import Atom, use_reduce, paren_enclose
from portage.exception import InvalidPackageName, \
PermissionDenied, PortageException
from portage.localization import _
-
from portage import _movefile
from portage import os
from portage import _encodings
from portage import _unicode_decode
from portage import _unicode_encode
-from portage.package.ebuild.fetch import _check_distfile
import codecs
import errno
import re
import stat
import sys
+import textwrap
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
@@ -496,7 +505,7 @@ class binarytree(object):
if self._populating:
return
- from portage.locks import lockfile, unlockfile
+
pkgindex_lock = None
try:
if os.access(self.pkgdir, os.W_OK):
@@ -641,8 +650,7 @@ class binarytree(object):
", ".join(missing_keys))
msg.append(_(" This binary package is not " \
"recoverable and should be deleted."))
- from textwrap import wrap
- for line in wrap("".join(msg), 72):
+ for line in textwrap.wrap("".join(msg), 72):
writemsg("!!! %s\n" % line, noiselevel=-1)
self.invalids.append(mypkg)
continue
@@ -730,11 +738,6 @@ class binarytree(object):
if getbinpkgs and 'PORTAGE_BINHOST' in self.settings:
base_url = self.settings["PORTAGE_BINHOST"]
- from portage.const import CACHE_PATH
- try:
- from urllib.parse import urlparse
- except ImportError:
- from urlparse import urlparse
urldata = urlparse(base_url)
pkgindex_file = os.path.join(self.settings["EROOT"], CACHE_PATH, "binhost",
urldata[1] + urldata[2], "Packages")
@@ -752,10 +755,6 @@ class binarytree(object):
if e.errno != errno.ENOENT:
raise
local_timestamp = pkgindex.header.get("TIMESTAMP", None)
- try:
- from urllib.request import urlopen as urllib_request_urlopen
- except ImportError:
- from urllib import urlopen as urllib_request_urlopen
rmt_idx = self._new_pkgindex()
try:
# urlparse.urljoin() only works correctly with recognized
@@ -943,7 +942,6 @@ class binarytree(object):
# Reread the Packages index (in case it's been changed by another
# process) and then updated it, all while holding a lock.
- from portage.locks import lockfile, unlockfile
pkgindex_lock = None
created_symlink = False
try:
@@ -1021,7 +1019,6 @@ class binarytree(object):
"""
pkg_path = self.getname(cpv)
- from portage.checksum import perform_multiple_checksums
d = dict(zip(self._pkgindex_aux_keys,
self.dbapi.aux_get(cpv, self._pkgindex_aux_keys)))
@@ -1174,10 +1171,6 @@ class binarytree(object):
mydest = os.path.dirname(self.getname(pkgname))
self._ensure_dir(mydest)
- try:
- from urllib.parse import urlparse
- except ImportError:
- from urlparse import urlparse
# urljoin doesn't work correctly with unrecognized protocols like sftp
if self._remote_has_index:
rel_url = self._remotepkgs[pkgname].get("PATH")
@@ -1243,7 +1236,6 @@ class binarytree(object):
return False
digests = {}
- from portage.checksum import hashfunc_map, verify_all
for k in hashfunc_map:
v = metadata.get(k)
if not v: