summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pym/_emerge/Package.py2
-rw-r--r--pym/portage/package/ebuild/config.py7
-rw-r--r--pym/portage/tests/ebuild/test_doebuild_spawn.py7
3 files changed, 11 insertions, 5 deletions
diff --git a/pym/_emerge/Package.py b/pym/_emerge/Package.py
index 1671c4ef7..f504216e2 100644
--- a/pym/_emerge/Package.py
+++ b/pym/_emerge/Package.py
@@ -52,7 +52,7 @@ class Package(Task):
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")
diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py
index 9089ffb45..cdfbdc28a 100644
--- a/pym/portage/package/ebuild/config.py
+++ b/pym/portage/package/ebuild/config.py
@@ -1767,7 +1767,8 @@ class config(object):
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:
@@ -2006,7 +2007,8 @@ class config(object):
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()
@@ -2020,7 +2022,6 @@ class config(object):
else:
acceptable_properties.add(x)
- properties_str = metadata["PROPERTIES"]
if "?" in properties_str:
use = metadata["USE"].split()
else:
diff --git a/pym/portage/tests/ebuild/test_doebuild_spawn.py b/pym/portage/tests/ebuild/test_doebuild_spawn.py
index f93fa8758..615062709 100644
--- a/pym/portage/tests/ebuild/test_doebuild_spawn.py
+++ b/pym/portage/tests/ebuild/test_doebuild_spawn.py
@@ -9,6 +9,7 @@ from portage.package.ebuild.config import config
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):
"""
@@ -32,7 +33,11 @@ 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)