You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
658 B
16 lines
658 B
3 years ago
|
import site
|
||
|
import os
|
||
|
import sys
|
||
|
|
||
|
if not any("calculate/contrib" in x for x in sys.path):
|
||
|
for sitedir in site.getsitepackages():
|
||
|
if sitedir.endswith("python3.9/site-packages"):
|
||
|
for i, syspathdir in enumerate(sys.path):
|
||
|
if syspathdir.endswith("python3.9/site-packages"):
|
||
|
contribpath = "%s/calculate/contrib" % syspathdir
|
||
|
if os.path.exists(contribpath):
|
||
|
sys.path.insert(i, contribpath)
|
||
|
break
|
||
|
if not any("calculate/contrib" in x for x in sys.path):
|
||
|
raise ImportError("Failed to install calculate contribution directory")
|