2014-01-11 18:16:30 +05:30
|
|
|
#!/usr/bin/env python
|
2014-04-02 00:11:14 +05:30
|
|
|
# -*- coding: UTF-8 no BOM -*-
|
2014-01-11 18:16:30 +05:30
|
|
|
|
|
|
|
# Makes postprocessing routines acessible from everywhere.
|
|
|
|
import os
|
|
|
|
from damask import Environment
|
|
|
|
|
|
|
|
damaskEnv = Environment()
|
2014-01-24 19:17:46 +05:30
|
|
|
baseDir = damaskEnv.relPath('processing/')
|
2014-01-11 18:16:30 +05:30
|
|
|
codeDir = damaskEnv.relPath('code/')
|
2014-02-28 13:17:11 +05:30
|
|
|
try:
|
|
|
|
binDir = damaskEnv.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):
|
|
|
|
os.mkdir(binDir)
|
2014-01-11 18:16:30 +05:30
|
|
|
|
|
|
|
#define ToDo list
|
2014-03-26 18:41:12 +05:30
|
|
|
bin_link = ['pre','post','misc']
|
2014-01-11 18:16:30 +05:30
|
|
|
|
2014-03-26 18:41:12 +05:30
|
|
|
for myDir in bin_link:
|
|
|
|
myDir = os.path.abspath(os.path.join(baseDir,myDir))
|
|
|
|
for myFile in os.listdir(myDir):
|
2014-04-09 16:10:10 +05:30
|
|
|
if os.path.splitext(myFile)[1] in ['.py']: #only link to know extension, otherwise .py.bak or somethink like that is uses
|
|
|
|
src = os.path.abspath(os.path.join(myDir,myFile))
|
|
|
|
sym_link = os.path.abspath(os.path.join(binDir,os.path.splitext(myFile)[0]))
|
|
|
|
print sym_link,'-->',src
|
|
|
|
if os.path.lexists(sym_link):
|
|
|
|
os.remove(sym_link)
|
|
|
|
os.symlink(src,sym_link)
|
2014-01-11 18:16:30 +05:30
|
|
|
|
|
|
|
|
|
|
|
|