fix code to tolerate missing metadata values in various places.
not eapi_has_iuse_defaults(self.metadata["EAPI"]):
self._invalid_metadata('IUSE.invalid',
"IUSE contains defaults, but EAPI doesn't allow them")
- if self.metadata["REQUIRED_USE"] and \
+ if self.metadata.get("REQUIRED_USE") and \
not eapi_has_required_use(self.metadata["EAPI"]):
self._invalid_metadata('REQUIRED_USE.invalid',
"REQUIRED_USE set, but EAPI doesn't allow it")
def _getKeywords(self, cpv, metadata):
cp = cpv_getkey(cpv)
pkg = "%s:%s" % (cpv, metadata["SLOT"])
- keywords = [[x for x in metadata["KEYWORDS"].split() if x != "-*"]]
+ keywords = [[x for x in metadata.get("KEYWORDS", "").split() \
+ if x != "-*"]]
for pkeywords_dict in self._pkeywords_list:
cpdict = pkeywords_dict.get(cp)
if cpdict:
for x in pproperties_list:
accept_properties.extend(x)
- properties = set(use_reduce(metadata["PROPERTIES"], matchall=1, flat=True))
+ properties_str = metadata.get("PROPERTIES", "")
+ properties = set(use_reduce(properties_str, matchall=1, flat=True))
properties.discard('||')
acceptable_properties = set()
else:
acceptable_properties.add(x)
- properties_str = metadata["PROPERTIES"]
if "?" in properties_str:
use = metadata["USE"].split()
else:
from portage.package.ebuild.doebuild import spawn as doebuild_spawn
from portage.tests import TestCase
from portage.tests.resolver.ResolverPlayground import ResolverPlayground
+from _emerge.Package import Package
class DoebuildSpawnTestCase(TestCase):
"""
'RDEPEND' : '>=app-shells/bash-3.2_p17 >=dev-lang/python-2.6',
'SLOT' : '0',
}
- settings.setcpv(cpv, mydb=metadata)
+ root_config = playground.trees[playground.root]['root_config']
+ pkg = Package(built=False, cpv=cpv, installed=False,
+ metadata=metadata, root_config=root_config,
+ type_name='ebuild')
+ settings.setcpv(pkg)
settings['PORTAGE_PYTHON'] = sys.executable
settings['PORTAGE_BUILDDIR'] = os.path.join(
settings['PORTAGE_TMPDIR'], cpv)