2018-11-17 12:42:12 +05:30
|
|
|
#!/usr/bin/env python3
|
2014-01-11 18:16:30 +05:30
|
|
|
|
2019-09-04 04:11:41 +05:30
|
|
|
# Makes postprocessing routines accessible from everywhere.
|
|
|
|
import sys
|
2020-06-03 17:02:47 +05:30
|
|
|
from pathlib import Path
|
2019-09-04 04:11:41 +05:30
|
|
|
|
2016-07-14 18:39:25 +05:30
|
|
|
import damask
|
2014-01-11 18:16:30 +05:30
|
|
|
|
2020-06-03 17:02:47 +05:30
|
|
|
env = damask.Environment()
|
|
|
|
bin_dir = env.root_dir/Path('bin')
|
2014-02-28 13:17:11 +05:30
|
|
|
|
2020-06-03 17:02:47 +05:30
|
|
|
if not bin_dir.exists():
|
|
|
|
bin_dir.mkdir()
|
2014-01-11 18:16:30 +05:30
|
|
|
|
2016-08-25 21:38:19 +05:30
|
|
|
|
|
|
|
sys.stdout.write('\nsymbolic linking...\n')
|
2020-06-03 17:02:47 +05:30
|
|
|
for sub_dir in ['pre','post']:
|
|
|
|
the_dir = env.root_dir/Path('processing')/Path(sub_dir)
|
2016-08-25 21:38:19 +05:30
|
|
|
|
2020-06-03 17:02:47 +05:30
|
|
|
for the_file in the_dir.glob('*.py'):
|
|
|
|
src = the_dir/the_file
|
|
|
|
dst = bin_dir/Path(the_file.with_suffix('').name)
|
2020-06-03 17:33:39 +05:30
|
|
|
if dst.is_file(): dst.unlink() # dst.unlink(True) for Python >3.8
|
2020-06-03 17:02:47 +05:30
|
|
|
dst.symlink_to(src)
|
2016-08-25 21:38:19 +05:30
|
|
|
|
|
|
|
|
|
|
|
sys.stdout.write('\npruning broken links...\n')
|
2020-06-03 17:02:47 +05:30
|
|
|
for filename in bin_dir.glob('*'):
|
|
|
|
if not filename.is_file():
|
|
|
|
filename.unlink
|