canonical / craft-application

The basis for *craft applications
https://canonical-craft-application.readthedocs-hosted.com/en/latest
GNU Lesser General Public License v3.0
7 stars 12 forks source link

'No such file or directory' if application is missing the templates dir #546

Open tigarmo opened 1 week ago

tigarmo commented 1 week ago

Bug Description

I have an admittedly dev version of Rockcraft here that is using the new InitCommand but has no templates.

To Reproduce

Run toolcraft init where toolcraft has no templates dir

part yaml

No response

Relevant log output

❯ rockcraft init
rockcraft internal error: FileNotFoundError(2, 'No such file or directory')
Full execution log: '/home/tiago/.local/state/rockcraft/log/rockcraft-20241024-091607.807534.log'
Traceback (most recent call last):
  File "/snap/rockcraft/x1/lib/python3.10/site-packages/craft_application/application.py", line 600, in run
    return_code = self._run_inner()
  File "/snap/rockcraft/x1/lib/python3.10/site-packages/craft_application/application.py", line 550, in _run_inner
    dispatcher.load_command(self.app_config),
  File "/snap/rockcraft/x1/lib/python3.10/site-packages/craft_cli/dispatcher.py", line 246, in load_command
    self._loaded_command.fill_parser(parser)
  File "/snap/rockcraft/x1/lib/python3.10/site-packages/craft_application/commands/init.py", line 79, in fill_parser
    choices=self.profiles,
  File "/snap/rockcraft/x1/lib/python3.10/site-packages/craft_application/commands/init.py", line 98, in profiles
    template_dirs = [
  File "/snap/rockcraft/x1/lib/python3.10/site-packages/craft_application/commands/init.py", line 98, in <listcomp>
    template_dirs = [
  File "/snap/rockcraft/x1/usr/lib/python3.10/pathlib.py", line 1017, in iterdir
    for name in self._accessor.listdir(self):
FileNotFoundError: [Errno 2] No such file or directory: '/snap/rockcraft/x1/lib/python3.10/site-packages/rockcraft/templates'
syncronize-issues-to-jira[bot] commented 1 week ago

Thank you for reporting us your feedback!

The internal ticket has been created: https://warthogs.atlassian.net/browse/CRAFT-3613.

This message was autogenerated