Store value of MSC_VERSION in variable of same name
This commit is contained in:
parent
fce116aa8b
commit
d89fad6135
|
@ -51,4 +51,4 @@ else
|
||||||
setenv PYTHONPATH $DAMASK_ROOT/python:$PYTHONPATH
|
setenv PYTHONPATH $DAMASK_ROOT/python:$PYTHONPATH
|
||||||
endif
|
endif
|
||||||
setenv MSC_ROOT
|
setenv MSC_ROOT
|
||||||
setenv MARC_VERSION
|
setenv MSC_VERSION
|
||||||
|
|
|
@ -7,15 +7,15 @@ from pathlib import Path
|
||||||
|
|
||||||
import damask
|
import damask
|
||||||
|
|
||||||
marc_version = float(damask.environment.options['MSC_VERSION'])
|
msc_version = float(damask.environment.options['MSC_VERSION'])
|
||||||
if int(marc_version) == marc_version:
|
if int(msc_version) == msc_version:
|
||||||
marc_version = int(marc_version)
|
msc_version = int(msc_version)
|
||||||
msc_root = Path(damask.environment.options['MSC_ROOT'])
|
msc_root = Path(damask.environment.options['MSC_ROOT'])
|
||||||
damask_root = damask.environment.root_dir
|
damask_root = damask.environment.root_dir
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description='Apply DAMASK modification to MSC.Marc/Mentat',
|
description='Apply DAMASK modification to MSC.Marc/Mentat',
|
||||||
epilog = f'MSC_ROOT={msc_root} and MSC_VERSION={marc_version} (from {damask_root}/env/CONFIG)')
|
epilog = f'MSC_ROOT={msc_root} and MSC_VERSION={msc_version} (from {damask_root}/env/CONFIG)')
|
||||||
parser.add_argument('--editor', dest='editor', metavar='string', default='vi',
|
parser.add_argument('--editor', dest='editor', metavar='string', default='vi',
|
||||||
help='Name of the editor for MSC.Mentat (executable)')
|
help='Name of the editor for MSC.Mentat (executable)')
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ def copy_and_replace(in_file,dst):
|
||||||
with open(in_file) as f:
|
with open(in_file) as f:
|
||||||
content = f.read()
|
content = f.read()
|
||||||
content = content.replace('%INSTALLDIR%',str(msc_root))
|
content = content.replace('%INSTALLDIR%',str(msc_root))
|
||||||
content = content.replace('%VERSION%',str(marc_version))
|
content = content.replace('%VERSION%',str(msc_version))
|
||||||
content = content.replace('%EDITOR%', parser.parse_args().editor)
|
content = content.replace('%EDITOR%', parser.parse_args().editor)
|
||||||
with open(dst/Path(in_file).name,'w') as f:
|
with open(dst/Path(in_file).name,'w') as f:
|
||||||
f.write(content)
|
f.write(content)
|
||||||
|
@ -32,36 +32,36 @@ def copy_and_replace(in_file,dst):
|
||||||
|
|
||||||
print('adapting Marc tools...\n')
|
print('adapting Marc tools...\n')
|
||||||
|
|
||||||
src = damask_root/f'installation/mods_MarcMentat/{marc_version}/Marc_tools'
|
src = damask_root/f'installation/mods_MarcMentat/{msc_version}/Marc_tools'
|
||||||
dst = msc_root/f'marc{marc_version}/tools'
|
dst = msc_root/f'marc{msc_version}/tools'
|
||||||
for in_file in glob.glob(str(src/'*damask*')) + [str(src/'include_linux64')]:
|
for in_file in glob.glob(str(src/'*damask*')) + [str(src/'include_linux64')]:
|
||||||
copy_and_replace(in_file,dst)
|
copy_and_replace(in_file,dst)
|
||||||
|
|
||||||
|
|
||||||
print('adapting Mentat scripts and menus...\n')
|
print('adapting Mentat scripts and menus...\n')
|
||||||
|
|
||||||
src = damask_root/f'installation/mods_MarcMentat/{marc_version}/Mentat_bin'
|
src = damask_root/f'installation/mods_MarcMentat/{msc_version}/Mentat_bin'
|
||||||
dst = msc_root/f'mentat{marc_version}/bin'
|
dst = msc_root/f'mentat{msc_version}/bin'
|
||||||
for in_file in glob.glob(str(src/'*[!.original]')):
|
for in_file in glob.glob(str(src/'*[!.original]')):
|
||||||
copy_and_replace(in_file,dst)
|
copy_and_replace(in_file,dst)
|
||||||
|
|
||||||
src = damask_root/f'installation/mods_MarcMentat/{marc_version}/Mentat_menus'
|
src = damask_root/f'installation/mods_MarcMentat/{msc_version}/Mentat_menus'
|
||||||
dst = msc_root/f'mentat{marc_version}/menus'
|
dst = msc_root/f'mentat{msc_version}/menus'
|
||||||
for in_file in glob.glob(str(src/'job_run.ms')):
|
for in_file in glob.glob(str(src/'job_run.ms')):
|
||||||
copy_and_replace(in_file,dst)
|
copy_and_replace(in_file,dst)
|
||||||
|
|
||||||
|
|
||||||
print('compiling Mentat menu binaries...')
|
print('compiling Mentat menu binaries...')
|
||||||
|
|
||||||
executable = str(msc_root/f'mentat{marc_version}/bin/mentat')
|
executable = str(msc_root/f'mentat{msc_version}/bin/mentat')
|
||||||
menu_file = str(msc_root/f'mentat{marc_version}/menus/linux64/main.msb')
|
menu_file = str(msc_root/f'mentat{msc_version}/menus/linux64/main.msb')
|
||||||
os.system(f'xvfb-run {executable} -compile {menu_file}')
|
os.system(f'xvfb-run {executable} -compile {menu_file}')
|
||||||
|
|
||||||
|
|
||||||
print('setting file access rights...\n')
|
print('setting file access rights...\n')
|
||||||
|
|
||||||
for pattern in [msc_root/f'marc{marc_version}/tools/*damask*',
|
for pattern in [msc_root/f'marc{msc_version}/tools/*damask*',
|
||||||
msc_root/f'mentat{marc_version}/bin/submit?',
|
msc_root/f'mentat{msc_version}/bin/submit?',
|
||||||
msc_root/f'mentat{marc_version}/bin/kill?']:
|
msc_root/f'mentat{msc_version}/bin/kill?']:
|
||||||
for f in glob.glob(str(pattern)):
|
for f in glob.glob(str(pattern)):
|
||||||
os.chmod(f,0o755)
|
os.chmod(f,0o755)
|
||||||
|
|
Loading…
Reference in New Issue