Skip to content

Commit

Permalink
ignore PYTHONPATH; fix error message when repo not found (#32)
Browse files Browse the repository at this point in the history
Fix noisy crashes when invalid inputs were entered:

- an infrequently triggered error when `uenv start` is run without a default repo had an incorrectly formatted error message.
    - fix and made consistent with the equivalent error message for `uenv image` commands.
- if PYTHONPATH was set, incompatible python modules were being picked up
    - launch the commands with `env -u PYTHONPATH -u VIRTUAL_ENV`
  • Loading branch information
bcumming authored May 31, 2024
1 parent 333def7 commit e196151
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.1.1-dev
4.1.1
4 changes: 2 additions & 2 deletions activate
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# only run if bash or zsh
[ -n "${BASH_VERSION:-}" ] || return 0

export UENV_CMD=@@impl@@
export UENV_IMG_CMD=@@image_impl@@
export UENV_CMD='env -u PYTHONPATH -u VIRTUAL_ENV @@impl@@'
export UENV_IMG_CMD='env -u PYTHONPATH -u VIRTUAL_ENV @@image_impl@@'
export UENV_VERSION=@@version@@
export UENV_PREFIX=@@prefix@@

Expand Down
4 changes: 2 additions & 2 deletions test/commands.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ echo ==================== image pull
uenv image pull --help
echo ==================== image ls
uenv image ls --help
echo ==================== image create
uenv image create --help
echo ==================== image repo
uenv image repo --help
echo ==================== image deploy
uenv image deploy --help
echo ==================== run
Expand Down
5 changes: 3 additions & 2 deletions uenv-image
Original file line number Diff line number Diff line change
Expand Up @@ -364,8 +364,9 @@ def safe_repo_open(path: str) -> datastore.FileSystemRepo:
terminal.error(f"""The local repository {path} does not exist.
If this is your first time using uenv, a repo in the default location can be created with this command:
{colorize(f"uenv image repo", "white")}
If you want to create a repo in a custom location, provide the path as follows:
{colorize(f"uenv image repo {repo_path}", "white")}
If you want to create a repo in a custom location , provide the path as follows:
{colorize("uenv image repo <repo_path>", "white")}
where {colorize("<repo_path>", "white")} is the desired location.
""")
except datastore.RepoDBError as err:
terminal.error(f"""The local repository {path} had a database error.
Expand Down
10 changes: 6 additions & 4 deletions uenv-impl
Original file line number Diff line number Diff line change
Expand Up @@ -641,11 +641,13 @@ def parse_image_descriptions(mnt_list, repo, uarch):
try:
fscache = datastore.FileSystemRepo(repo_path)
except datastore.RepoNotFoundError as err:
terminal.error(f"""The local repository {path} does not exist.
If this is your first time using uenv, a repo in the default location can be created with this command:
terminal.error(f"""The local repository {repo_path} does not exist.
If this is your first time using uenv, a repo in the default location can be
created with this command:
{colorize(f"uenv image repo", "white")}
If you want to create a repo in a custom location, provide the path as follows:
{colorize(f"uenv image repo {repo_path}", "white")}
If you want to create a repo in a custom location , provide the path as follows:
{colorize("uenv image repo <repo_path>", "white")}
where {colorize("<repo_path>", "white")} is the desired location.
""", abort=False)
return []
except datastore.RepoDBError as err:
Expand Down

0 comments on commit e196151

Please sign in to comment.