proj-flow 0.15.2__py3-none-any.whl → 0.16.0__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.
proj_flow/__init__.py CHANGED
@@ -6,4 +6,4 @@ The **proj_flow** contains only ``__version__`` to be updated, nothing more.
6
6
  This is in an attempt to make this module easy to load initially.
7
7
  """
8
8
 
9
- __version__ = "0.15.2"
9
+ __version__ = "0.16.0"
proj_flow/log/commit.py CHANGED
@@ -139,7 +139,11 @@ def _get_commit(hash: str, short_hash: str, message: str) -> Optional[Commit]:
139
139
 
140
140
  breaking_change = None
141
141
  body = "\n".join(lines).strip().split("BREAKING CHANGE", 1)
142
- if len(body) > 1:
142
+ if (
143
+ len(body) > 1
144
+ and (len(body[0]) == 0 or body[0][-1:] == "\n")
145
+ and (len(body[1]) == 1 or body[1][:1] == ":")
146
+ ):
143
147
  body = body[1].lstrip(":").strip()
144
148
  breaking_change = [
145
149
  re.sub(r"\s+", " ", para.strip()) for para in body.split("\n\n")
proj_flow/log/release.py CHANGED
@@ -6,8 +6,7 @@ The **proj_flow.log.release** performs a relase on the hosting service.
6
6
  """
7
7
 
8
8
  import typing
9
- from abc import ABC, abstractmethod
10
- from typing import Iterable, Union
9
+ from typing import Iterable, Optional, Union
11
10
 
12
11
  from proj_flow import api
13
12
  from proj_flow.api import env
@@ -18,9 +17,14 @@ from proj_flow.log.error import NoProjectError, VersionNotAdvancing
18
17
  OneOrMoreStrings = Union[str, Iterable[str]]
19
18
 
20
19
 
21
- class VersionUpdater(ABC):
22
- @abstractmethod
23
- def on_version_change(self, new_version: str) -> OneOrMoreStrings: ...
20
+ class VersionUpdater:
21
+ def on_version_change(self, new_version: str) -> Optional[OneOrMoreStrings]:
22
+ return None
23
+
24
+ def on_version_change_tags(
25
+ self, new_version: str, tags: list[str]
26
+ ) -> Optional[OneOrMoreStrings]:
27
+ return self.on_version_change(new_version)
24
28
 
25
29
 
26
30
  version_updaters = registry.Registry[VersionUpdater]("VersionUpdater")
@@ -114,8 +118,10 @@ def add_release(
114
118
  files_to_commit.append(version_path)
115
119
 
116
120
  for updater in version_updaters.get():
117
- modified = updater.on_version_change(next_version)
118
- if isinstance(modified, str):
121
+ modified = updater.on_version_change_tags(next_version, tags)
122
+ if modified is None:
123
+ continue
124
+ elif isinstance(modified, str):
119
125
  files_to_commit.append(modified)
120
126
  else:
121
127
  files_to_commit.extend(modified)
proj_flow/minimal/base.py CHANGED
@@ -12,6 +12,7 @@ from typing import List
12
12
  from proj_flow import __version__, api
13
13
  from proj_flow.flow import layer
14
14
 
15
+
15
16
  class GitInit(api.init.InitStep):
16
17
  layers: List[layer.LayerInfo] = []
17
18
 
@@ -27,7 +28,7 @@ class GitInit(api.init.InitStep):
27
28
 
28
29
  git("init")
29
30
  git("add", ".")
30
-
31
+
31
32
  executables: List[str] = []
32
33
 
33
34
  for fs_layer in GitInit.layers:
@@ -8,22 +8,64 @@ next to CHANGELOG.rst.
8
8
 
9
9
  import re
10
10
  import sys
11
+ from typing import List, Tuple
11
12
 
12
13
  from proj_flow.log import release
13
14
 
14
15
  YAML_PATH = ".github/ISSUE_TEMPLATE/bug_report.yaml"
15
16
 
16
17
 
18
+ def _version(ver: str) -> Tuple[int, int, int, str]:
19
+ if ver[:1] == "v":
20
+ ver = ver[1:]
21
+
22
+ m = re.match(r"([0-9]+)\.([0-9]+)\.([0-9]+)(.*)", ver)
23
+ if m is None:
24
+ print(f"fatal error: cannot parse {ver}", file=sys.stderr)
25
+ raise SystemExit(1)
26
+ return (int(m.group(1)), int(m.group(2)), int(m.group(3)), ver)
27
+
28
+ def _prev_version(new_version: str, tags: List[str]):
29
+ current = _version(new_version)
30
+ versions = [_version(tag) for tag in reversed(tags)]
31
+ index = 0
32
+ while index < len(versions):
33
+ comp = versions[index]
34
+ if comp[0] != current[0] or comp[1] != current[1]:
35
+ break
36
+
37
+ index += 1
38
+ if index >= len(versions):
39
+ index = 0
40
+
41
+ return None if index > len(versions) else versions[index][-1]
42
+
17
43
  @release.version_updaters.add
18
44
  class VersionUpdater(release.VersionUpdater):
19
- def on_version_change(self, new_version: str):
45
+ def on_version_change_tags(self, new_version: str, tags: List[str]):
46
+ old_version = _prev_version(new_version, tags)
47
+
48
+ range = [f" - Current (v{new_version})\n"]
49
+ if old_version:
50
+ range.extend(
51
+ [
52
+ f" - Previous (v{old_version})\n",
53
+ f" - Older, than v{old_version}\n",
54
+ ]
55
+ )
56
+
20
57
  with open(YAML_PATH, encoding="UTF-8") as inf:
21
58
  lines = inf.readlines()
22
59
 
23
60
  try:
24
61
  id_index = lines.index(" id: version\n")
25
62
  option_index = lines.index(" options:\n", id_index) + 1
26
- lines[option_index:option_index] = f" - v{new_version}\n"
63
+ option_index_end = option_index
64
+ while option_index_end < len(lines) and lines[option_index_end].startswith(
65
+ " - "
66
+ ):
67
+ option_index_end += 1
68
+ lines[option_index:option_index_end] = range
27
69
  except ValueError as e:
28
70
  print(e, file=sys.stderr)
29
71
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: proj-flow
3
- Version: 0.15.2
3
+ Version: 0.16.0
4
4
  Summary: C++ project maintenance, automated
5
5
  Project-URL: Changelog, https://github.com/mzdun/proj-flow/blob/main/CHANGELOG.rst
6
6
  Project-URL: Documentation, https://proj-flow.readthedocs.io/en/latest/
@@ -1,4 +1,4 @@
1
- proj_flow/__init__.py,sha256=Iu3RgtFfoUNiC9ODO4gMyTUFoRfTFtjp9jZCz_zwgDw,277
1
+ proj_flow/__init__.py,sha256=hY1PrbNzkQICKLsEPUvODy7alsHfFSz0LoiO7CDwm84,277
2
2
  proj_flow/__main__.py,sha256=HUar_qQ9Ndmchmryegtzu__5wukwCLrFN_SGRl5Ol_M,233
3
3
  proj_flow/dependency.py,sha256=CpcnR6El8AO9hlLc9lQtYQADYlkx3GMHlkLYbEAtdMI,4639
4
4
  proj_flow/api/__init__.py,sha256=gV2f6kll_5JXtvkGASvnx7CbOWr34PHOdck-4ce-qEk,378
@@ -50,12 +50,12 @@ proj_flow/flow/configs.py,sha256=PQZ5pLPmWwHJtSWmuy04bsnO-VvfWcJyP_UyKjiaG1g,653
50
50
  proj_flow/flow/layer.py,sha256=IUANtCSOvlfzNSnq0VDdGdaXfB70Yr-rDGFxPDQTmpg,6187
51
51
  proj_flow/flow/steps.py,sha256=PN_C_B6vNvqOsjpDpa5ESvH30Sc6RM1fSSqWqXgqg-4,2804
52
52
  proj_flow/log/__init__.py,sha256=02EIgasE-K7mmbbNiIdX0IebWQMp2Co_D6H4ZBhJgcs,365
53
- proj_flow/log/commit.py,sha256=PojQX1hpVlViKQWa7mUmVOM2_VuprxuEWZev5DiGvcY,14097
53
+ proj_flow/log/commit.py,sha256=5Ve3s43NqVcvAKs6URghEpCODrpQ5t7O8hZTA7Rf9Yc,14223
54
54
  proj_flow/log/error.py,sha256=65Nvhfs_d1xSY4EB-ISdWgjotvg-on3iKjhAWHpsBYM,841
55
55
  proj_flow/log/fmt.py,sha256=o14aO3iEt5_KKp9SqcfkscqbMKuTI83NBoSXHcrb7Kg,330
56
56
  proj_flow/log/format.py,sha256=gp1kUoW0nYj5e7Ysu1c29Fh2ssfE1KBSDIYeUbhzN9g,333
57
57
  proj_flow/log/msg.py,sha256=zARmRZHFV3yG-fBnx00wal4Y0O5aGnL-6XcGwNBNKA4,6758
58
- proj_flow/log/release.py,sha256=y4u2oUbRuUtrOwuNP-_QGDsV8JArh1iTJGPjMr68wTo,4248
58
+ proj_flow/log/release.py,sha256=tm25MACkcn7DpneR5z7vvnU24cGGvuH9tj-R7NXuRrE,4463
59
59
  proj_flow/log/hosting/__init__.py,sha256=9Teyw8jJcxeWH2MegqYEgW0n5OmSAWC7FFJj2u_UcrM,278
60
60
  proj_flow/log/hosting/github.py,sha256=O2BdB50vzVSKKIu3qNEYBiBdEUIPqj6C2xVvGAKjTZ4,9123
61
61
  proj_flow/log/rich_text/__init__.py,sha256=D3Y2jy9xlGgnQZdNC_ekoLzQtwkF_NTgLqDTWPvSRUk,279
@@ -63,13 +63,13 @@ proj_flow/log/rich_text/api.py,sha256=PCSAGwkmDUMoVlpN7BDsgIA1AiMZEC0H6TUZXpr_Mg
63
63
  proj_flow/log/rich_text/markdown.py,sha256=jBnNxxhBHzyIZ3Y4HXDfqpl7zlRbbKbKdwdnZwkmNAI,1623
64
64
  proj_flow/log/rich_text/re_structured_text.py,sha256=DEl9KjBUF6cxfNWpQ7GVnHi7wKeuFnPGJwxQxjbCsnM,1823
65
65
  proj_flow/minimal/__init__.py,sha256=Yv32uwmS5a9SXSjaMVK0xKla9sWtcA8QkJHt15ffhiU,354
66
- proj_flow/minimal/base.py,sha256=mE1Qf90fCYo2UjezESknVhUhxyxPNvS4wL_jbY2tF2M,1234
66
+ proj_flow/minimal/base.py,sha256=jFAiJICAD6izCBqsNgt7syZ_lynpC5goNuEsaQv1a44,1227
67
67
  proj_flow/minimal/bootstrap.py,sha256=PcZfBsUmj8uDPGBC55iUgD5O7W4VSkpCQb6r9GEyAaQ,556
68
68
  proj_flow/minimal/init.py,sha256=Rx3wu2xDZQpaiU0vmNmsj1eS48DopvL023lB7eTf85A,4318
69
69
  proj_flow/minimal/list.py,sha256=RlOqammE8olNKXsnbv1enF5uriu0MZ2wFbht37Z2ETw,4810
70
70
  proj_flow/minimal/run.py,sha256=4qvGLqz2ayCZDvVBrq4tG094fjfcmDPon-xcGPQkM_U,4665
71
71
  proj_flow/minimal/system.py,sha256=9FliH5TD103JYSAe2O5EU7hkOHDgVzTqu0Exxk-WrXE,1579
72
- proj_flow/minimal/ext/bug_report.py,sha256=rC9LR2obJ54zOoPd6fU3BClB9-sYyhuxG_p4_wSCpZs,949
72
+ proj_flow/minimal/ext/bug_report.py,sha256=aKTxjHBF5lZIU9Hmsq1Mc3Ou19GkSh_Q137I81fLsZY,2309
73
73
  proj_flow/project/__init__.py,sha256=AROrwhbuMR5rJE-HC769eL4IXrMLQYpQb3HgpkOAYqg,293
74
74
  proj_flow/project/api.py,sha256=fu7gW0JuC7brwdsR4TadXYRqeMdt-lBUCEV4Sf0kMfY,1999
75
75
  proj_flow/project/data.py,sha256=TluhBDoJEYL4dnyTpInmhQ49Uvf8mkWmpU-YMLQPNhE,317
@@ -133,8 +133,8 @@ proj_flow/template/licenses/MIT.mustache,sha256=NncPoQaNsuy-WmRmboik3fyhJJ8m5pc2
133
133
  proj_flow/template/licenses/Unlicense.mustache,sha256=awOCsWJ58m_2kBQwBUGWejVqZm6wuRtCL2hi9rfa0X4,1211
134
134
  proj_flow/template/licenses/WTFPL.mustache,sha256=lvF4V_PrKKfZPa2TC8CZo8tlqaKvs3Bpv9G6XsWWQ4k,483
135
135
  proj_flow/template/licenses/Zlib.mustache,sha256=uIj-mhSjes2HJ3rRapyy2ALflKRz4xQgS4mVM9827C0,868
136
- proj_flow-0.15.2.dist-info/METADATA,sha256=LzOSrMiyHcSSFH62BPjQvFytdqLTb8g0m6vmvG5ahtw,2980
137
- proj_flow-0.15.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
138
- proj_flow-0.15.2.dist-info/entry_points.txt,sha256=d_OmGKZzpY7FCWz0sZ4wnBAPZC75oMEzTgJZWtpDELo,49
139
- proj_flow-0.15.2.dist-info/licenses/LICENSE,sha256=vpOQJ5QlrTedF3coEWvA4wJzVJH304f66ZitR7Od4iU,1068
140
- proj_flow-0.15.2.dist-info/RECORD,,
136
+ proj_flow-0.16.0.dist-info/METADATA,sha256=o1kssBOMWGcv1Zh7K4iFpVvad3O_3PvZyiWlQ3A7Vu8,2980
137
+ proj_flow-0.16.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
138
+ proj_flow-0.16.0.dist-info/entry_points.txt,sha256=d_OmGKZzpY7FCWz0sZ4wnBAPZC75oMEzTgJZWtpDELo,49
139
+ proj_flow-0.16.0.dist-info/licenses/LICENSE,sha256=vpOQJ5QlrTedF3coEWvA4wJzVJH304f66ZitR7Od4iU,1068
140
+ proj_flow-0.16.0.dist-info/RECORD,,