From 91df94824f1e09a33fea82441776526de4de6bc5 Mon Sep 17 00:00:00 2001 From: "piotr.malkowski" Date: Tue, 29 Oct 2024 13:36:39 +0100 Subject: [PATCH] add automatic dependencies install for demonstrators --- scripts/install-python-dependencies.py | 28 +++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/scripts/install-python-dependencies.py b/scripts/install-python-dependencies.py index 5edbf6fe..eb0c1f8b 100644 --- a/scripts/install-python-dependencies.py +++ b/scripts/install-python-dependencies.py @@ -2,18 +2,18 @@ import subprocess script_dir = os.path.dirname(os.path.realpath(__file__)) -base_dir = os.path.join(script_dir, '..', 'solvers') - -for root, dirs, files in os.walk(base_dir): - # Check if 'requirements.txt' is in the current directory - req_file = os.path.join(root, 'requirements.txt') - if os.path.exists(req_file): - print(f"Found requirements.txt in {root}, installing dependencies...") - try: - subprocess.run(['pip', 'install', '-r', req_file], check=True) # single thread to avoid dep. errors - except subprocess.CalledProcessError as e: - print(f"Error installing requirements for {root}: {e}") - - - +base_dirs = [ + os.path.join(script_dir, '..', 'solvers'), + os.path.join(script_dir, '..', 'demonstrators') +] +for base_dir in base_dirs: + for root, dirs, files in os.walk(base_dir): + # Check if 'requirements.txt' is in the current directory + req_file = os.path.join(root, 'requirements.txt') + if os.path.exists(req_file): + print(f"Found requirements.txt in {root}, installing dependencies...") + try: + subprocess.run(['pip', 'install', '-r', req_file], check=True) # single thread to avoid dep. errors + except subprocess.CalledProcessError as e: + print(f"Error installing requirements for {root}: {e}")