From 607a75d2d58a7eefb59bd5e0031ff55acd07b56d Mon Sep 17 00:00:00 2001
From: Reinhard Prix <reinhard.prix@aei.mpg.de>
Date: Mon, 5 Aug 2019 17:09:09 +0200
Subject: [PATCH] fix check_cached_data_okay_to_use()

- logged commandline can contain full path to exectable, so
  cmdline-comparison must be agnostic to that
- fixes failing test against pip-installed lalsuite
---
 pyfstat/make_sfts.py | 4 ++--
 tests.py             | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/pyfstat/make_sfts.py b/pyfstat/make_sfts.py
index 189ab7b..8ef6b1f 100644
--- a/pyfstat/make_sfts.py
+++ b/pyfstat/make_sfts.py
@@ -284,8 +284,8 @@ transientTau = {:10.0f}\n"""
         logging.info("Checking contents of cff file")
         cl_dump = "lalapps_SFTdumpheader {} | head -n 20".format(self.sftfilepath)
         output = helper_functions.run_commandline(cl_dump)
-        calls = [line for line in output.split("\n") if line[:3] == "lal"]
-        if calls[0] == cl_mfd:
+        found = [True for line in output.split("\n") if line[-len(cl_mfd) :] == cl_mfd]
+        if any(found):
             logging.info("Contents matched, use old sft file")
             return True
         else:
diff --git a/tests.py b/tests.py
index 26275f5..a793f04 100644
--- a/tests.py
+++ b/tests.py
@@ -7,6 +7,7 @@ import lalpulsar
 import logging
 import time
 
+
 class Test(unittest.TestCase):
     outdir = "TestData"
 
-- 
GitLab