MCPcopy Create free account
hub / github.com/CoolProp/CoolProp / run_script

Function run_script

Web/scripts/__init__.py:51–67  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

49 return False
50
51def run_script(path):
52 if os.path.exists(path):
53 file_path = os.path.dirname(path)
54 file_name = os.path.basename(path)
55 file_extension = path.split(".")[-1]
56 #file_name, file_extension = os.path.splitext(path)
57
58 if file_extension.lower() == "py":
59 subprocess.check_call('python -u {0}'.format(file_name), cwd=file_path, shell=True)
60 elif file_extension.lower() == "sh" or file_extension.lower() == "bsh":
61 subprocess.check_call('chmod +x {0}'.format(file_name), cwd=file_path, shell=True)
62 subprocess.check_call('sed -i "s/\r//g" {0}'.format(file_name), cwd=file_path, shell=True)
63 subprocess.check_call('./{0}'.format(file_name), cwd=file_path, shell=True)
64 else:
65 print("Unknown file extension in {0}".format(path))
66 else:
67 print("Could not find the file {0}".format(path))
68
69
70# Inject the version of CoolProp into the doxygen configuration files

Callers 1

__init__.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected