diff --git a/CMakeLists.txt b/CMakeLists.txt index a6447f9c3..e95cbef02 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -305,7 +305,8 @@ if(ENABLE_EMBEDDED_PCIIDS AND NOT EXISTS "${PROJECT_BINARY_DIR}/fastfetch_pciids RESULT_VARIABLE PYTHON_PCIIDS_RETCODE) if(NOT PYTHON_PCIIDS_RETCODE EQUAL 0) file(REMOVE "${PROJECT_BINARY_DIR}/fastfetch_pciids.c.inc") - message(FATAL_ERROR "Failed to generate 'fastfetch_pciids.c.inc'") + message(WARNING "Failed to generate 'fastfetch_pciids.c.inc'") + set(ENABLE_EMBEDDED_PCIIDS OFF) endif() else() message(WARNING "Python3 is not found, 'fastfetch_pciids.c.inc' will not be generated") @@ -325,7 +326,8 @@ if(ENABLE_EMBEDDED_AMDGPUIDS AND NOT EXISTS "${PROJECT_BINARY_DIR}/fastfetch_amd RESULT_VARIABLE PYTHON_AMDGPUIDS_RETCODE) if(NOT PYTHON_AMDGPUIDS_RETCODE EQUAL 0) file(REMOVE "${PROJECT_BINARY_DIR}/fastfetch_amdgpuids.c.inc") - message(FATAL_ERROR "Failed to generate 'fastfetch_amdgpuids.c.inc'") + message(WARNING "Failed to generate 'fastfetch_amdgpuids.c.inc'") + set(ENABLE_EMBEDDED_AMDGPUIDS OFF) endif() else() message(WARNING "Python3 is not found, 'fastfetch_amdgpuids.c.inc' will not be generated") diff --git a/scripts/gen-amdgpuids.py b/scripts/gen-amdgpuids.py index 463b42690..36292c845 100755 --- a/scripts/gen-amdgpuids.py +++ b/scripts/gen-amdgpuids.py @@ -6,6 +6,9 @@ def main(amdgpu_ids_path: str): with open(amdgpu_ids_path, 'r') as f: full_text = f.read() + if full_text == '': + sys.exit('Error: pci.ids file is empty') + products = [] for line in full_text.split('\n'): if not line or line[0] == '#' or not ',\t' in line: diff --git a/scripts/gen-pciids.py b/scripts/gen-pciids.py index 4c1270b9d..cb8cdc03b 100755 --- a/scripts/gen-pciids.py +++ b/scripts/gen-pciids.py @@ -18,6 +18,9 @@ def main(keep_vendor_list: set, pci_ids_path: str): with open(pci_ids_path, 'r') as f: full_text = f.read() + if full_text == '': + sys.exit('Error: pci.ids file is empty') + dev_list_text = full_text[:full_text.rfind('\n\n\n')] # remove known classes for line in dev_list_text.split('\n'): if not line or line[0] == '#':