diff options
| author | stainer_t <thomas.stainer@oecd-nea.org> | 2025-09-08 13:48:49 +0200 |
|---|---|---|
| committer | stainer_t <thomas.stainer@oecd-nea.org> | 2025-09-08 13:48:49 +0200 |
| commit | 7dfcc480ba1e19bd3232349fc733caef94034292 (patch) | |
| tree | 03ee104eb8846d5cc1a981d267687a729185d3f3 /script/set_pythonpath.py | |
Initial commit from Polytechnique Montreal
Diffstat (limited to 'script/set_pythonpath.py')
| -rwxr-xr-x | script/set_pythonpath.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/script/set_pythonpath.py b/script/set_pythonpath.py new file mode 100755 index 0000000..3fddc37 --- /dev/null +++ b/script/set_pythonpath.py @@ -0,0 +1,26 @@ +#!/bin/env python3 +""" generation of PYTHONPATH environment variable for PyGan using pth file""" + +import os, sys +mach=os.environ['MACH'] +Compiler = os.environ.get("COMPILER", None) # Compiler selection +if Compiler == "NVTOOLS": + name=os.getcwd() + "/../PyGan/lib/" + mach+"_nvidia" + "/python" +elif Compiler == "LLVMTOOLS": + name=os.getcwd() + "/../PyGan/lib/" + mach+"_llvm" + "/python" +elif Compiler == "INTELTOOLS": + name=os.getcwd() + "/../PyGan/lib/" + mach+"_intel" + "/python" +else: + name=os.getcwd() + "/../PyGan/lib/" + mach + "/python" +if os.path.isfile(name + "/easy-install.pth"): + pythonpath = "" + count = 0 + f = open(name + "/easy-install.pth", 'r') + for line in f: + count += 1 + location = "{}".format(name + line.strip()[1:]) + pythonpath = pythonpath + location + ":" + f.close() +else: + pythonpath = name +print(pythonpath) |
