Loading tools/releasetools/common.py +2 −0 Original line number Diff line number Diff line Loading @@ -3138,6 +3138,8 @@ class DeviceSpecificParams(object): if not os.path.exists(path) and os.path.exists(path + ".py"): path = path + ".py" spec = importlib.util.spec_from_file_location("device_specific", path) if not spec: raise FileNotFoundError(path) logger.info("loaded device-specific extensions from %s", path) module = importlib.util.module_from_spec(spec) spec.loader.exec_module(module) Loading tools/releasetools/test_common.py +8 −0 Original line number Diff line number Diff line Loading @@ -2157,3 +2157,11 @@ class PartitionBuildPropsTest(test_utils.ReleaseToolsTestCase): 'google/coral/coral:10/RP1A.200325.001/6337676:user/dev-keys', 'ro.product.odm.device': 'coral', }, copied_props.build_props) class DeviceSpecificParamsTest(test_utils.ReleaseToolsTestCase): def test_missingSource(self): common.OPTIONS.device_specific = '/does_not_exist' ds = DeviceSpecificParams() self.assertIsNone(ds.module) Loading
tools/releasetools/common.py +2 −0 Original line number Diff line number Diff line Loading @@ -3138,6 +3138,8 @@ class DeviceSpecificParams(object): if not os.path.exists(path) and os.path.exists(path + ".py"): path = path + ".py" spec = importlib.util.spec_from_file_location("device_specific", path) if not spec: raise FileNotFoundError(path) logger.info("loaded device-specific extensions from %s", path) module = importlib.util.module_from_spec(spec) spec.loader.exec_module(module) Loading
tools/releasetools/test_common.py +8 −0 Original line number Diff line number Diff line Loading @@ -2157,3 +2157,11 @@ class PartitionBuildPropsTest(test_utils.ReleaseToolsTestCase): 'google/coral/coral:10/RP1A.200325.001/6337676:user/dev-keys', 'ro.product.odm.device': 'coral', }, copied_props.build_props) class DeviceSpecificParamsTest(test_utils.ReleaseToolsTestCase): def test_missingSource(self): common.OPTIONS.device_specific = '/does_not_exist' ds = DeviceSpecificParams() self.assertIsNone(ds.module)