From bc258e01002bf3682998e6923f829f0bb74e85f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Berland?= Date: Fri, 24 Feb 2023 10:15:42 +0100 Subject: [PATCH] fix --- komodo/cli.py | 17 ++++++++--------- komodo/fetch.py | 8 ++++---- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/komodo/cli.py b/komodo/cli.py index 6b547b298..1211920a3 100755 --- a/komodo/cli.py +++ b/komodo/cli.py @@ -54,9 +54,7 @@ def _main(args): data = Data(extra_data_dirs=args.extra_data_dirs) if args.download or (not args.build and not args.install): - git_hashes = fetch( - args.pkgs, args.repo, outdir=args.workspace_for_downloads, pip=args.pip - ) + git_hashes = fetch(args.pkgs, args.repo, outdir=args.downloads, pip=args.pip) if args.download and not args.build: sys.exit(0) @@ -72,7 +70,7 @@ def _main(args): args.repo, data, prefix=str(tmp_prefix), - dlprefix=args.workspace_for_downloads, + dlprefix=args.downloads, builddir=args.tmp, jobs=args.jobs, cmk=args.cmake, @@ -162,8 +160,9 @@ def _main(args): "--no-index", "--no-deps", "--ignore-installed", - f"--cache-dir {args.workspace_for_downloads}", - f"--find-links {args.workspace_for_downloads}", + # assuming fetch.py has done "pip download" to this directory: + f"--cache-dir {args.downloads}", + f"--find-links {args.downloads}", ] shell_input.append(current.get("makeopts")) @@ -268,14 +267,14 @@ def parse_args(args: List[str]) -> argparse.Namespace: "current working directory.", ) optional_args.add_argument( - "--workspace_for_downloads", + "--downloads", "--cache", # deprecated "-c", # deprecated type=str, - default="_work", + default="downloads", help="A temporary destination directory used for downloads, " "used by pip download, cp, rsync and git clone. This directory " - "should be empty if it already exists, otherwise it will be created.", + "must be empty if it already exists, otherwise it will be created.", ) optional_args.add_argument( "--jobs", diff --git a/komodo/fetch.py b/komodo/fetch.py index f7d7e9aec..530e3cfdb 100644 --- a/komodo/fetch.py +++ b/komodo/fetch.py @@ -74,9 +74,8 @@ def fetch(pkgs, repo, outdir, pip="pip") -> dict: "cannot be None or the empty string." ) if os.path.exists(outdir) and os.listdir(outdir): - print( - f"WARNING: Downloading to non-empty directory {outdir}, " - "this is not recommended." + raise RuntimeError( + f"Downloading to non-empty directory {outdir} is not supported." ) if not os.path.exists(outdir): os.mkdir(outdir) @@ -176,7 +175,8 @@ def fetch(pkgs, repo, outdir, pip="pip") -> dict: "-o", type=str, required=True, - help="The download destination for pip, cp, rsync and git; will be created.", + help="The download destination for pip, cp, rsync and git. " + "Must be non-existing or empty.", ) parser.add_argument( "--pip",