Skip to content

Commit 7ecf1c3

Browse files
authored
Fix running OI's ingen.sh in export (#176)
* Fix running OI's ingen.sh in export * Fix typo * Bump version for release
1 parent 9e04151 commit 7ecf1c3

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

src/sinol_make/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from sinol_make import util, oiejq
1010

1111

12-
__version__ = "1.5.19"
12+
__version__ = "1.5.20"
1313

1414

1515
def configure_parsers():

src/sinol_make/commands/export/__init__.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,22 @@ def get_generated_tests(self):
3535
if not ingen_exists(self.task_id):
3636
return []
3737

38-
working_dir = paths.get_cache_path('export', 'tests')
39-
if os.path.exists(working_dir):
40-
shutil.rmtree(working_dir)
41-
os.makedirs(working_dir)
38+
temp_package = paths.get_cache_path('export', 'tests')
39+
if os.path.exists(temp_package):
40+
shutil.rmtree(temp_package)
41+
os.makedirs(temp_package)
42+
in_dir = os.path.join(temp_package, 'in')
43+
prog_dir = os.path.join(temp_package, 'prog')
44+
os.makedirs(in_dir)
45+
shutil.copytree(os.path.join(os.getcwd(), 'prog'), prog_dir)
4246

4347
ingen_path = get_ingen(self.task_id)
48+
ingen_path = os.path.join(prog_dir, os.path.basename(ingen_path))
4449
ingen_exe = compile_ingen(ingen_path, self.args, self.args.weak_compilation_flags)
45-
if not run_ingen(ingen_exe, working_dir):
50+
if not run_ingen(ingen_exe, in_dir):
4651
util.exit_with_error('Failed to run ingen.')
4752

48-
tests = glob.glob(os.path.join(working_dir, f'{self.task_id}*.in'))
53+
tests = glob.glob(os.path.join(in_dir, f'{self.task_id}*.in'))
4954
return [package_util.extract_test_id(test, self.task_id) for test in tests]
5055

5156
def copy_package_required_files(self, target_dir: str):
@@ -85,7 +90,7 @@ def copy_package_required_files(self, target_dir: str):
8590
if len(tests_to_copy) > 0:
8691
print(util.warning(f'Found {len(tests_to_copy)} tests that are not generated by ingen.'))
8792
for test in tests_to_copy:
88-
print(util.warning(f'Coping {os.path.basename(test[1])}...'))
93+
print(util.warning(f'Copying {os.path.basename(test[1])}...'))
8994
shutil.copy(test[1], os.path.join(target_dir, test[0], os.path.basename(test[1])))
9095

9196
def clear_files(self, target_dir: str):

0 commit comments

Comments
 (0)