rbx.cp 0.11.1__py3-none-any.whl → 0.11.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.
@@ -1,5 +1,6 @@
1
1
  import dataclasses
2
2
  import pathlib
3
+ import subprocess
3
4
  import tempfile
4
5
  import typing
5
6
  from typing import Any, Dict, List, Optional, Tuple
@@ -211,8 +212,12 @@ def build_contest_only(
211
212
  input_type: StatementType,
212
213
  output_type: Optional[StatementType] = None,
213
214
  custom_vars: Optional[Dict[str, Any]] = None,
215
+ install_tex: bool = False,
214
216
  ) -> Tuple[bytes, StatementType]:
215
217
  console.console.print('Building contest-level statement.')
218
+ if install_tex:
219
+ output_type = StatementType.TeX
220
+
216
221
  bdrs = get_builders(
217
222
  contest.name,
218
223
  statement.steps,
@@ -243,6 +248,15 @@ def build_contest_only(
243
248
  item=get_statement_builder_contest(statement, extracted_problems),
244
249
  verbose=False,
245
250
  )
251
+
252
+ if install_tex and bdr.output_type() == StatementType.TeX:
253
+ console.console.log(
254
+ f'Installing LaTeX packages for [item]{statement.name} {statement.language}[/item]...'
255
+ )
256
+ subprocess.run(
257
+ ['texliveonfly', output],
258
+ cwd=td,
259
+ )
246
260
  last_content = output
247
261
  last_output = bdr.output_type()
248
262
 
@@ -256,6 +270,7 @@ def build_statement_rooted(
256
270
  output_type: Optional[StatementType] = None,
257
271
  use_samples: bool = True,
258
272
  custom_vars: Optional[Dict[str, Any]] = None,
273
+ install_tex: bool = False,
259
274
  ) -> Tuple[bytes, StatementType]:
260
275
  # Validate.
261
276
  if not statement.path.is_file():
@@ -290,9 +305,10 @@ def build_statement_rooted(
290
305
  statement.type,
291
306
  output_type=joiner.joined_type() if joiner is not None else output_type,
292
307
  custom_vars=custom_vars,
308
+ install_tex=install_tex,
293
309
  )
294
310
 
295
- if joiner is None or joiner.joined_type() == output_type:
311
+ if joiner is None or install_tex:
296
312
  return last_content, last_output
297
313
  assert statement.joiner is not None
298
314
 
@@ -335,6 +351,7 @@ def build_statement(
335
351
  output_type: Optional[StatementType] = None,
336
352
  use_samples: bool = True,
337
353
  custom_vars: Optional[Dict[str, Any]] = None,
354
+ install_tex: bool = False,
338
355
  ) -> pathlib.Path:
339
356
  with tempfile.TemporaryDirectory() as td:
340
357
  root = pathlib.Path(td)
@@ -345,6 +362,7 @@ def build_statement(
345
362
  output_type=output_type,
346
363
  use_samples=use_samples,
347
364
  custom_vars=custom_vars,
365
+ install_tex=install_tex,
348
366
  )
349
367
 
350
368
  statement_path = (pathlib.Path('build') / statement.name).with_suffix(
@@ -1,4 +1,3 @@
1
- import subprocess
2
1
  from typing import Annotated, List, Optional
3
2
 
4
3
  import syncer
@@ -102,9 +101,6 @@ async def build(
102
101
 
103
102
  built_statements = []
104
103
 
105
- if install_tex:
106
- output = StatementType.TeX
107
-
108
104
  for statement in valid_statements:
109
105
  built_statements.append(
110
106
  build_statement(
@@ -112,23 +108,13 @@ async def build(
112
108
  contest,
113
109
  output_type=output,
114
110
  use_samples=samples,
111
+ install_tex=install_tex,
115
112
  custom_vars=expand_any_vars(annotations.parse_dictionary_items(vars)),
116
113
  )
117
114
  )
118
115
 
119
116
  console.console.rule(title='Built statements')
120
117
  for statement, built_path in zip(valid_statements, built_statements):
121
- if install_tex:
122
- subprocess.run(
123
- [
124
- 'texliveonfly',
125
- built_path,
126
- ]
127
- )
128
- console.console.log(
129
- f'Installing LaTeX packages for [item]{statement.name} {statement.language}[/item]...'
130
- )
131
- continue
132
118
  console.console.print(
133
119
  f'[item]{statement.name} {statement.language}[/item] -> {href(built_path)}'
134
120
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: rbx.cp
3
- Version: 0.11.1
3
+ Version: 0.11.2
4
4
  Summary:
5
5
  Author: Roberto Sales
6
6
  Requires-Python: >=3.9.1,<4.0.0
@@ -10,12 +10,12 @@ rbx/box/code.py,sha256=4GChCeUaHjT7stvtPAURbCL1_V238geG3xmXQjbdV20,26708
10
10
  rbx/box/compile.py,sha256=Kzn5mEQu4vb91W9vjyt0DS6cfPJzFLTUoowFj7uHLUo,2539
11
11
  rbx/box/conftest.py,sha256=sEmciXSeDC-wmrZ1JSxbsUenKNP_VWW32mrCun2pY3I,1070
12
12
  rbx/box/contest/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
- rbx/box/contest/build_contest_statements.py,sha256=6HMxbQW4eNgOG1EyR70_OHCoQu4eO2pejRna_mIldOA,12067
13
+ rbx/box/contest/build_contest_statements.py,sha256=pNNYmQUNasFaAxfTLITnTeb_TNobjhtIBsxyG7QOWn4,12643
14
14
  rbx/box/contest/contest_package.py,sha256=r6BGq3S4Ezj3Ep7pCmtvz3SN44npb2_rKJEoT5lSOqk,2985
15
15
  rbx/box/contest/contest_utils.py,sha256=fsWHG1e65wq9zvRY3tdf32VF0nU1yzGTOBX5yjXiNk4,1102
16
16
  rbx/box/contest/main.py,sha256=e_DjbrwpXTFZQaVWJO7prJyehJ702GkVEAGEraRK6h4,8352
17
17
  rbx/box/contest/schema.py,sha256=eb7xtyq078YYWYHueximNhyHFINzwgLMFm1j9U3LxBQ,7461
18
- rbx/box/contest/statements.py,sha256=f59R42lkJKaDEo2us4Pr8JjS1MjsZcRz59J9YCqKgjI,4348
18
+ rbx/box/contest/statements.py,sha256=g_h4upUrfG9pIuNa2vBYmpLk6H1BhcCpyKRv7zav60M,3974
19
19
  rbx/box/creation.py,sha256=oTAC11XV2Pw2YAlF_d11Eo7A1fD6ItlpFMpLEzMLyFI,1331
20
20
  rbx/box/deferred.py,sha256=II3X9e87JCOZtmspnHh-n4PFqh-FsH_oc0XJHZ9ZYVQ,691
21
21
  rbx/box/download.py,sha256=tLW5gLVeLk0gHMEMwScSoHIXQPkXuPsqXzItsrsnUZY,3070
@@ -239,8 +239,8 @@ rbx/testcase.py,sha256=yKOq3CAJZ1YTmInvnoIs0u1iJnRj_X85XiWbLI-p9d8,1951
239
239
  rbx/testcase_rendering.py,sha256=nfmv6dSEqd4aR3TsaODwkKGK6AXty_DDKtWf_ejiQpI,2084
240
240
  rbx/testing_utils.py,sha256=x_PqD8Zd2PkN91NxVHUnSTs044-1WK5KKtttKQBXpFs,2083
241
241
  rbx/utils.py,sha256=YvN0q1vaLR9HxUfXKOTx1iN6Bp_fI8YNTQiJ8TNq7eM,4957
242
- rbx_cp-0.11.1.dist-info/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
243
- rbx_cp-0.11.1.dist-info/METADATA,sha256=YmZuDy7cF4FzvwoG-dgOa3ekrh0qxkbNdkUU8ei0Prg,4625
244
- rbx_cp-0.11.1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
245
- rbx_cp-0.11.1.dist-info/entry_points.txt,sha256=qBTLBOeifT1F00LWaEewRRE_jQPgvH7BUdJfZ-dYsFU,57
246
- rbx_cp-0.11.1.dist-info/RECORD,,
242
+ rbx_cp-0.11.2.dist-info/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
243
+ rbx_cp-0.11.2.dist-info/METADATA,sha256=B8oCqJ2AKoeL8kM9BxGo88pM3Y_ujJtzPCPDhsC5j7U,4625
244
+ rbx_cp-0.11.2.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
245
+ rbx_cp-0.11.2.dist-info/entry_points.txt,sha256=qBTLBOeifT1F00LWaEewRRE_jQPgvH7BUdJfZ-dYsFU,57
246
+ rbx_cp-0.11.2.dist-info/RECORD,,