copier-python 0.22.2__py3-none-any.whl → 0.23.1__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.
copier_python/update.py CHANGED
@@ -3,12 +3,15 @@ from __future__ import annotations
3
3
  import json
4
4
  import os
5
5
  import subprocess
6
+ from contextlib import contextmanager
6
7
  from dataclasses import dataclass, field
7
8
  from typing import TYPE_CHECKING
8
9
 
9
10
  from .repo import RepoWorktree
10
11
 
11
12
  if TYPE_CHECKING:
13
+ from collections.abc import Generator
14
+
12
15
  from .repo import RepoTarget
13
16
 
14
17
  TEMPLATE_REPO_URL = "https://github.com/smkent/copier-python"
@@ -25,6 +28,18 @@ class UpdateAction:
25
28
  with RepoWorktree.clone(self.repo, branch=self.branch) as worktree:
26
29
  return self._run(worktree)
27
30
 
31
+ @contextmanager
32
+ def _success_or_shell(
33
+ self, repo: RepoWorktree, name: str
34
+ ) -> Generator[None]:
35
+ try:
36
+ yield
37
+ except subprocess.CalledProcessError:
38
+ print( # noqa: T201
39
+ f"{name} failed. Fix errors and exit the shell to continue."
40
+ )
41
+ repo.shell()
42
+
28
43
  def _run(self, repo: RepoWorktree) -> str | None:
29
44
  """Run copier update in the repo worktree."""
30
45
  copier_status = json.loads(
@@ -38,7 +53,6 @@ class UpdateAction:
38
53
  if not copier_status.get("update_available", False):
39
54
  return None
40
55
  repo.run(["copier", "update", "--skip-answered", "--vcs-ref", end_ref])
41
- repo.run(["mise", "install"])
42
56
 
43
57
  status = repo.git_status()
44
58
  if not status:
@@ -54,13 +68,10 @@ class UpdateAction:
54
68
  if repo.has_conflicts(status):
55
69
  raise RuntimeError("Conflicts remain, aborting")
56
70
 
57
- try:
71
+ with self._success_or_shell(repo, "`mise install`"):
72
+ repo.run(["mise", "install"])
73
+ with self._success_or_shell(repo, "Lint/test"):
58
74
  repo.run_task("lt")
59
- except subprocess.CalledProcessError:
60
- print( # noqa: T201
61
- "Lint/test failed. Fix errors and exit the shell to continue."
62
- )
63
- repo.shell()
64
75
 
65
76
  title = "Apply template updates"
66
77
  body = ""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: copier-python
3
- Version: 0.22.2
3
+ Version: 0.23.1
4
4
  Summary: Copier template for Python projects with modern tooling
5
5
  Project-URL: Homepage, https://smkent.github.io/copier-python
6
6
  Project-URL: Repository, https://github.com/smkent/copier-python
@@ -2,9 +2,9 @@ copier_python/__init__.py,sha256=FxuK5Dek123GsD9rxpsXCP4FjxI7unpoPYe6Mto1Rjk,289
2
2
  copier_python/__main__.py,sha256=6flPTGOnGiXIoqzXatib9uuGLymA70BPYKWm4psBL84,3716
3
3
  copier_python/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  copier_python/repo.py,sha256=SMnF0l1CQGPb2bAy9V8--6lvwVpfu8Jg_heYQN1IRWI,5351
5
- copier_python/update.py,sha256=Lr1VCoePjM3QECG7dmJynM3Rnz01bkew8f72mq0i9LE,2641
6
- copier_python-0.22.2.dist-info/METADATA,sha256=1g93u8a98vaFr5QXcYyWCy3P78H75FSbhAbqX-yvrr0,5423
7
- copier_python-0.22.2.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
8
- copier_python-0.22.2.dist-info/entry_points.txt,sha256=HjthcI_ZBjVT8uC8vjlk8m4XWpmR9_b89rpAWjzFZvo,62
9
- copier_python-0.22.2.dist-info/licenses/LICENSE,sha256=lwNXeTMjiyUh8CtIKWnb2SOTeliVKCJfs_NZB6P23BE,1086
10
- copier_python-0.22.2.dist-info/RECORD,,
5
+ copier_python/update.py,sha256=8OM9mEWU9gdZkmCM_fmVLa1k_nXIY5Q6_L1ADBuPd2c,2977
6
+ copier_python-0.23.1.dist-info/METADATA,sha256=xjK12A9KJoyAtZHPmMuDHH9rEJVqKAkeR0mkuFin06w,5423
7
+ copier_python-0.23.1.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
8
+ copier_python-0.23.1.dist-info/entry_points.txt,sha256=HjthcI_ZBjVT8uC8vjlk8m4XWpmR9_b89rpAWjzFZvo,62
9
+ copier_python-0.23.1.dist-info/licenses/LICENSE,sha256=lwNXeTMjiyUh8CtIKWnb2SOTeliVKCJfs_NZB6P23BE,1086
10
+ copier_python-0.23.1.dist-info/RECORD,,