1. Michał Górny
  2. gentoopm

Commits

Michał Górny  committed 37d1d97

Portage: return tuple in _aux_get() only when necessary.

  • Participants
  • Parent commits eb76b8c
  • Branches master

Comments (0)

Files changed (1)

File gentoopm/portagepm/pkg.py

View file
  • Ignore whitespace
 		return PortagePackageVersion(self._cpv)
 
 	def _aux_get(self, *keys):
-		return self._dbapi.aux_get(self._cpv, keys)
+		val = self._dbapi.aux_get(self._cpv, keys)
+		if len(keys) == 1:
+			return val[0]
+		else:
+			return tuple(val)
 
 	@property
 	def description(self):
 		return StringWrapper(self._dbapi.getRepositoryName(self._tree))
 
 	def _aux_get(self, *keys):
-		return self._dbapi.aux_get(self._cpv, keys,
+		val = self._dbapi.aux_get(self._cpv, keys,
 				mytree = self._tree)
+		if len(keys) == 1:
+			return val[0]
+		else:
+			return tuple(val)
 
 	def __str__(self):
 		return '=%s::%s' % (self._cpv, self.repository)
 	def __getattr__(self, key):
 		if key not in self:
 			raise AttributeError('Unsupported metadata key: %s' % key)
-		return self._pkg._aux_get(key)[0]
+		return self._pkg._aux_get(key)