summaryrefslogtreecommitdiff
path: root/script/set_pythonpath.py
diff options
context:
space:
mode:
Diffstat (limited to 'script/set_pythonpath.py')
-rwxr-xr-xscript/set_pythonpath.py26
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)