Use lazyimport to avoid importing the dep, output, update, and versions
authorZac Medico <zmedico@gentoo.org>
Wed, 11 Mar 2009 06:10:35 +0000 (06:10 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 11 Mar 2009 06:10:35 +0000 (06:10 -0000)
modules when portage is initially imported. (trunk r12681)

svn path=/main/branches/2.1.6/; revision=12941

pym/portage/__init__.py
pym/portage/data.py
pym/portage/dbapi/__init__.py
pym/portage/dbapi/bintree.py
pym/portage/dbapi/porttree.py
pym/portage/dbapi/vartree.py
pym/portage/elog/messages.py
pym/portage/manifest.py
pym/portage/update.py

index 060630a6142ce10e197ba54e8995798a089b557d..7a8c0f2623661d1683e5d1590fa95e0e5cc16906 100644 (file)
@@ -102,6 +102,7 @@ try:
                        'pickle_read,pickle_write,stack_dictlist,stack_dicts,' + \
                        'stack_lists,unique_array,varexpand,writedict,writemsg,' + \
                        'writemsg_stdout,write_atomic',
+               'portage.versions',
                'portage.versions:best,catpkgsplit,catsplit,endversion_keys,' + \
                        'suffix_value@endversion,pkgcmp,pkgsplit,vercmp,ververify',
                'portage.xpak',
index a8ddf8250ef12ec7f44efdcc728c9c06cf1bb9df..3ae286b34235d3462aeb4ed5a9652cf31da0a0da 100644 (file)
@@ -7,13 +7,10 @@ import os, sys, pwd, grp, platform
 
 import portage
 portage.proxy.lazyimport.lazyimport(globals(),
+       'portage.output:colorize',
        'portage.util:writemsg',
 )
 
-from portage.output import colorize
-from portage.output import create_color_func
-bad = create_color_func("BAD")
-
 ostype=platform.system()
 userland = None
 if ostype == "DragonFly" or ostype.endswith("BSD"):
@@ -39,7 +36,7 @@ if not lchown:
                        lchown()
 
 def portage_group_warning():
-       warn_prefix = bad("*** WARNING ***  ")
+       warn_prefix = colorize("BAD", "*** WARNING ***  ")
        mylines = [
                "For security reasons, only system administrators should be",
                "allowed in the portage group.  Untrusted users or processes",
index 2f2c2c8abf92f582199a8df46783fb9a16715661..6bea1e5d3ede8f9543cfdcb36fc75c9b9cf0aa4b 100644 (file)
@@ -9,15 +9,14 @@ import re
 
 import portage
 portage.proxy.lazyimport.lazyimport(globals(),
+       'portage.dep:match_from_list',
        'portage.locks:unlockfile',
+       'portage.output:colorize',
        'portage.util:cmp_sort_key,writemsg',
+       'portage.versions:catpkgsplit,pkgcmp',
 )
 
-from portage.dep import match_from_list
-from portage.output import colorize
 from portage import auxdbkeys, dep_expand
-from portage.versions import catpkgsplit, pkgcmp
-
 
 class dbapi(object):
        _category_re = re.compile(r'^\w[-.+\w]*$')
index 1ccd6babfcbd33d8a0c181427f3868cce2200f6e..40886a55b7b2865bf7817bafcd329d998e11b985 100644 (file)
@@ -6,17 +6,17 @@ __all__ = ["bindbapi", "binarytree"]
 
 import portage
 portage.proxy.lazyimport.lazyimport(globals(),
+       'portage.dep:dep_getkey,isjustname,isvalidatom,match_from_list',
+       'portage.output:EOutput,colorize',
+       'portage.update:update_dbentries',
        'portage.util:ensure_dirs,normalize_path,writemsg,writemsg_stdout',
+       'portage.versions:best,catpkgsplit,catsplit',
 )
 
 from portage.cache.mappings import slot_dict_class
-from portage.dep import isvalidatom, isjustname, dep_getkey, match_from_list
 from portage.dbapi.virtual import fakedbapi
 from portage.exception import InvalidPackageName, \
        PermissionDenied, PortageException
-from portage.output import EOutput, colorize
-from portage.versions import best, catpkgsplit, catsplit
-from portage.update import update_dbentries
 
 from portage import dep_expand, listdir, _check_distfile, _movefile
 
index bd831551fbc3a10a34a835c1703e12ab795caf09..ab5e9ba131f9a621ee714ee9a0020d4b8b66e04a 100644 (file)
@@ -7,7 +7,9 @@ __all__ = ["portdbapi", "close_portdbapi_caches", "portagetree"]
 import portage
 portage.proxy.lazyimport.lazyimport(globals(),
        'portage.checksum',
+       'portage.dep:dep_getkey,match_from_list,paren_reduce,use_reduce',
        'portage.util:ensure_dirs,writemsg',
+       'portage.versions:best,catpkgsplit,pkgsplit,ver_regexp',
 )
 
 from portage.cache.cache_errors import CacheError
@@ -15,11 +17,9 @@ from portage.cache.mappings import slot_dict_class
 from portage.const import REPO_NAME_LOC
 from portage.data import portage_gid, secpass
 from portage.dbapi import dbapi
-from portage.dep import use_reduce, paren_reduce, dep_getkey, match_from_list
 from portage.exception import PortageException, \
        FileNotFound, InvalidDependString, InvalidPackageName
 from portage.manifest import Manifest
-from portage.versions import pkgsplit, catpkgsplit, best, ver_regexp
 
 from portage import eclass_cache, auxdbkeys, doebuild, flatten, \
        listdir, dep_expand, eapi_is_supported, key_expand, dep_check, \
index c63e93f9e94bd4864f9e22e614790dbf3ce7c0fb..8ad88f179322f75bb8130aff4aedea2782f34fa8 100644 (file)
@@ -9,24 +9,24 @@ __all__ = [
 import portage
 portage.proxy.lazyimport.lazyimport(globals(),
        'portage.checksum:perform_md5',
+       'portage.dep:dep_getkey,isjustname,isvalidatom,match_from_list,' + \
+               'use_reduce,paren_reduce',
        'portage.locks:lockdir,unlockdir',
+       'portage.output:bold,colorize',
+       'portage.update:fixdbentries',
        'portage.util:apply_secpass_permissions,ConfigProtect,ensure_dirs,' + \
                'writemsg,writemsg_level,write_atomic,atomic_ofstream,writedict,' + \
-               'grabfile,grabdict,normalize_path,new_protect_filename,getlibpaths'
+               'grabfile,grabdict,normalize_path,new_protect_filename,getlibpaths',
+       'portage.versions:best,catpkgsplit,catsplit,pkgcmp,pkgsplit',
 )
 
 from portage.const import CACHE_PATH, CONFIG_MEMORY_FILE, \
        PORTAGE_PACKAGE_ATOM, PRIVATE_PATH, VDB_PATH
 from portage.data import portage_gid, portage_uid, secpass
 from portage.dbapi import dbapi
-from portage.dep import use_reduce, paren_reduce, isvalidatom, \
-       isjustname, dep_getkey, match_from_list
 from portage.exception import CommandNotFound, \
        InvalidData, InvalidPackageName, \
        FileNotFound, PermissionDenied, UnsupportedAPIException
-from portage.output import bold, colorize
-from portage.update import fixdbentries
-from portage.versions import pkgsplit, catpkgsplit, catsplit, best, pkgcmp
 
 from portage import listdir, dep_expand, digraph, flatten, key_expand, \
        doebuild_environment, doebuild, env_update, prepare_build_dirs, \
index f171f2956aa8fe239824e674a2b124ccb0cc1e9b..4fa73ba5ff57f84d8ce5642ed0f4c11f5af5e739 100644 (file)
@@ -5,10 +5,10 @@
 
 import portage
 portage.proxy.lazyimport.lazyimport(globals(),
+       'portage.output:colorize',
        'portage.util:writemsg',
 )
 
-from portage.output import colorize
 from portage.const import EBUILD_PHASES
 
 import os
index 9d2bd216d0fab2136737e4ec1c59d4423be73525..1244e42322a39be0ac1394262c01701e6d4eb82c 100644 (file)
@@ -10,7 +10,6 @@ portage.proxy.lazyimport.lazyimport(globals(),
        'portage.util:write_atomic',
 )
 
-import portage.versions, portage.const
 from portage.exception import *
 
 class FileNotInManifestException(PortageException):
index 476806d6b274efc4e610cf0bdf36db9dd467457b..fffdc26eb22c6f4555546c760b5eeb0844fffeac 100644 (file)
@@ -6,14 +6,13 @@ import errno, os, re, sys
 
 import portage
 portage.proxy.lazyimport.lazyimport(globals(),
+       'portage.dep:dep_getkey,get_operator,isvalidatom,isjustname,remove_slot',
        'portage.util:ConfigProtect,grabfile,new_protect_filename,' + \
                'normalize_path,write_atomic,writemsg',
+       'portage.versions:ververify'
 )
 
 from portage.exception import DirectoryNotFound, PortageException
-from portage.versions import ververify
-from portage.dep import dep_getkey, get_operator, isvalidatom, isjustname, \
-       remove_slot
 from portage.const import USER_CONFIG_PATH, WORLD_FILE
 
 ignored_dbentries = ("CONTENTS", "environment.bz2")