1. Michał Górny
  2. gentoopm

Commits

Michał Górny  committed fe71e02

Support getting inherits off packages.

  • Participants
  • Parent commits 6dcdf36
  • Branches master

Comments (0)

Files changed (4)

File gentoopm/basepm/pkg.py

View file
  • Ignore whitespace
 		"""
 		pass
 
+	@abstractproperty
+	def inherits(self):
+		"""
+		Eclasses inherited by a package.
+
+		@type: tuple(L{StringWrapper})/C{None}
+		"""
+		pass
+
 	@property
 	def environ(self):
 		"""

File gentoopm/paludispm/pkg.py

View file
  • Ignore whitespace
 		return PaludisPackageDescription(self._pkg)
 
 	@property
+	def inherits(self):
+		k = self._pkg.find_metadata('INHERITED')
+		if k is None:
+			return None
+		return tuple([StringWrapper(x) for x
+			in k.parse_value()])
+
+	@property
 	def slot(self):
 		k = self._pkg.slot_key()
 		return StringWrapper(k.parse_value())

File gentoopm/pkgcorepm/pkg.py

View file
  • Ignore whitespace
 		return PkgCorePackageDescription(self._pkg)
 
 	@property
+	def inherits(self):
+		# ebuilds use _eclasses_
+		# vdb uses INHERITED
+		try:
+			l = self._pkg.data['_eclasses_']
+		except KeyError:
+			try:
+				l = self._pkg.data['INHERITED'].split()
+			except KeyError:
+				return None
+
+		return tuple([StringWrapper(x) for x in l])
+
+	@property
 	def slotted(self):
 		return PkgCoreAtom(self._pkg.slotted_atom)
 

File gentoopm/portagepm/pkg.py

View file
  • Ignore whitespace
 		return PortagePackageDescription(self)
 
 	@property
+	def inherits(self):
+		return tuple([StringWrapper(x) for x
+			in self._aux_get('INHERITED').split()])
+
+	@property
 	def slot(self):
 		return StringWrapper(self._aux_get('SLOT'))