|
|
@ -33,7 +33,7 @@ if args.test_dir is not None:
|
|
|
|
|
|
|
|
|
|
|
|
MAX_TRIES = 5
|
|
|
|
MAX_TRIES = 5
|
|
|
|
|
|
|
|
|
|
|
|
dfhack = 'Dwarf Fortress.exe' if sys.platform == 'win32' else './dfhack'
|
|
|
|
dfhack = 'Dwarf Fortress.exe' if sys.platform == 'win32' else './dwarfort'
|
|
|
|
test_status_file = 'test_status.json'
|
|
|
|
test_status_file = 'test_status.json'
|
|
|
|
|
|
|
|
|
|
|
|
class TestStatus(enum.Enum):
|
|
|
|
class TestStatus(enum.Enum):
|
|
|
@ -59,14 +59,9 @@ default_init_txt_path = 'data/init/init_default.txt'
|
|
|
|
prefs_path = 'prefs'
|
|
|
|
prefs_path = 'prefs'
|
|
|
|
init_txt_path = 'prefs/init.txt'
|
|
|
|
init_txt_path = 'prefs/init.txt'
|
|
|
|
if not os.path.exists(init_txt_path):
|
|
|
|
if not os.path.exists(init_txt_path):
|
|
|
|
try:
|
|
|
|
os.makedirs(prefs_path, exist_ok=True)
|
|
|
|
os.mkdir(prefs_path)
|
|
|
|
|
|
|
|
except OSError as error:
|
|
|
|
|
|
|
|
# ignore already exists errors
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
shutil.copyfile(default_init_txt_path, init_txt_path)
|
|
|
|
shutil.copyfile(default_init_txt_path, init_txt_path)
|
|
|
|
|
|
|
|
|
|
|
|
print('Backing up init.txt to init.txt.orig')
|
|
|
|
|
|
|
|
shutil.copyfile(init_txt_path, init_txt_path + '.orig')
|
|
|
|
shutil.copyfile(init_txt_path, init_txt_path + '.orig')
|
|
|
|
with open(init_txt_path) as f:
|
|
|
|
with open(init_txt_path) as f:
|
|
|
|
init_contents = f.read()
|
|
|
|
init_contents = f.read()
|
|
|
@ -83,11 +78,7 @@ init_path = 'dfhack-config/init'
|
|
|
|
if not os.path.isdir('hack/init'):
|
|
|
|
if not os.path.isdir('hack/init'):
|
|
|
|
# we're on an old branch that still reads init files from the root dir
|
|
|
|
# we're on an old branch that still reads init files from the root dir
|
|
|
|
init_path = '.'
|
|
|
|
init_path = '.'
|
|
|
|
try:
|
|
|
|
os.makedirs(init_path, exist_ok=True)
|
|
|
|
os.mkdir(init_path)
|
|
|
|
|
|
|
|
except OSError as error:
|
|
|
|
|
|
|
|
# ignore already exists errors
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
test_init_file = os.path.join(init_path, 'dfhackzzz_test.init') # Core sorts these alphabetically
|
|
|
|
test_init_file = os.path.join(init_path, 'dfhackzzz_test.init') # Core sorts these alphabetically
|
|
|
|
with open(test_init_file, 'w') as f:
|
|
|
|
with open(test_init_file, 'w') as f:
|
|
|
|
f.write('''
|
|
|
|
f.write('''
|
|
|
|