Michał Górny avatar Michał Górny committed e46d2f2

Support reading /etc/portage/make.conf as well.

Comments (0)

Files changed (2)

lib/flaggie/cli.py

 		main([argv[0], '--help'])
 		return 0
 
-	mkconf = MakeConf(os.path.join( \
-		porttree.settings['PORTAGE_CONFIGROOT'], MAKE_CONF_FILE), porttree)
-	pfiles = PackageFiles(os.path.join( \
-		porttree.settings['PORTAGE_CONFIGROOT'], USER_CONFIG_PATH), porttree,
-		mkconf)
+	confroot = porttree.settings['PORTAGE_CONFIGROOT']
+	usercpath = os.path.join(confroot, USER_CONFIG_PATH)
+	mkconf = MakeConf(
+		(os.path.join(confroot, MAKE_CONF_FILE),
+			os.path.join(usercpath, 'make.conf')),
+		porttree)
+	pfiles = PackageFiles(usercpath, porttree, mkconf)
 
 	for actset in act:
 		try:

lib/flaggie/makeconf.py

 
 			f.close()
 
-	def __init__(self, path, dbapi):
-		mf = self.MakeConfFile(path)
-		self.files = {path: mf}
+	def __init__(self, paths, dbapi):
+		self.files = {}
 		self.variables = {}
 
-		self.parse(mf, path)
+		for path in paths:
+			if os.path.exists(path):
+				mf = self.MakeConfFile(path)
+				self.files[path] = mf
+				self.parse(mf, path)
+		# XXX: handle the case when none of the files are found
 
 	def parse(self, mf, path):
 		# 1) group tokens in lines
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.