summaryrefslogtreecommitdiff
path: root/test cases/common/56 install script/myinstall.py
diff options
context:
space:
mode:
Diffstat (limited to 'test cases/common/56 install script/myinstall.py')
-rw-r--r--test cases/common/56 install script/myinstall.py29
1 files changed, 24 insertions, 5 deletions
diff --git a/test cases/common/56 install script/myinstall.py b/test cases/common/56 install script/myinstall.py
index 812561e0e..a57334242 100644
--- a/test cases/common/56 install script/myinstall.py
+++ b/test cases/common/56 install script/myinstall.py
@@ -1,12 +1,31 @@
#!/usr/bin/env python3
+import argparse
import os
-import sys
+import shutil
prefix = os.environ['MESON_INSTALL_DESTDIR_PREFIX']
-dirname = os.path.join(prefix, sys.argv[1])
-os.makedirs(dirname)
-with open(os.path.join(dirname, sys.argv[2]), 'w') as f:
- f.write('')
+def main() -> None:
+ parser = argparse.ArgumentParser()
+ parser.add_argument('dirname')
+ parser.add_argument('files', nargs='+')
+ parser.add_argument('--mode', action='store', default='create', choices=['create', 'copy'])
+ args = parser.parse_args()
+
+ dirname = os.path.join(prefix, args.dirname)
+ if not os.path.exists(dirname):
+ os.makedirs(dirname)
+
+ if args.mode == 'create':
+ for name in args.files:
+ with open(os.path.join(dirname, name), 'w') as f:
+ f.write('')
+ else:
+ for name in args.files:
+ shutil.copy(name, dirname)
+
+
+if __name__ == "__main__":
+ main()