made $DAMASK_ROOT definition optional

This commit is contained in:
Philip Eisenlohr 2011-11-03 13:51:54 +00:00
parent b9647b2584
commit 9e3d7d7d6c
5 changed files with 9 additions and 6 deletions

View File

@ -9,12 +9,15 @@ class MSC_TOOLS():
'2005r3':[''],
}
def library_paths(self):
def library_paths(self,callerPath=None,libRelation=''):
import os
if callerPath: DamaskRoot = os.path.normpath(os.path.join(os.path.dirname(os.path.realpath(callerPath)),libRelation))
else: DamaskRoot = os.getenv('DAMASK_ROOT')
thePath = ''
try: # check for MSC.Mentat installation location
file = open(os.path.join(os.getenv('DAMASK_ROOT'),'lib/pathinfo'))
file = open(os.path.join(DamaskRoot,'lib/pathinfo'))
for line in file.readlines():
if line.split()[0] == 'MSC': MSCpath = os.path.normpath(line.split()[1])
file.close()

View File

@ -4,7 +4,7 @@ import sys, os, msc_tools
from colorsys import *
from optparse import OptionParser
sys.path.append(msc_tools.MSC_TOOLS().library_paths())
sys.path.append(msc_tools.MSC_TOOLS().library_paths(sys.argv[0],'../../'))
try:
from py_mentat import *

View File

@ -3,7 +3,7 @@
import sys,os,pwd,math,re,string,msc_tools
from optparse import OptionParser
sys.path.append(msc_tools.MSC_TOOLS().library_paths())
sys.path.append(msc_tools.MSC_TOOLS().library_paths(sys.argv[0],'../../'))
try:
from py_mentat import *

View File

@ -251,7 +251,7 @@ parser.set_defaults(homogenization = 1)
(options, args) = parser.parse_args()
sys.path.append(msc_tools.MSC_TOOLS().library_paths())
sys.path.append(msc_tools.MSC_TOOLS().library_paths(sys.argv[0],'../../'))
try:
from py_mentat import *

View File

@ -10,7 +10,7 @@ try: # check for Python Image Lib
except:
ImageCapability = False
sys.path.append(msc_tools.MSC_TOOLS().library_paths())
sys.path.append(msc_tools.MSC_TOOLS().library_paths(sys.argv[0],'../../'))
try: # check for MSC.Mentat Python interface
from py_mentat import *