diff --git a/hb_internal/common/config.py b/hb_internal/common/config.py index 76e5962dd140c8c29afd1ed90b1512172e7fe054..5513c1b436a51435460219259c78a8ce20a92015 100644 --- a/hb_internal/common/config.py +++ b/hb_internal/common/config.py @@ -292,7 +292,7 @@ class Config(metaclass=Singleton): def vendor_path(self): _vendor_path = os.path.join(self.root_path, 'vendor') if not os.path.isdir(_vendor_path): - raise OHOSException(f'Invalid vendor path: {_vendor_path}') + _vendor_path = '' return _vendor_path @property diff --git a/hb_internal/common/product.py b/hb_internal/common/product.py index 74acc864397bae3433ca8f91c3629537e246188d..f703999f79275e5be6521e5f932cd9d2658bb26a 100755 --- a/hb_internal/common/product.py +++ b/hb_internal/common/product.py @@ -82,29 +82,31 @@ class Product(): 'config': config_path, 'component_type': info.get('component_type', '') } - for company in os.listdir(config.vendor_path): - company_path = os.path.join(config.vendor_path, company) - if not os.path.isdir(company_path): - continue + if config.vendor_path != '': + for company in os.listdir(config.vendor_path): + company_path = os.path.join(config.vendor_path, company) + if not os.path.isdir(company_path): + continue - for product in os.listdir(company_path): - product_path = os.path.join(company_path, product) - config_path = os.path.join(product_path, 'config.json') - if os.path.isfile(config_path): - info = read_json_file(config_path) - product_name = info.get('product_name') - if product_name is not None: - yield { - 'company': company, - "name": product_name, - 'product_config_path': product_path, - 'product_path': product_path, - 'version': info.get('version', '3.0'), - 'os_level': info.get('type', "mini"), - 'config': config_path, - 'component_type': info.get('component_type', '') - } + for product in os.listdir(company_path): + product_path = os.path.join(company_path, product) + config_path = os.path.join(product_path, 'config.json') + + if os.path.isfile(config_path): + info = read_json_file(config_path) + product_name = info.get('product_name') + if product_name is not None: + yield { + 'company': company, + "name": product_name, + 'product_config_path': product_path, + 'product_path': product_path, + 'version': info.get('version', '3.0'), + 'os_level': info.get('type', "mini"), + 'config': config_path, + 'component_type': info.get('component_type', '') + } bip_path = config.built_in_product_path for item in os.listdir(bip_path): if item[0] in ".":