Skip to content

Commit f9dcae3

Browse files
authored
Merge branch 'master' into interactive
2 parents 5a5e252 + c508adb commit f9dcae3

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
namespace_packages = ['sio', 'sio.compilers', 'sio.executors'],
1515

1616
install_requires = [
17-
'filetracker>=2.1.5,<3.0',
17+
'filetracker[server]>=2.2.0,<3.0',
1818
'bsddb3==6.2.7',
1919
'simplejson==3.14.0',
2020
'supervisor>=4.0,<4.3',
21-
'Twisted==20.3.0',
22-
'sortedcontainers==2.1.0',
21+
'Twisted==23.8.0',
22+
'sortedcontainers==2.4.0',
2323
'six',
2424
'urllib3>=1.26.14,<2.0',
2525
],

sio/executors/checker.py

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,12 @@ def execute_checker(with_stderr=False, stderr=None):
8787
return renv['stdout']
8888

8989

90-
def _run_compare(env):
91-
e = SandboxExecutor('exec-sandbox')
90+
def _run_compare(env, format):
91+
e = SandboxExecutor('oicompare-sandbox-v1.0.2')
9292
renv = _run_in_executor(
93-
env, [os.path.join('bin', 'compare'), 'hint', 'out'], e, ignore_errors=True
93+
env, [os.path.join('bin', 'oicompare'), 'hint', 'out', format], e, ignore_errors=True
9494
)
95-
return renv['stdout']
95+
return renv
9696

9797

9898
def _limit_length(s):
@@ -116,7 +116,21 @@ def run(environ, use_sandboxes=True):
116116

117117
output = _run_checker(environ, use_sandboxes)
118118
elif use_sandboxes:
119-
output = _run_compare(environ)
119+
renv = _run_compare(environ, environ.get('checker_format', 'english_abbreviated'))
120+
if renv['return_code'] == 0:
121+
environ['result_code'] = 'OK'
122+
environ['result_percentage'] = (100, 1)
123+
elif renv['return_code'] == 1:
124+
environ['result_code'] = 'WA'
125+
environ['result_percentage'] = (0, 1)
126+
# Should be redundant because we are using oicompare with abbreviated output,
127+
# but just in case.
128+
environ['result_string'] = _limit_length(renv['stdout'][0])
129+
else:
130+
raise CheckerError(
131+
'oicompare returned code(%d). Checker renv: %s' % (renv['return_code'], renv)
132+
)
133+
return environ
120134
else:
121135
output = _run_diff(environ)
122136
except (CheckerError, ExecError) as e:
@@ -155,4 +169,4 @@ def output_to_fraction(output_str):
155169
except ZeroDivisionError:
156170
raise CheckerError('Zero division in checker output "%s"' % output_str)
157171
except TypeError:
158-
raise CheckerError('Invalid checker output "%s"' % output_str)
172+
raise CheckerError('Invalid checker output "%s"' % output_str)

0 commit comments

Comments
 (0)