Skip to content

Commit

Permalink
Fix running OI's ingen.sh in export (#176)
Browse files Browse the repository at this point in the history
* Fix running OI's ingen.sh in export

* Fix typo

* Bump version for release
  • Loading branch information
MasloMaslane authored Jan 29, 2024
1 parent 9e04151 commit 7ecf1c3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/sinol_make/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from sinol_make import util, oiejq


__version__ = "1.5.19"
__version__ = "1.5.20"


def configure_parsers():
Expand Down
19 changes: 12 additions & 7 deletions src/sinol_make/commands/export/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,22 @@ def get_generated_tests(self):
if not ingen_exists(self.task_id):
return []

working_dir = paths.get_cache_path('export', 'tests')
if os.path.exists(working_dir):
shutil.rmtree(working_dir)
os.makedirs(working_dir)
temp_package = paths.get_cache_path('export', 'tests')
if os.path.exists(temp_package):
shutil.rmtree(temp_package)
os.makedirs(temp_package)
in_dir = os.path.join(temp_package, 'in')
prog_dir = os.path.join(temp_package, 'prog')
os.makedirs(in_dir)
shutil.copytree(os.path.join(os.getcwd(), 'prog'), prog_dir)

ingen_path = get_ingen(self.task_id)
ingen_path = os.path.join(prog_dir, os.path.basename(ingen_path))
ingen_exe = compile_ingen(ingen_path, self.args, self.args.weak_compilation_flags)
if not run_ingen(ingen_exe, working_dir):
if not run_ingen(ingen_exe, in_dir):
util.exit_with_error('Failed to run ingen.')

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

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

def clear_files(self, target_dir: str):
Expand Down

0 comments on commit 7ecf1c3

Please sign in to comment.