From d527f91e21d10ffe95d6dc86bcc43bba5ab38b85 Mon Sep 17 00:00:00 2001 From: Rob Mohr Date: Tue, 7 Jan 2020 09:18:57 -0800 Subject: [PATCH] doctor: check for 'cipd' in PATH. Also add the cipd installation folder to PATH. Change-Id: I871b466079250473c41adcba61bd8787305c795f --- env_setup/cipd/update.py | 2 +- pw_doctor/py/pw_doctor/doctor.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/env_setup/cipd/update.py b/env_setup/cipd/update.py index 53ba1aa52..530be7406 100755 --- a/env_setup/cipd/update.py +++ b/env_setup/cipd/update.py @@ -89,7 +89,7 @@ def update(argv=None): if not os.path.isdir(args.install_dir): os.makedirs(args.install_dir) - paths = [] + paths = [args.install_dir] env = { 'CIPD_INSTALL_DIR': args.install_dir, 'CIPD_CACHE_DIR': args.cache_dir, diff --git a/pw_doctor/py/pw_doctor/doctor.py b/pw_doctor/py/pw_doctor/doctor.py index 266352b3f..d0a0c4841 100755 --- a/pw_doctor/py/pw_doctor/doctor.py +++ b/pw_doctor/py/pw_doctor/doctor.py @@ -109,6 +109,10 @@ def cipd(ctx: DoctorContext): """Check cipd is set up correctly and in use.""" cipd_path = 'pigweed' + cipd_exe = shutil.which('cipd') + if not cipd_exe: + ctx.fatal('cipd not in PATH') + temp = tempfile.NamedTemporaryFile(prefix='cipd', delete=False) subprocess.run(['cipd', 'acl-check', '-json-output', temp.name, cipd_path], stdout=subprocess.PIPE)