summaryrefslogtreecommitdiff
path: root/script/set_pythonpath.py
blob: 3fddc377fba3c2e4fa6e23a58feb09ca6aadf0c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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)