Don't assume _soong_config_namespaces_key is present
The board configuration doesn't use init_globals(),
which is where _soong_config_namespaces_key normally
is set. Just assume empty dictionaries in
soong_config_namespace where appropriate.
Bug: 201700692
Test: build/bazel/ci/rbc_product_config.sh -b armv8-userdebug
Change-Id: I5f1e52fa0bdde32bff0e8db54861557dcb327190
diff --git a/core/product_config.rbc b/core/product_config.rbc
index 24e38b1..bde4f2f 100644
--- a/core/product_config.rbc
+++ b/core/product_config.rbc
@@ -30,7 +30,6 @@
globals[k] = getattr(rblf_cli, k)
globals.setdefault("PRODUCT_SOONG_NAMESPACES", [])
- globals.setdefault(_soong_config_namespaces_key, {})
_envsetup_init(globals, version_info)
# Variables that should be defined.
@@ -299,10 +298,11 @@
def _soong_config_namespace(g, nsname):
"""Adds given namespace if it does not exist."""
- if g[_soong_config_namespaces_key].get(nsname):
+ old = g.get(_soong_config_namespaces_key, {})
+ if old.get(nsname):
return
+
# A value cannot be updated, so we need to create a new dictionary
- old = g[_soong_config_namespaces_key]
g[_soong_config_namespaces_key] = dict([(k,v) for k,v in old.items()] + [(nsname, {})])
def _soong_config_set(g, nsname, var, value):