PathFinderMixin.find_paths generates erroneous iterator when called with path pattern "." as then essentially Path('.').glob('.') happens, which raises an IndexError. For example:
>>> list(Path('.').glob('.'))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/priit/.pyenv/versions/3.12.0/lib/python3.12/pathlib.py", line 1094, in glob
selector = _make_selector(tuple(pattern_parts), self._flavour, case_sensitive)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/priit/.pyenv/versions/3.12.0/lib/python3.12/pathlib.py", line 83, in _make_selector
pat = pattern_parts[0]
~~~~~~~~~~~~~^^^
IndexError: tuple index out of range
More specifically from the context of the tools, this can happen in case of invalid user input from CLI args:
Stacktrace
Traceback (most recent call last):
File "/Users/builder/.pyenv/versions/3.8.13/lib/python3.8/site-packages/codemagic/cli/cli_app.py", line 243, in invoke_cli
CliApp._running_app._invoke_action(args)
File "/Users/builder/.pyenv/versions/3.8.13/lib/python3.8/site-packages/codemagic/cli/cli_app.py", line 184, in _invoke_action
return cli_action(**action_args)
File "/Users/builder/.pyenv/versions/3.8.13/lib/python3.8/site-packages/codemagic/cli/action.py", line 83, in wrapper
return func(self, *args, **kwargs)
File "/Users/builder/.pyenv/versions/3.8.13/lib/python3.8/site-packages/codemagic/tools/xcode_project.py", line 134, in use_profiles
profiles = [ProvisioningProfile.from_path(p) for p in profile_paths]
File "/Users/builder/.pyenv/versions/3.8.13/lib/python3.8/site-packages/codemagic/tools/xcode_project.py", line 134, in <listcomp>
profiles = [ProvisioningProfile.from_path(p) for p in profile_paths]
File "/Users/builder/.pyenv/versions/3.8.13/lib/python3.8/site-packages/codemagic/mixins/path_finder.py", line 21, in find_paths
for path in self.glob(pattern.expanduser()):
File "/Users/builder/.pyenv/versions/3.8.13/lib/python3.8/pathlib.py", line 1139, in glob
selector = _make_selector(tuple(pattern_parts), self._flavour)
File "/Users/builder/.pyenv/versions/3.8.13/lib/python3.8/pathlib.py", line 463, in _make_selector
pat = pattern_parts[0]
IndexError: tuple index out of range
Handle this case by returning explicitly empty iterator instead.
PathFinderMixin.find_paths
generates erroneous iterator when called with path pattern"."
as then essentiallyPath('.').glob('.')
happens, which raises anIndexError
. For example:More specifically from the context of the tools, this can happen in case of invalid user input from CLI args:
Stacktrace
Handle this case by returning explicitly empty iterator instead.