Commits

Michał Górny  committed 0dd4733

Use dbapi.settings instead of passing settings unnecessarily.

  • Participants
  • Parent commits 32cf7d4

Comments (0)

Files changed (2)

File lib/flaggie/cache.py

 
 	class FlagCache(DBAPICache):
 		aux_key = 'IUSE'
-		def __init__(self, dbapi, settings = None):
+		def __init__(self, dbapi):
 			Caches.DBAPICache.__init__(self, dbapi)
-			self.use_expand_vars = settings.get('USE_EXPAND', '').split() \
-					if settings else []
+			self.use_expand_vars = dbapi.settings.get('USE_EXPAND', '').split()
 
 		@property
 		def glob(self):
 		def __getitem__(self, k):
 			return self.cache
 
-	def __init__(self, dbapi, settings = None):
+	def __init__(self, dbapi):
 		self.caches = {
-			'use': self.FlagCache(dbapi, settings),
+			'use': self.FlagCache(dbapi),
 			'kw': self.KeywordCache(dbapi),
 			'lic': self.LicenseCache(dbapi),
 			'env': self.EnvCache(dbapi)

File lib/flaggie/cli.py

 from flaggie.makeconf import MakeConf
 from flaggie.packagefile import PackageFiles
 
-def parse_actions(args, dbapi, settings, cache, quiet = False, strict = False, \
+def parse_actions(args, dbapi, cache, quiet = False, strict = False, \
 		cleanupact = [], dataout = sys.stdout, output = sys.stderr):
 	out = []
 	actset = ActionSet(cache = cache)
 					actset = ActionSet(cache = cache)
 				had_pkgs = True
 				try:
-					atom = dep_expand(a, mydb = dbapi, settings = settings)
+					atom = dep_expand(a, mydb = dbapi, settings = dbapi.settings)
 					if atom.startswith('null/'):
 						raise InvalidAtom(atom)
 				except AmbiguousPackageName as e:
 	trees = create_trees(
 			config_root = os.environ.get('PORTAGE_CONFIGROOT'),
 			target_root = os.environ.get('ROOT'))
-	porttree = trees[max(trees)]['porttree']
+	porttree = trees[max(trees)]['porttree'].dbapi
 
-	cache = Caches(porttree.dbapi, porttree.settings)
-	act = parse_actions(argv[1:], porttree.dbapi, porttree.settings,
-			cache, quiet = quiet, strict = strict,
-			cleanupact = cleanup_actions, output = output,
-			dataout = dataout)
+	cache = Caches(porttree)
+	act = parse_actions(argv[1:], porttree, cache,
+			quiet = quiet, strict = strict, cleanupact = cleanup_actions,
+			output = output, dataout = dataout)
 	if act is None:
 		return 1
 	if not act: