2016-05-11 14:31:39 +05:30
|
|
|
#!/usr/bin/env python2
|
2014-04-02 00:11:14 +05:30
|
|
|
# -*- coding: UTF-8 no BOM -*-
|
|
|
|
|
2014-04-29 20:13:04 +05:30
|
|
|
import os,sys
|
2014-01-11 18:16:30 +05:30
|
|
|
import damask
|
|
|
|
|
|
|
|
bin_link = { \
|
|
|
|
'.' : [
|
|
|
|
'DAMASK_spectral.exe',
|
2014-09-10 13:39:35 +05:30
|
|
|
'DAMASK_FEM.exe'
|
2014-01-11 18:16:30 +05:30
|
|
|
],
|
|
|
|
}
|
|
|
|
|
2015-12-08 19:57:58 +05:30
|
|
|
MarcReleases =[2011,2012,2013,2013.1,2014,2014.2,2015]
|
2014-01-11 18:16:30 +05:30
|
|
|
|
2014-01-24 18:00:27 +05:30
|
|
|
baseDir = damask.Environment('../../').relPath('code/')
|
|
|
|
|
2014-02-28 13:17:11 +05:30
|
|
|
try:
|
|
|
|
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):
|
|
|
|
os.mkdir(binDir)
|
2014-01-11 18:16:30 +05:30
|
|
|
|
|
|
|
for dir in bin_link:
|
|
|
|
for file in bin_link[dir]:
|
|
|
|
src = os.path.abspath(os.path.join(baseDir,dir,file))
|
|
|
|
if os.path.exists(src):
|
2014-01-24 18:00:27 +05:30
|
|
|
sym_link = os.path.abspath(os.path.join(binDir,\
|
2014-01-11 18:16:30 +05:30
|
|
|
{True: dir,
|
|
|
|
False:os.path.splitext(file)[0]}[file == '']))
|
|
|
|
if os.path.lexists(sym_link): os.remove(sym_link)
|
|
|
|
os.symlink(src,sym_link)
|
2014-04-29 20:13:04 +05:30
|
|
|
sys.stdout.write(sym_link+' -> '+src+'\n')
|
2014-01-11 18:16:30 +05:30
|
|
|
|
|
|
|
|
|
|
|
for version in MarcReleases:
|
|
|
|
src = os.path.abspath(os.path.join(baseDir,'DAMASK_marc.f90'))
|
|
|
|
if os.path.exists(src):
|
|
|
|
sym_link = os.path.abspath(os.path.join(baseDir,'DAMASK_marc'+str(version)+'.f90'))
|
|
|
|
if os.path.lexists(sym_link): os.remove(sym_link)
|
2014-04-29 20:13:04 +05:30
|
|
|
os.symlink(os.path.relpath(src,baseDir),sym_link)
|
|
|
|
sys.stdout.write(sym_link+' -> '+src+'\n')
|
|
|
|
|