-
Notifications
You must be signed in to change notification settings - Fork 54
Expand file tree
/
Copy pathmake.py
More file actions
executable file
·34 lines (25 loc) · 762 Bytes
/
make.py
File metadata and controls
executable file
·34 lines (25 loc) · 762 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python3
""" PC-BASIC test creation
(c) 2020--2023 Rob Hagemans
This file is released under the GNU GPL version 3 or later.
"""
import sys
import os
import shutil
HERE = os.path.dirname(os.path.abspath(__file__))
TESTNAME = sys.argv[1]
if TESTNAME.endswith('/'):
TESTNAME = TESTNAME[:-1]
# e.g. basic/gwbasic/TestName
try:
DIR, TESTNAME = os.path.split(TESTNAME)
_, PRESET = os.path.split(DIR)
except ValueError:
PRESET = 'gwbasic'
PATH = os.path.join(HERE, 'basic', PRESET)
TEMPLATE = os.path.join(HERE, '_templates', PRESET)
if not os.path.isdir(TEMPLATE):
sys.exit('Test template {} not found.'.format(TEMPLATE))
if not os.path.isdir(PATH):
os.mkdir(PATH)
shutil.copytree(TEMPLATE, os.path.join(PATH, TESTNAME))