Michał Górny avatar Michał Górny committed 81e8001

Introduce preliminary support for package.env file.

Comments (0)

Files changed (2)


 import os, os.path
+from portage.const import USER_CONFIG_PATH
 from portage.dep import use_reduce
 from portage.versions import best
 			return lic
+	class EnvCache(object):
+		def __init__(self, dbapi):
+			# XXX: filter out directories
+			path = os.path.join(dbapi.settings['PORTAGE_CONFIGROOT'], USER_CONFIG_PATH, 'env')
+			self.cache = frozenset(os.listdir(path))
+		@property
+		def glob(self):
+			return self.cache
+		def __getitem__(self, k):
+			return self.cache
 	def __init__(self, dbapi):
 		self.caches = {
 			'use': self.FlagCache(dbapi),
 			'kw': self.KeywordCache(dbapi),
-			'lic': self.LicenseCache(dbapi)
+			'lic': self.LicenseCache(dbapi),
+			'env': self.EnvCache(dbapi)
 	def glob_whatis(self, arg, restrict = None):
 			return 'keyword'
 		elif ns == 'lic':
 			return 'license'
+		elif ns == 'env':
+			return 'env file'
 			raise AssertionError('Unexpected ns %s' % ns)


 		self.files = {
 			'use': PackageFileSet(p('package.use')),
 			'kw': PackageKeywordsFileSet(p('package.keywords'), dbapi),
-			'lic': PackageFileSet(p('package.license'))
+			'lic': PackageFileSet(p('package.license')),
+			'env': PackageFileSet(p('package.env'))
 	def __getitem__(self, k):
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.