DAMASK_EICMD/installation/symlink_Processing.py

31 lines
706 B
Python
Executable File

#!/usr/bin/env python3
# Makes postprocessing routines accessible from everywhere.
import sys
from pathlib import Path
import damask
env = damask.Environment()
bin_dir = env.root_dir/Path('bin')
if not bin_dir.exists():
bin_dir.mkdir()
sys.stdout.write('\nsymbolic linking...\n')
for sub_dir in ['pre','post']:
the_dir = env.root_dir/Path('processing')/Path(sub_dir)
for the_file in the_dir.glob('*.py'):
src = the_dir/the_file
dst = bin_dir/Path(the_file.with_suffix('').name)
dst.unlink(True)
dst.symlink_to(src)
sys.stdout.write('\npruning broken links...\n')
for filename in bin_dir.glob('*'):
if not filename.is_file():
filename.unlink