doctor: check for 'cipd' in PATH.
Also add the cipd installation folder to PATH.
Change-Id: I871b466079250473c41adcba61bd8787305c795f
diff --git a/env_setup/cipd/update.py b/env_setup/cipd/update.py
index 53ba1aa..530be74 100755
--- a/env_setup/cipd/update.py
+++ b/env_setup/cipd/update.py
@@ -89,7 +89,7 @@
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 266352b..d0a0c48 100755
--- a/pw_doctor/py/pw_doctor/doctor.py
+++ b/pw_doctor/py/pw_doctor/doctor.py
@@ -109,6 +109,10 @@
"""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)