Skip to content

Commit d44623b

Browse files
committed
Fix some problems
1 parent e33efba commit d44623b

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/sinol_make/__init__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,19 @@ def main_exn():
5959
except Exception as err:
6060
util.exit_with_error('`oiejq` could not be installed.\n' + err)
6161

62-
command.run(args)
63-
exit(0)
62+
command.run(args)
63+
exit(0)
6464

6565
parser.print_help()
6666

6767

6868
def main():
6969
try:
7070
main_exn()
71+
except argparse.ArgumentError as err:
72+
util.exit_with_error(err)
73+
except SystemExit as err:
74+
exit(err.code)
7175
except:
7276
print(traceback.format_exc())
7377
util.exit_with_error('An error occurred while running the command.\n'

src/sinol_make/helpers/compile.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,15 @@ def compile_file(file_path: str, name: str, compilers: Compilers, weak_compilati
101101

102102
extra_compilation_files = [os.path.join(os.getcwd(), "prog", file)
103103
for file in config.get("extra_compilation_files", [])]
104-
extra_compilation_args = config.get('extra_compilation_args', {}).get(os.path.splitext(name)[1], [])
104+
extra_compilation_args = [os.path.join(os.getcwd(), "prog", file)
105+
for file in config.get('extra_compilation_args', {}).get(os.path.splitext(file_path)[1][1:], [])]
105106

106107
output = os.path.join(executable_dir, name)
107108
compile_log_path = os.path.join(compile_log_dir, os.path.splitext(name)[0] + '.compile_log')
108109
with open(compile_log_path, 'w') as compile_log:
109110
try:
110-
if compile(file_path, output, compilers, compile_log, weak_compilation_flags, extra_compilation_files,
111-
extra_compilation_args):
111+
if compile(file_path, output, compilers, compile_log, weak_compilation_flags, extra_compilation_args,
112+
extra_compilation_files):
112113
return output, compile_log_path
113114
except CompilationError:
114115
pass

0 commit comments

Comments
 (0)