Skip to content

Commit

Permalink
extract_utils: add support for selecting a module based on device name
Browse files Browse the repository at this point in the history
Change-Id: Ie3c0b6e953f66040e81a3753db5fa7060840a33d
  • Loading branch information
Demon000 authored and lifehackerhansol committed Jan 11, 2025
1 parent 18612c5 commit 28ec8d6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions extract_utils/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
action='store_true',
help='Extract all files from archive',
)
group.add_argument(
'--only-name',
help='only extract module with device name',
)
group.add_argument(
'--only-common',
action='store_true',
Expand Down Expand Up @@ -94,6 +98,7 @@ def __init__(self, args: argparse.Namespace):
self.extract_all: bool = args.extract_all
self.only_common: bool = args.only_common
self.only_target: bool = args.only_target
self.only_name: str = args.only_name
self.extract_factory: bool = args.extract_factory
self.regenerate_makefiles: bool = args.regenerate_makefiles
self.regenerate: bool = args.regenerate
Expand Down
7 changes: 6 additions & 1 deletion extract_utils/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@ def __init__(
self.__args = parse_args()

self.__modules: List[ExtractUtilsModule] = []
if self.__args.only_target:
if self.__args.only_name:
all_modules = [device_module] + common_modules
for module in all_modules:
if module.device == self.__args.only_name:
self.__modules.append(module)
elif self.__args.only_target:
self.__modules.append(device_module)
elif self.__args.only_common:
self.__modules.extend(common_modules)
Expand Down

0 comments on commit 28ec8d6

Please sign in to comment.