Skip to content

Commit 2ce853a

Browse files
run: find versions of deps, useful for granular regression testing
1 parent d607d20 commit 2ce853a

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

src/pybdsim/Run.py

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,4 +541,29 @@ def RenderGmadJinjaTemplate(template_file, output_file, data, path=".") :
541541
# Write output
542542
f = open(output_file,"w")
543543
f.write(output)
544-
f.close()
544+
f.close()
545+
546+
547+
import subprocess as _subprocess
548+
549+
class Versions :
550+
551+
def __init__(self):
552+
self.root_version = self._find_root_version()
553+
self.geant4_version = self._find_geant4_version()
554+
self.clhep_version = self._find_clhep_version()
555+
556+
def _find_root_version(self) :
557+
result = _subprocess.run(["root-config","--version"], capture_output=True, text=True)
558+
return result.stdout.strip()
559+
560+
def _find_geant4_version(self) :
561+
result = _subprocess.run(["geant4-config","--version"], capture_output=True, text=True)
562+
return result.stdout.strip()
563+
564+
def _find_clhep_version(self) :
565+
try :
566+
result = _subprocess.run(["clhep-config","--version"], capture_output=True, text=True)
567+
return result.stdout.split()[1].strip()
568+
except :
569+
return "Not found"

0 commit comments

Comments
 (0)