markfinal / cruiz

Conan recipe user interface
https://cruiz.readthedocs.io/
Apache License 2.0
11 stars 1 forks source link

Detect a recipe without a name attribute and offer the user a chance to set it #145

Open foundry-markf opened 10 months ago

foundry-markf commented 10 months ago

I noticed in recipes without a name attribute (as it's set procedurally on the CLI normally), that cruiz just renders it as "None".

In the same vein as the wizard to choose the version, perhaps a missing name can also be prompted for?

foundry-markf commented 10 months ago

Further, if you can see the console output (which you don't on Windows by default), then there is also this unhandled exception:

(library_env310) C:\Users\mark.final.FOUNDRY>python -m cruiz
ERROR:root:Updating toolbars suppressed: 'replace() argument 2 must be str, not None'
Traceback (most recent call last):
  File "C:\dev\cruiz\cruiz\recipe\recipewidget.py", line 573, in _update_toolbars
    self._ui.commandToolbar.refresh_action_shortcuts_and_tooltips(attributes)
  File "C:\dev\cruiz\cruiz\recipe\toolbars\command.py", line 208, in refresh_action_shortcuts_and_tooltips
    self._make_conan_install_params(recipe_attributes, None),
  File "C:\dev\cruiz\cruiz\recipe\toolbars\command.py", line 516, in _make_conan_install_params
    params = self._make_common_params(
  File "C:\dev\cruiz\cruiz\recipe\toolbars\command.py", line 463, in _make_common_params
    params.install_folder = recipe_widget.resolve_expression(install_folder)
  File "C:\dev\cruiz\cruiz\recipe\recipewidget.py", line 545, in resolve_expression
    expression = expression.replace(match, tokens[token])
TypeError: replace() argument 2 must be str, not None

which looks to be in reference to the missing name.

Clarification: this occurs when trying to do something with the recipe, e.g. setting local workflow directories that expand ${name}, or when running a command.