Skip to content

Commit

Permalink
Change from hard error to warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
larsevj committed Sep 23, 2024
1 parent acf3d75 commit 95f951e
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions komodoenv/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,6 @@ def copy_config_dirs(config: Dict[str, str]) -> None:
srcpath = Path(config["komodo-root"]) / config["current-release"] / "root"
if not srcpath.is_dir():
srcpath = Path(str(srcpath.parent) + rhel_version_suffix()) / "root"
if not srcpath.is_dir():
msg = f"Not able to find the currently linked komodo release {config['current-release']}"
raise ValueError(msg)
dstpath = Path(__file__).resolve().parents[1]
notebook_version = get_pkg_version(config, srcpath, "notebook")
src_share_jupyter = srcpath / "share" / "jupyter"
Expand Down Expand Up @@ -277,7 +274,7 @@ def get_pkg_version(
config: Dict[str, str],
srcpath: Path,
package: str = "komodoenv",
) -> Optional[List[str]]:
) -> Optional[str]:
"""Locate `package`'s version in the current komodo distribution. This format is
defined in PEP 376 "Database of Installed Python Distributions".
Expand All @@ -302,15 +299,10 @@ def can_update(config: Dict[str, str]) -> bool:
layout is identical, and can be safely updated with this script.
"""
srcpath = (Path(config["komodo-root"]) / config["tracked-release"]).resolve()
if not (srcpath / "root").is_dir():
srcpath = Path(str(srcpath) + rhel_version_suffix())
if not (srcpath / "root").is_dir():
sys.waring(
f"Not able to find the tracked komodo release {config['tracked-release']}. Will not update."
)
return False
version = get_pkg_version(config, srcpath / "root")
track_path = (Path(config["komodo-root"]) / config["tracked-release"]).resolve()
if not (track_path / "root").is_dir():
track_path = Path(str(track_path) + rhel_version_suffix()).resolve()
version = get_pkg_version(config, track_path / "root")
if "komodoenv-version" not in config or version is None:
return False

Expand All @@ -333,8 +325,11 @@ def current_track(config: Dict[str, str]) -> Dict[str, str]:
if not (tracked_release / "root").is_dir():
tracked_release = Path(str(tracked_release) + rhel_version_suffix()).resolve()
if not (tracked_release / "root").is_dir():
msg = f"Not able to find the tracked komodo release {config['tracked-release']}"
raise ValueError(msg)
print(
f"Not able to find the tracked komodo release {config['tracked-release']}. Will not update.",
file=sys.stderr,
)
sys.exit(0)
st = path.stat()

return {
Expand Down Expand Up @@ -473,9 +468,11 @@ def main(args: Optional[List[str]] = None) -> None:
return

if args.check and not can_update(config):
sys.exit(
print(
"Warning: Your komodoenv is out of date. You will need to recreate komodo",
file=sys.stderr,
)
sys.exit(0)

elif args.check:
print(
Expand Down

0 comments on commit 95f951e

Please sign in to comment.