From 51cf52c38848534ac3ef5210d97a77cb8fe22819 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Sun, 30 Jun 2019 09:44:40 +0200 Subject: [PATCH] Build script: Don't use wget or curl, just urlretrieve --- nix/build-all.py | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/nix/build-all.py b/nix/build-all.py index 376858c671..e33083d947 100644 --- a/nix/build-all.py +++ b/nix/build-all.py @@ -262,20 +262,9 @@ for cmd in [git, bunzip2, tar, cc, cplusplus, autoconf, automake, yacc, make, "p raise ValueError("Required tool '%s' not installed or not added to PATH" % (cmd,)) # identifiers for the download tool (could be less memory consuming as ints, but are more verbose as strings) -download_tool_curl="curl" -download_tool_wget="wget" +download_tool_default = download_tool_py = "py" download_tool_git = "git" -if which(wget) != None: - download_tool_default = download_tool_wget -elif which(curl) != None: - download_tool_default = download_tool_curl -else: - raise ValueError("No download application found, tried: curl, wget") - -CURL = ["curl", "-sL"] -WGET= ["wget", "-q", "--no-check-certificate"] - # Create log directory and file log_dir = os.path.join(DEPS_DIR, "logs") @@ -362,25 +351,18 @@ def build_dependency(name, mode, build_tool_args, download_url, download_name, d build_dir = os.path.join(DEPS_DIR, "build") if not os.path.exists(build_dir): os.makedirs(build_dir) + + logger.info("\rFetching %s... " % (name,)) - if download_tool == download_tool_curl or download_tool == download_tool_wget: + if download_tool == download_tool_py: if no_append_name: url = download_url else: url = os.path.join(download_url, download_name) - - if download_tool == download_tool_curl: + download_path = os.path.join(build_dir, download_name) if not os.path.exists(download_path): - logger.info("\rDownloading %s... " % (name,)) - run(CURL + ["-o", download_name, url], cwd=build_dir) - else: - logger.info("Download '%s' already exists, assuming it's an undamaged download and that it has been extracted if possible, skipping" % (download_path,)) - elif download_tool == download_tool_wget: - download_path = os.path.join(build_dir, download_name) - if not os.path.exists(download_path): - logger.info("\rDownloading %s... " % (name,)) - run(WGET + ["-O", download_name, url], cwd=build_dir) + urlretrieve(url, os.path.join(build_dir, download_path)) else: logger.info("Download '%s' already exists, assuming it's an undamaged download and that it has been extracted if possible, skipping" % (download_path,)) elif download_tool == download_tool_git: