check for existence of files before sym-linking to them.
This commit is contained in:
parent
0513bf3256
commit
ad9639f2f7
|
@ -45,7 +45,7 @@ architectures = {
|
|||
}
|
||||
|
||||
bin_link = { \
|
||||
'' : [
|
||||
'.' : [
|
||||
'DAMASK_spectral.exe',
|
||||
],
|
||||
}
|
||||
|
@ -91,14 +91,14 @@ if (options.spectralCompile):
|
|||
os.system('make --directory %s clean'%(baseDir))
|
||||
os.system('make --directory %s %s'%(baseDir,' '.join(options.makeOptions)))
|
||||
|
||||
# processing symbolic linking list
|
||||
for dir in bin_link:
|
||||
for file in bin_link[dir]:
|
||||
src = os.path.abspath(os.path.join(baseDir,dir,file))
|
||||
if (file == ''):
|
||||
sym_link = os.path.abspath(os.path.join(damaskEnv.binDir(),dir))
|
||||
else:
|
||||
sym_link = os.path.abspath(os.path.join(damaskEnv.binDir(),os.path.splitext(file)[0]))
|
||||
print sym_link,'-->',src
|
||||
if os.path.lexists(sym_link):
|
||||
os.remove(sym_link)
|
||||
if os.path.exists(src):
|
||||
sym_link = os.path.abspath(os.path.join(damaskEnv.binDir(),\
|
||||
{True: dir,
|
||||
False:os.path.splitext(file)[0]}[file == '']))
|
||||
if os.path.lexists(sym_link): os.remove(sym_link)
|
||||
os.symlink(src,sym_link)
|
||||
print sym_link,'-->',src
|
||||
|
|
Loading…
Reference in New Issue