From 6618ac8e43cc289377826b8a94f996a97a190066 Mon Sep 17 00:00:00 2001
From: Christopher Wipf <wipf@ligo.mit.edu>
Date: Mon, 11 May 2020 15:47:36 -0700
Subject: [PATCH] gwinc.test: inherit python interpreter

Pass sys.executable to the gen_cache.sh script, instead of using a
hard-coded interpreter path
---
 gwinc/test/__main__.py  | 2 +-
 gwinc/test/gen_cache.sh | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/gwinc/test/__main__.py b/gwinc/test/__main__.py
index 3c638f76..cfe52ed9 100644
--- a/gwinc/test/__main__.py
+++ b/gwinc/test/__main__.py
@@ -90,7 +90,7 @@ def gen_cache(git_hash, path):
     """
     logging.info("creating new cache for hash {}...".format(git_hash))
     subprocess.run(
-        [test_path('gen_cache.sh'), git_hash, path],
+        [test_path('gen_cache.sh'), git_hash, path, sys.executable],
         check=True,
     )
 
diff --git a/gwinc/test/gen_cache.sh b/gwinc/test/gen_cache.sh
index 99bfd9bb..42bf206e 100755
--- a/gwinc/test/gen_cache.sh
+++ b/gwinc/test/gen_cache.sh
@@ -8,6 +8,8 @@ fi
 
 git_hash="$1"
 cache_dir="$2"
+python="$3"
+[ -z "$python" ] && python=python3
 
 mkdir -p $cache_dir
 cache_dir=$(cd $cache_dir && pwd)
@@ -19,8 +21,8 @@ git archive $git_hash | tar -x -C $gwinc_dir
 cd $gwinc_dir
 
 export LOG_LEVEL=INFO
-for ifo in $(python3 -c "import gwinc; print(' '.join(gwinc.IFOS))") ; do
-    python3 -m gwinc --save $cache_dir/${ifo}.h5 $ifo
+for ifo in $($python -c "import gwinc; print(' '.join(gwinc.IFOS))") ; do
+    $python -m gwinc --save $cache_dir/${ifo}.h5 $ifo
 done
 
 echo $git_hash > $cache_dir/git_hash
-- 
GitLab