From aa422e92a4e6cb178e5e2e85fd6fe56309d39c78 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Oriol=20Tint=C3=B3?= <oriol.tinto@lmu.de>
Date: Tue, 14 Mar 2023 10:41:27 +0100
Subject: [PATCH] Don't create a new venv if it already exists

---
 templates/build_enstools.sh | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/templates/build_enstools.sh b/templates/build_enstools.sh
index b7a86d1..71a5684 100644
--- a/templates/build_enstools.sh
+++ b/templates/build_enstools.sh
@@ -33,15 +33,17 @@ if [ $(
   # Compile openmpi with schedulers=slurm
   spack install python@3.8:
 else
-  echo "py-enstools-compression already installed!"
+  echo "python@3.8: already installed!"
 fi
 
 # Link the python binary into the main folder so can be easily used later:
 
 spack load python@3.8:
 
-# Create virtual environment
-python3 -m venv --prompt AS venv
+if [ ! -d venv ]; then
+  # Create virtual environment
+  python3 -m venv --prompt AS venv
+fi
 
 # Load environment
 source venv/bin/activate
-- 
GitLab