Index: leahi_dialin/utils/enum_updater.py =================================================================== diff -u -raf4e5fe9be4be627d61b4b4f75d0ed56c1ce4fa1 -re9dfb2412b14f3d28824cb3e37c364b8194bb24e --- leahi_dialin/utils/enum_updater.py (.../enum_updater.py) (revision af4e5fe9be4be627d61b4b4f75d0ed56c1ce4fa1) +++ leahi_dialin/utils/enum_updater.py (.../enum_updater.py) (revision e9dfb2412b14f3d28824cb3e37c364b8194bb24e) @@ -33,7 +33,12 @@ Read the enums from the C++ file and then update the Python Enum definitions """ - cpp_repo_loc = path.abspath(f'{path.dirname(__file__)}/../../leahi-common') + cpp_repo_loc = path.abspath(f'{path.dirname(__file__)}/../../../leahi-dialin/leahi_common') + if path.exists(cpp_repo_loc) is False: + cpp_repo_loc = path.abspath(f'{path.dirname(__file__)}/../../../leahi-dialin/leahi-common') + + if path.exists(cpp_repo_loc) is False: + return print(f'C++ repo location not found: {cpp_repo_loc}, skipping enum updates!') files_to_check = [] files_to_check.append(f'{cpp_repo_loc}/AlarmDefs.h') files_to_check.append(f'{cpp_repo_loc}/MsgDefs.h') @@ -62,12 +67,13 @@ # Get the enum member list cpp_enum_values = [ item['value'] for item in extracted_cpp_enums[enum_name] ] + cpp_enum_names = [ item['member'] for item in extracted_cpp_enums[enum_name] ] # Add the original Python enum members that are not present in the C++ enum new_enum.extend( item for item in original_py_enums.get(enum_name, []) - if item['value'] not in cpp_enum_values) + if item['value'] not in cpp_enum_values and item['member'] not in cpp_enum_names) # Sort the new enum list by the value to maintain order new_enum.sort(key=lambda x: x['value']) @@ -186,7 +192,11 @@ lines.append('# @date (original) 31-Jul-2026') lines.append('#') lines.append('############################################################################') + lines.append('') + lines.append('# Module import') lines.append('from enum import unique') + lines.append('') + lines.append('# Project import') lines.append(f'from leahi_dialin.utils.enums import {enum_type}') lines.append('') lines.append('')