From 4bca5362cdbab1889cb6df09931ec4c0be702eac Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Tue, 14 May 2019 22:40:17 -0400 Subject: [PATCH] hardlink_packages: Use subprocess instead of os to check for package_repo. --- src/tools/hardlink_packages.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/tools/hardlink_packages.py b/src/tools/hardlink_packages.py index 2b8a84023b..240e48321f 100755 --- a/src/tools/hardlink_packages.py +++ b/src/tools/hardlink_packages.py @@ -7,9 +7,9 @@ # Copyright 2017-2019 Augustin Cavalier # Distributed under the terms of the MIT License. -import sys, os, re, hashlib +import sys, os, subprocess, re, hashlib -if len(sys.argv) < 5: +if len(sys.argv) > 5: print("usage: hardlink_packages.py [arch] [jam RemotePackageRepository file] " + "[prebuilt packages directory] [destination root directory]") print("note that the [jam RemotePackageRepository file] will be modified.") @@ -17,7 +17,8 @@ if len(sys.argv) < 5: + " and a repo.info.template file (using $ARCH$)") sys.exit(1) -if os.system('package_repo') != 1: +if subprocess.run(['package_repo'], None, None, None, + subprocess.DEVNULL, subprocess.PIPE).returncode != 1: print("package_repo command does not seem to exist.") sys.exit(1)