Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@uilianries
Copy link
Contributor

@uilianries uilianries commented Aug 28, 2025

When installing a script using tome install -e but instead of pointing to the folder where those scripts are, when pointing to a specific script, the command fails with an not expected scenario:

tome install -e ~/Development/tome/tome-commands/ansible/list_inventories.py
Error: Traceback (most recent call last):
  File "/home/uilian/Development/tome/tomescripts/tome/cli.py", line 405, in main
    cli.run(args)
  File "/home/uilian/Development/tome/tomescripts/tome/cli.py", line 337, in run
    command.run(self._tome_api, args[0][1:])
  File "/home/uilian/Development/tome/tomescripts/tome/command.py", line 177, in run
    info = self._method(tome_api, self.parser, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/uilian/Development/tome/tomescripts/tome/commands/install.py", line 67, in install
    result = tome_api.install.install_editable(source, args.force_requirements, args.create_env)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/uilian/Development/tome/tomescripts/tome/api/subapi/install.py", line 15, in install_editable
    return install_editable(source, self.tome_api.cache_folder, force_requirements, create_env)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/uilian/Development/tome/tomescripts/tome/internal/installer.py", line 236, in install_editable
    if not _has_valid_commands(source.uri):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/uilian/Development/tome/tomescripts/tome/internal/installer.py", line 169, in _has_valid_commands
    for subdir_name in os.listdir(directory):
                       ^^^^^^^^^^^^^^^^^^^^^
NotADirectoryError: [Errno 20] Not a directory: '/home/uilian/Development/tome/tome-commands/ansible/list_inventories.py'

Using the following PR content, the output will be:

tome install -e ~/Development/tome/tome-commands/ansible/list_inventories.py

Error: The following directory does not exist or is not a directory: '/home/uilian/Development/tome/tome-commands/ansible/list_inventories.py'. Please, provide a valid directory.

@davidsanfal
Copy link
Collaborator

Looks good!

uilianries and others added 2 commits August 29, 2025 09:20
Co-authored-by: David Sánchez Falero <[email protected]>
Co-authored-by: David Sánchez Falero <[email protected]>
@uilianries
Copy link
Contributor Author

@davidsanfal Thank you for your review. Your suggestions are now merged into the code.

@czoido
Copy link
Collaborator

czoido commented Aug 29, 2025

Looks good!
Maybe we should check what happens for a similar case with an uninstall?

@uilianries
Copy link
Contributor Author

Maybe we should check what happens for a similar case with an uninstall?

I gonna check it!

@uilianries
Copy link
Contributor Author

@czoido @davidsanfal I made a small change for uninstall message as well. Previously, it was:

Source '{source}' is not installed or already uninstalled.

Now, when trying to uninstall a file instead of a directory, it will be:

The following path does not exist or is not a directory: '{source}'. Please, provide a valid directory.

@uilianries uilianries requested a review from davidsanfal August 30, 2025 14:52
@czoido czoido merged commit 8bdfa48 into jfrog:main Sep 2, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants