Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get_version(self) -> str:
self.found(raise_error=True)
which_prog = which("entos")
if which_prog not in self.version_cache:
with popen([which_prog, "--version"]) as exc:
exc["proc"].wait(timeout=15)
self.version_cache[which_prog] = safe_version(exc["stdout"].split()[2])
return self.version_cache[which_prog]
def get_version(self) -> str:
self.found(raise_error=True)
which_prog = which("psi4")
if which_prog not in self.version_cache:
with popen([which_prog, "--version"]) as exc:
exc["proc"].wait(timeout=30)
self.version_cache[which_prog] = safe_version(exc["stdout"].split()[-1])
candidate_version = self.version_cache[which_prog]
if "undef" in candidate_version:
raise TypeError(
"Using custom build without tags. Please pull git tags with `git pull origin master --tags`."
)
return candidate_version
def get_version(self) -> str:
self.found(raise_error=True)
which_prog = which("terachem")
if which_prog not in self.version_cache:
with popen([which_prog, "--version"]) as exc:
exc["proc"].wait(timeout=5)
mobj = re.search(NUMBER, exc["stdout"], re.VERBOSE)
version = mobj.group(0)
self.version_cache[which_prog] = safe_version(version)
return self.version_cache[which_prog]
if config.use_mpiexec:
command = create_mpi_invocation(which_prog, config)
else:
command = [which_prog]
command.append("v.nw")
if which_prog not in self.version_cache:
success, output = execute(command, {"v.nw": ""}, scratch_directory=config.scratch_directory)
if success:
for line in output["stdout"].splitlines():
if "nwchem branch" in line:
branch = line.strip().split()[-1]
if "nwchem revision" in line:
revision = line.strip().split()[-1]
self.version_cache[which_prog] = safe_version(branch + "+" + revision)
else:
raise UnknownError(output["stderr"])
return self.version_cache[which_prog]
def get_version(self) -> str:
self.found(raise_error=True)
which_prog = which("qchem")
if which_prog not in self.version_cache:
with popen([which_prog, "-h"], popen_kwargs={"env": self._get_qc_path()}) as exc:
exc["proc"].wait(timeout=15)
if "QC not defined" in exc["stdout"]:
return safe_version("0.0.0")
self.version_cache[which_prog] = safe_version(exc["stdout"].splitlines()[0].split()[-1])
return self.version_cache[which_prog]
def get_version(self) -> str:
self.found(raise_error=True)
which_prog = which("dftd3")
if which_prog not in self.version_cache:
# Note: anything below v3.2.1 will return the help menu here. but that's fine as version compare evals to False.
command = [which_prog, "-version"]
import subprocess
proc = subprocess.run(command, stdout=subprocess.PIPE)
self.version_cache[which_prog] = safe_version(proc.stdout.decode("utf-8").strip())
return self.version_cache[which_prog]
which_prog = which("molpro")
if which_prog not in self.version_cache:
success, output = execute(
[which_prog, "version.inp", "-d", ".", "-W", "."],
infiles={"version.inp": ""},
outfiles=["version.out", "version.xml"],
)
if success:
tree = ET.ElementTree(ET.fromstring(output["outfiles"]["version.xml"]))
root = tree.getroot()
version_tree = root.find("molpro_uri:job/molpro_uri:platform/molpro_uri:version", name_space)
year = version_tree.attrib["major"]
minor = version_tree.attrib["minor"]
molpro_version = year + "." + minor
self.version_cache[which_prog] = safe_version(molpro_version)
return self.version_cache[which_prog]
def get_version(self) -> str:
which_prog = which("define")
if which_prog not in self.version_cache:
# We use basically a dummy stdin as we dont want to pipe any real
# input into define. We only want to parse the version number from
# the string.
with temporary_directory(suffix="_define_scratch") as tmpdir:
tmpdir = Path(tmpdir)
stdout = execute_define("\n", cwd=tmpdir)
# Tested with V7.3 and V7.4.0
version_re = re.compile("TURBOMOLE (?:rev\. )?(V.+?)\s+")
mobj = version_re.search(stdout)
version = mobj[1]
self.version_cache[which_prog] = safe_version(version)
return self.version_cache[which_prog]