polishing/fixing
This commit is contained in:
parent
5720a19bed
commit
6d1ec392c0
|
@ -13,9 +13,11 @@ def copy_and_patch(patch,orig,msc_root,editor):
|
|||
shutil.copyfile(orig,orig.parent/patch.stem)
|
||||
except shutil.SameFileError:
|
||||
pass
|
||||
damask.execute(f'patch {orig.parent/patch.stem} {patch} -b}')
|
||||
with open(orig.parent/patch.stem) as f_in, open(orig.parent/patch.stem,'w') as f_out:
|
||||
f_out.write(f_in.read().replace('%INSTALLDIR%',msc_root).replace('%EDITOR%',editor))
|
||||
damask.execute(f'patch {orig.parent/patch.stem} {patch} -b')
|
||||
with open(orig.parent/patch.stem) as f_in:
|
||||
content = f_in.read()
|
||||
with open(orig.parent/patch.stem,'w') as f_out:
|
||||
f_out.write(content.replace('%INSTALLDIR%',msc_root).replace('%EDITOR%',editor))
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
|
@ -38,7 +40,8 @@ parser.add_argument('--damask-root', dest='damask_root', metavar = 'string',
|
|||
args = parser.parse_args()
|
||||
msc_root = Path(args.msc_root).expanduser()
|
||||
damask_root = Path(args.damask_root).expanduser()
|
||||
msc_version = int(args.msc_version) if str(args.msc_version).split('.')[1] == '0' else args.msc_version
|
||||
msc_version = int(args.msc_version) if str(args.msc_version).split('.')[1] == '0' else \
|
||||
args.msc_version
|
||||
|
||||
matches = {'Marc_tools': [['comp_user','comp_damask_*mp'],
|
||||
['run_marc','run_damask_*mp'],
|
||||
|
@ -53,10 +56,10 @@ print('patching files...\n')
|
|||
|
||||
for directory in glob.glob(str(damask_root/f'install/MarcMentat/{msc_version}/*')):
|
||||
for orig, mods in matches[Path(directory).name]:
|
||||
dirs = (msc_root/Path(directory)).name.lower().split('_')
|
||||
orig = msc_root/f'{dirs[0]}{msc_version}/{dirs[1]}/{orig}'
|
||||
product,subfolder = (msc_root/Path(directory)).name.split('_')
|
||||
orig = msc_root/f'{product.lower()}{msc_version}/{subfolder}/{orig}'
|
||||
for patch in glob.glob(f'{directory}/{mods}.patch'):
|
||||
copy_and_patch(Path(patch),orig,msc_root,editor)
|
||||
copy_and_patch(Path(patch),orig,msc_root,args.editor)
|
||||
|
||||
print('compiling Mentat menu binaries...')
|
||||
|
||||
|
|
Loading…
Reference in New Issue