updated symlinking, removed unused "rootRelation"
This commit is contained in:
parent
72d60039c1
commit
3314e5f051
|
@ -4,4 +4,5 @@
|
||||||
*.exe
|
*.exe
|
||||||
*.bak
|
*.bak
|
||||||
*~
|
*~
|
||||||
|
bin
|
||||||
PRIVATE
|
PRIVATE
|
||||||
|
|
9
CONFIG
9
CONFIG
|
@ -1,9 +1,10 @@
|
||||||
# "set"-syntax needed only for tcsh (but works with bash and zsh)
|
# "set"-syntax needed only for tcsh (but works with bash and zsh)
|
||||||
|
# DAMASK_ROOT will be expanded
|
||||||
|
set DAMASK_BIN=${DAMASK_ROOT}/bin
|
||||||
|
|
||||||
|
set DAMASK_NUM_THREADS = 4
|
||||||
|
|
||||||
set MSC_ROOT=/opt/MSC
|
set MSC_ROOT=/opt/MSC
|
||||||
set MARC_VERSION=2015
|
set MARC_VERSION=2015
|
||||||
|
|
||||||
set DAMASK_NUM_THREADS = 4
|
set ABAQUS_VERSION=5.14-5
|
||||||
|
|
||||||
set ABAQUS_VERSION=6.14-5
|
|
||||||
set DAMASK_BIN=${DAMASK_ROOT}/lib
|
|
||||||
|
|
|
@ -13,16 +13,9 @@ bin_link = { \
|
||||||
|
|
||||||
MarcReleases =[2011,2012,2013,2013.1,2014,2014.2,2015]
|
MarcReleases =[2011,2012,2013,2013.1,2014,2014.2,2015]
|
||||||
|
|
||||||
baseDir = damask.Environment('../../').relPath('code/')
|
damaskEnv = damask.Environment()
|
||||||
|
baseDir = damaskEnv.relPath('code/')
|
||||||
try:
|
binDir = damaskEnv.options['DAMASK_BIN']
|
||||||
binDir = damask.Environment().options['DAMASK_BIN']
|
|
||||||
except:
|
|
||||||
root=os.access('/usr/local/bin', os.W_OK)
|
|
||||||
if root:
|
|
||||||
binDir = '/usr/local/bin'
|
|
||||||
else:
|
|
||||||
binDir = os.path.join(os.getenv('HOME'),'bin')
|
|
||||||
|
|
||||||
if not os.path.isdir(binDir):
|
if not os.path.isdir(binDir):
|
||||||
os.mkdir(binDir)
|
os.mkdir(binDir)
|
||||||
|
@ -43,7 +36,11 @@ for version in MarcReleases:
|
||||||
src = os.path.abspath(os.path.join(baseDir,'DAMASK_marc.f90'))
|
src = os.path.abspath(os.path.join(baseDir,'DAMASK_marc.f90'))
|
||||||
if os.path.exists(src):
|
if os.path.exists(src):
|
||||||
sym_link = os.path.abspath(os.path.join(baseDir,'DAMASK_marc'+str(version)+'.f90'))
|
sym_link = os.path.abspath(os.path.join(baseDir,'DAMASK_marc'+str(version)+'.f90'))
|
||||||
if os.path.lexists(sym_link): os.remove(sym_link)
|
if os.path.lexists(sym_link):
|
||||||
os.symlink(os.path.relpath(src,baseDir),sym_link)
|
os.remove(sym_link)
|
||||||
sys.stdout.write(sym_link+' -> '+src+'\n')
|
sys.stdout.write(sym_link)
|
||||||
|
else:
|
||||||
|
sys.stdout.write(damask.util.bcolors.BOLD + sym_link + damask.util.bcolors.ENDC)
|
||||||
|
|
||||||
|
os.symlink(src,sym_link)
|
||||||
|
sys.stdout.write(' -> '+src+'\n')
|
||||||
|
|
|
@ -3,18 +3,11 @@
|
||||||
|
|
||||||
# Makes postprocessing routines acessible from everywhere.
|
# Makes postprocessing routines acessible from everywhere.
|
||||||
import os,sys
|
import os,sys
|
||||||
from damask import Environment
|
import damask
|
||||||
|
|
||||||
BOLD = '\033[1m'
|
damaskEnv = damask.Environment()
|
||||||
ENDC = '\033[0m'
|
|
||||||
|
|
||||||
damaskEnv = Environment()
|
|
||||||
baseDir = damaskEnv.relPath('processing/')
|
baseDir = damaskEnv.relPath('processing/')
|
||||||
codeDir = damaskEnv.relPath('code/')
|
|
||||||
try:
|
|
||||||
binDir = damaskEnv.options['DAMASK_BIN']
|
binDir = damaskEnv.options['DAMASK_BIN']
|
||||||
except:
|
|
||||||
binDir = '/usr/local/bin' if os.access('/usr/local/bin', os.W_OK) else os.path.join(os.getenv('HOME'),'bin')
|
|
||||||
|
|
||||||
if not os.path.isdir(binDir):
|
if not os.path.isdir(binDir):
|
||||||
os.mkdir(binDir)
|
os.mkdir(binDir)
|
||||||
|
@ -36,7 +29,7 @@ for subDir in processing_subDirs:
|
||||||
os.remove(sym_link)
|
os.remove(sym_link)
|
||||||
sys.stdout.write(sym_link)
|
sys.stdout.write(sym_link)
|
||||||
else:
|
else:
|
||||||
sys.stdout.write(BOLD + sym_link + ENDC)
|
sys.stdout.write(damask.util.bcolors.BOLD + sym_link + damask.util.bcolors.ENDC)
|
||||||
|
|
||||||
os.symlink(src,sym_link)
|
os.symlink(src,sym_link)
|
||||||
sys.stdout.write(' -> '+src+'\n')
|
sys.stdout.write(' -> '+src+'\n')
|
||||||
|
|
|
@ -5,12 +5,10 @@ import os,subprocess,shlex,re
|
||||||
|
|
||||||
class Environment():
|
class Environment():
|
||||||
__slots__ = [ \
|
__slots__ = [ \
|
||||||
'rootRelation',
|
|
||||||
'options',
|
'options',
|
||||||
]
|
]
|
||||||
|
|
||||||
def __init__(self,rootRelation = '.'):
|
def __init__(self):
|
||||||
self.rootRelation = rootRelation
|
|
||||||
self.options = {}
|
self.options = {}
|
||||||
self.get_options()
|
self.get_options()
|
||||||
|
|
||||||
|
@ -23,11 +21,12 @@ class Environment():
|
||||||
def get_options(self):
|
def get_options(self):
|
||||||
with open(self.relPath(self.rootDir()+'/CONFIG')) as configFile:
|
with open(self.relPath(self.rootDir()+'/CONFIG')) as configFile:
|
||||||
for line in configFile:
|
for line in configFile:
|
||||||
l = re.sub('^set ', '', line).strip()
|
l = re.sub('^set ', '', line).strip() # remove "set" (tcsh) when setting variables
|
||||||
if l and not l.startswith('#'):
|
if l and not l.startswith('#'):
|
||||||
items = l.split('=')
|
items = l.split('=')
|
||||||
if len(items) == 2:
|
if len(items) == 2:
|
||||||
self.options[items[0].upper()] = items[1]
|
self.options[items[0].upper()] = \
|
||||||
|
re.sub('\$\{*DAMASK_ROOT\}*',self.rootDir(),os.path.expandvars(items[1])) # expand all shell variables and DAMASK_ROOT
|
||||||
|
|
||||||
def isAvailable(self,software,Nneeded =-1):
|
def isAvailable(self,software,Nneeded =-1):
|
||||||
licensesNeeded = {'abaqus' :5,
|
licensesNeeded = {'abaqus' :5,
|
||||||
|
|
Loading…
Reference in New Issue