rbx.cp 0.5.6__py3-none-any.whl → 0.5.7__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/contest/main.py CHANGED
@@ -3,6 +3,7 @@ import shutil
3
3
  import subprocess
4
4
  from typing import Annotated, Optional
5
5
 
6
+ import rich.prompt
6
7
  import typer
7
8
 
8
9
  from rbx import annotations, console, utils
@@ -38,7 +39,7 @@ app.add_typer(
38
39
 
39
40
  @app.command('create, c', help='Create a new contest package.')
40
41
  def create(
41
- name: str,
42
+ path: str,
42
43
  preset: Annotated[
43
44
  str,
44
45
  typer.Option(
@@ -54,7 +55,7 @@ def create(
54
55
  help='Whether to inline the installed preset within the contest folder.',
55
56
  ),
56
57
  ):
57
- console.console.print(f'Creating new contest [item]{name}[/item]...')
58
+ console.console.print(f'Creating new contest at [item]{path}[/item]...')
58
59
 
59
60
  fetch_info = get_preset_fetch_info(preset)
60
61
  if fetch_info is None:
@@ -85,17 +86,24 @@ def create(
85
86
  )
86
87
  raise typer.Exit(1)
87
88
 
88
- dest_path = pathlib.Path(name)
89
+ dest_path = pathlib.Path(path)
89
90
 
90
91
  if dest_path.exists():
91
- console.console.print(
92
- f'[error]Directory [item]{dest_path}[/item] already exists.[/error]'
93
- )
94
- raise typer.Exit(1)
95
-
96
- shutil.copytree(str(contest_path), str(dest_path))
92
+ if not rich.prompt.Confirm.ask(
93
+ f'Directory [item]{dest_path}[/item] already exists. Create contest in it? This might be destructive.',
94
+ show_default=False,
95
+ console=console.console,
96
+ ):
97
+ console.console.print(
98
+ f'[error]Directory [item]{dest_path}[/item] already exists.[/error]'
99
+ )
100
+ raise typer.Exit(1)
101
+
102
+ dest_path.mkdir(parents=True, exist_ok=True)
103
+ shutil.copytree(str(contest_path), str(dest_path), dirs_exist_ok=True)
97
104
  shutil.rmtree(str(dest_path / 'build'), ignore_errors=True)
98
105
  shutil.rmtree(str(dest_path / '.box'), ignore_errors=True)
106
+ shutil.rmtree(str(dest_path / '.local.rbx'), ignore_errors=True)
99
107
  # TODO: consider clearing build and .box recursively for nested problem directories
100
108
  for lock in dest_path.rglob('.preset-lock.yml'):
101
109
  lock.unlink(missing_ok=True)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: rbx.cp
3
- Version: 0.5.6
3
+ Version: 0.5.7
4
4
  Summary:
5
5
  Author: Roberto Sales
6
6
  Requires-Python: >=3.9,<4.0
@@ -12,7 +12,7 @@ rbx/box/contest/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  rbx/box/contest/build_contest_statements.py,sha256=qar6h5u1xAlOKHl3P7-A1d0aYtaqu4PspGw_DYUGOLY,11260
13
13
  rbx/box/contest/contest_package.py,sha256=-eHk6CfJ083jZptWCjR0F4x_r9qsmKeSOUvK0QnDyA4,2393
14
14
  rbx/box/contest/contest_utils.py,sha256=vWv4iNWdJT5motAznfdNzl8o-tEoCU4xmdyaPTPJZuY,490
15
- rbx/box/contest/main.py,sha256=ERMon3vpayMfpJfAPGp51dsNox38R8orqi1v1rKhAMg,5701
15
+ rbx/box/contest/main.py,sha256=ZHEVE01dFI_pbT51zvJfQJrUV0cCVQrhbkkeXKN98Cg,6113
16
16
  rbx/box/contest/schema.py,sha256=rxzjJasMWPKKhvSJs4eW4A2oCiA4gXgfF-MzqsbPslQ,4914
17
17
  rbx/box/contest/statements.py,sha256=iG_E4bqhc7hof4LlAliw4m9VO8HcDzvnhsWmxzVRQM4,2690
18
18
  rbx/box/creation.py,sha256=mZ7kEt1F-0scwDBc6oWsJxFRW69AccZlKuJfN1QyDd4,2203
@@ -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=wy8zQRb97n3lptilK7UxM4A44KjXb1W5Z1tD61a-K4A,4173
160
- rbx_cp-0.5.6.dist-info/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
161
- rbx_cp-0.5.6.dist-info/METADATA,sha256=5QbCa-cpPi4KRJi29okpTAY3BUk68RsqtGygzZn4zhs,3253
162
- rbx_cp-0.5.6.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
163
- rbx_cp-0.5.6.dist-info/entry_points.txt,sha256=qBTLBOeifT1F00LWaEewRRE_jQPgvH7BUdJfZ-dYsFU,57
164
- rbx_cp-0.5.6.dist-info/RECORD,,
160
+ rbx_cp-0.5.7.dist-info/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
161
+ rbx_cp-0.5.7.dist-info/METADATA,sha256=-j1iPGuYhzb9fm2bthZyUdUQkmeFfaVKggfw3-oMPs4,3253
162
+ rbx_cp-0.5.7.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
163
+ rbx_cp-0.5.7.dist-info/entry_points.txt,sha256=qBTLBOeifT1F00LWaEewRRE_jQPgvH7BUdJfZ-dYsFU,57
164
+ rbx_cp-0.5.7.dist-info/RECORD,,
File without changes