From 1d3e173b25504d70e4f49edee25730cdf20386d5 Mon Sep 17 00:00:00 2001
From: Augustin Zidek <augustinzidek@google.com>
Date: Thu, 14 Nov 2024 10:04:33 +0000
Subject: [PATCH] Display a user-friendly warning if curl or zstd are missing

PiperOrigin-RevId: 696440060
---
 fetch_databases.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/fetch_databases.py b/fetch_databases.py
index 1f4c08e..b4d47a1 100644
--- a/fetch_databases.py
+++ b/fetch_databases.py
@@ -19,6 +19,7 @@ import concurrent.futures
 import functools
 import os
 import pathlib
+import shutil
 import subprocess
 import sys
 
@@ -105,6 +106,11 @@ def main(argv=('',)) -> None:
         f' {destination}.'
     ) from e
 
+  if shutil.which('curl') is None:
+    raise ValueError('curl is not installed. Please install it and try again.')
+  if shutil.which('zstd') is None:
+    raise ValueError('zstd is not installed. Please install it and try again.')
+
   # Download each of the files and decompress them in parallel.
   with concurrent.futures.ThreadPoolExecutor(
       max_workers=len(DATABASE_FILES)
-- 
GitLab