rbx.cp 0.5.1__py3-none-any.whl → 0.5.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rbx/box/main.py +3 -0
- rbx/box/packaging/boca/extension.py +3 -3
- rbx/box/packaging/boca/packager.py +41 -5
- rbx/resources/packagers/boca/checker.sh +2 -2
- {rbx_cp-0.5.1.dist-info → rbx_cp-0.5.2.dist-info}/METADATA +1 -1
- {rbx_cp-0.5.1.dist-info → rbx_cp-0.5.2.dist-info}/RECORD +9 -9
- {rbx_cp-0.5.1.dist-info → rbx_cp-0.5.2.dist-info}/LICENSE +0 -0
- {rbx_cp-0.5.1.dist-info → rbx_cp-0.5.2.dist-info}/WHEEL +0 -0
- {rbx_cp-0.5.1.dist-info → rbx_cp-0.5.2.dist-info}/entry_points.txt +0 -0
rbx/box/main.py
CHANGED
@@ -363,6 +363,9 @@ def environment_command(
|
|
363
363
|
if env is None:
|
364
364
|
cfg = config.get_config()
|
365
365
|
console.console.print(f'Current environment: [item]{cfg.boxEnvironment}[/item]')
|
366
|
+
console.console.print(
|
367
|
+
f'Location: {environment.get_environment_path(cfg.boxEnvironment)}'
|
368
|
+
)
|
366
369
|
return
|
367
370
|
if install_from is not None:
|
368
371
|
environment.install_environment(env, pathlib.Path(install_from))
|
@@ -14,9 +14,9 @@ class BocaExtension(BaseModel):
|
|
14
14
|
|
15
15
|
def flags_with_defaults(self) -> typing.Dict[BocaLanguage, str]:
|
16
16
|
res: typing.Dict[BocaLanguage, str] = {
|
17
|
-
'c': '-std=gnu11 -O2 -
|
18
|
-
'cpp': '-O2 -
|
19
|
-
'cc': '-std=c++20 -O2 -
|
17
|
+
'c': '-std=gnu11 -O2 -lm -static',
|
18
|
+
'cpp': '-O2 -lm -static',
|
19
|
+
'cc': '-std=c++20 -O2 -lm -static',
|
20
20
|
}
|
21
21
|
res.update(self.flags)
|
22
22
|
return res
|
@@ -48,13 +48,13 @@ class BocaPackager(BasePackager):
|
|
48
48
|
|
49
49
|
def _get_problem_name(self) -> str:
|
50
50
|
pkg = package.find_problem_package_or_die()
|
51
|
-
|
51
|
+
# BOCA forces Java class names to be the name of the problem.
|
52
|
+
return pkg.name.replace('-', '_')
|
52
53
|
|
53
54
|
def _get_problem_info(self) -> str:
|
54
|
-
pkg = package.find_problem_package_or_die()
|
55
55
|
statement = self._get_main_statement()
|
56
56
|
return (
|
57
|
-
f'basename={
|
57
|
+
f'basename={self._get_problem_name()}\n'
|
58
58
|
f'fullname={statement.title}\n'
|
59
59
|
f'descfile={self._get_problem_name()}.pdf\n'
|
60
60
|
)
|
@@ -128,6 +128,8 @@ class BocaPackager(BasePackager):
|
|
128
128
|
return compare_path.read_text()
|
129
129
|
|
130
130
|
def _get_checker(self) -> str:
|
131
|
+
extension = get_extension_or_default('boca', BocaExtension)
|
132
|
+
|
131
133
|
checker_path = get_default_app_path() / 'packagers' / 'boca' / 'checker.sh'
|
132
134
|
if not checker_path.exists():
|
133
135
|
console.console.print(
|
@@ -137,8 +139,10 @@ class BocaPackager(BasePackager):
|
|
137
139
|
checker_text = checker_path.read_text()
|
138
140
|
testlib = get_testlib().read_text()
|
139
141
|
checker = package.get_checker().path.read_text()
|
140
|
-
return
|
141
|
-
'{{
|
142
|
+
return (
|
143
|
+
checker_text.replace('{{rbxFlags}}', extension.flags_with_defaults()['cc'])
|
144
|
+
.replace('{{testlib_content}}', testlib)
|
145
|
+
.replace('{{checker_content}}', checker)
|
142
146
|
)
|
143
147
|
|
144
148
|
def _get_compile(self, language: BocaLanguage) -> str:
|
@@ -165,6 +169,33 @@ class BocaPackager(BasePackager):
|
|
165
169
|
compile_text = compile_text.replace('{{rbxFlags}}', flags[language])
|
166
170
|
return compile_text
|
167
171
|
|
172
|
+
def _copy_solutions(self, into_path: pathlib.Path):
|
173
|
+
for solution in package.get_solutions():
|
174
|
+
dest_path = (
|
175
|
+
into_path
|
176
|
+
/ solution.path.stem
|
177
|
+
/ pathlib.Path(self._get_problem_name()).with_suffix(
|
178
|
+
solution.path.suffix
|
179
|
+
)
|
180
|
+
)
|
181
|
+
dest_path.parent.mkdir(parents=True, exist_ok=True)
|
182
|
+
shutil.copy(str(solution.path), dest_path)
|
183
|
+
|
184
|
+
if solution.path.suffix == '.java':
|
185
|
+
java_content = dest_path.read_text()
|
186
|
+
if (
|
187
|
+
'class Main ' not in java_content
|
188
|
+
and f'class {self._get_problem_name()} ' not in java_content
|
189
|
+
):
|
190
|
+
console.console.print(
|
191
|
+
'[error]For BOCA packaging, Java solutions must be named `class Main` or `class <ProblemName>`.[/error]'
|
192
|
+
)
|
193
|
+
dest_path.write_text(
|
194
|
+
java_content.replace(
|
195
|
+
'class Main ', f'class {self._get_problem_name()} '
|
196
|
+
)
|
197
|
+
)
|
198
|
+
|
168
199
|
def name(self) -> str:
|
169
200
|
return 'boca'
|
170
201
|
|
@@ -223,6 +254,11 @@ class BocaPackager(BasePackager):
|
|
223
254
|
(description_path / self._get_problem_name()).with_suffix('.pdf'),
|
224
255
|
)
|
225
256
|
|
257
|
+
# Copy solutions
|
258
|
+
solutions_path = into_path / 'solutions'
|
259
|
+
solutions_path.mkdir(parents=True, exist_ok=True)
|
260
|
+
self._copy_solutions(solutions_path)
|
261
|
+
|
226
262
|
# Prepare IO
|
227
263
|
inputs_path = into_path / 'input'
|
228
264
|
inputs_path.mkdir(parents=True, exist_ok=True)
|
@@ -29,7 +29,7 @@ if [ -f "$checker_cache" ]; then
|
|
29
29
|
cp "$checker_cache" $CHECKER_OUT -f
|
30
30
|
else
|
31
31
|
echo "Compiling polygon checker: $CHECKER_PATH"
|
32
|
-
$cc {{
|
32
|
+
$cc {{rbxFlags}} $CHECKER_PATH -o $CHECKER_OUT
|
33
33
|
|
34
34
|
if [ $? -ne 0 ]; then
|
35
35
|
echo "Checker could not be compiled"
|
@@ -40,4 +40,4 @@ else
|
|
40
40
|
fi
|
41
41
|
|
42
42
|
chmod 0755 $CHECKER_OUT
|
43
|
-
### END OF CHECKER COMPILATION
|
43
|
+
### END OF CHECKER COMPILATION
|
@@ -21,10 +21,10 @@ rbx/box/environment.py,sha256=HiufDkaXJeZk9gWvt27UMmyzaknnODu8flGerrwnNhE,10851
|
|
21
21
|
rbx/box/extensions.py,sha256=p0iLaU28KswOBDX2HGVO_dR2gk-JSAWb6sXC6GZ1d0w,738
|
22
22
|
rbx/box/generators.py,sha256=UJNyvwbY4JBVpmdMoVsYi16O3oodMgguH_dmZAoOFm4,16104
|
23
23
|
rbx/box/generators_test.py,sha256=mQqHepAMYa6zV_PseQALI0nIX6AdQktt6lh94muFhNw,1758
|
24
|
-
rbx/box/main.py,sha256=
|
24
|
+
rbx/box/main.py,sha256=pGw9D3iBD9CgaDbJXxMAwWOHf27SH7nE3jPzYSWpnnY,13513
|
25
25
|
rbx/box/package.py,sha256=8JqavlW6cF_TtflrNLdd39P6iecFVTxTDNRP_mQ8jP8,10067
|
26
|
-
rbx/box/packaging/boca/extension.py,sha256=
|
27
|
-
rbx/box/packaging/boca/packager.py,sha256=
|
26
|
+
rbx/box/packaging/boca/extension.py,sha256=hQhcbocNfW2ESv5RalS1wf6uvOoOfOnR_gHvbXUbSzY,852
|
27
|
+
rbx/box/packaging/boca/packager.py,sha256=FOhSRg5K5Y4qNB0WyTR3DKgrpObf9I0JbyGpJHOtxpo,10673
|
28
28
|
rbx/box/packaging/contest_main.py,sha256=ypiBS8dd0yCqoFJIqiK1Fo02dQmUB_G-Z7G926jomrk,2746
|
29
29
|
rbx/box/packaging/main.py,sha256=CyjfuvwmRsJGk4lKVp2LT_WCQ5jZ5L_7NfZQEC40nuY,2228
|
30
30
|
rbx/box/packaging/packager.py,sha256=suCT_SLnWa915rV2j8VFqzH43HGKRTr9mGGlrvj45aw,3267
|
@@ -92,7 +92,7 @@ rbx/resources/checkers/boilerplate.cpp,sha256=vj1Qjy59JKEzb4ZpaX_MkL1FaZn_tTLZXj
|
|
92
92
|
rbx/resources/default_config.json,sha256=8GZVHns4nci0-e5ALk9C1lfO6TO9W2ZlmZtxHkL6ibA,949
|
93
93
|
rbx/resources/envs/default.rbx.yml,sha256=8gl4DXc5mVISx__1libPQfmuHYdW32xjysfqpNESIAo,853
|
94
94
|
rbx/resources/envs/isolate.rbx.yml,sha256=VZAJ-Mu-A5Rt4m0VtMygOXA7eLLvCCmoorv_0acDmXQ,870
|
95
|
-
rbx/resources/packagers/boca/checker.sh,sha256=
|
95
|
+
rbx/resources/packagers/boca/checker.sh,sha256=c7EBnKZXJKNDv_HxBv62Jt2bLV-GIOJ8FgxJisMJ1Ys,1033
|
96
96
|
rbx/resources/packagers/boca/compare,sha256=2c7PR_loHNgRm-kszK7NQWvRb5hutXoqdj4HMmq7mbw,1849
|
97
97
|
rbx/resources/packagers/boca/compile/c,sha256=lHLvxzkG_he5jmxWrix0WT80ipMWWUZdOgOQMSpj8oo,4507
|
98
98
|
rbx/resources/packagers/boca/compile/cc,sha256=B_18QkUGcjUg6yrTFlTQuMWnHpTWUKPZmFuk7Y0l1VA,4561
|
@@ -157,8 +157,8 @@ rbx/testdata/caching/executable.py,sha256=WKRHNf_fprFJd1Fq1ubmQtR3mZzTYVNwKPLWuZ
|
|
157
157
|
rbx/testdata/compatible,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
158
158
|
rbx/testing_utils.py,sha256=ZZLKMUHlZ4HwsuNY50jqSBJ9HhpnFdba7opjDsvXE1U,2084
|
159
159
|
rbx/utils.py,sha256=OkOLjNG8Pq7y2ylqhXQyAOVDfUsva_4Mfjd8OmII55E,4145
|
160
|
-
rbx_cp-0.5.
|
161
|
-
rbx_cp-0.5.
|
162
|
-
rbx_cp-0.5.
|
163
|
-
rbx_cp-0.5.
|
164
|
-
rbx_cp-0.5.
|
160
|
+
rbx_cp-0.5.2.dist-info/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
|
161
|
+
rbx_cp-0.5.2.dist-info/METADATA,sha256=fiqGkYBfzJBTozxW_9jKubvmcVyVioblqa4iREtVUVI,3253
|
162
|
+
rbx_cp-0.5.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
163
|
+
rbx_cp-0.5.2.dist-info/entry_points.txt,sha256=qBTLBOeifT1F00LWaEewRRE_jQPgvH7BUdJfZ-dYsFU,57
|
164
|
+
rbx_cp-0.5.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|