Skip to content

Commit 1a15f59

Browse files
authored
Merge v0.13.x into v0.x.x (#420)
2 parents 35bbd3f + f6c99e8 commit 1a15f59

File tree

5 files changed

+29
-13
lines changed

5 files changed

+29
-13
lines changed

src/frequenz/repo/config/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
nox.configure(RepositoryType.LIB)
3636
```
3737
38-
Again, make sure to pick the correct project typedefault configuration based on the type of your
39-
project (`actor_config`, `api_config`, `app_config`, `lib_config`, `model_config`).
38+
Again, make sure to pick the correct project default configuration based on the type of
39+
your project (`actor_config`, `api_config`, `app_config`, `lib_config`, `model_config`).
4040
4141
If you need to use some custom configuration, you can start from the default settings in
4242
the [`frequenz.repo.config.nox.default`][] module,
@@ -312,7 +312,7 @@
312312
typed.
313313
314314
3. Exclude the `src/conftest.py` file from the distribution package, as it shouldn't be
315-
shipped with the code, it is only for delelopment purposes. To do so, add the
315+
shipped with the code, it is only for development purposes. To do so, add the
316316
following line to the `MANIFEST.in` file:
317317
318318
```

src/frequenz/repo/config/mkdocs/mike.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,10 @@ def build_mike_version(repo_info: RepoVersionInfo) -> MikeVersionInfo:
136136
)
137137

138138

139-
_is_version_re = re.compile(r"^v(\d+).(\d+)(-dev|-pre)?$")
140-
_stable_to_semver_re = re.compile(r"^v(\d+).(\d+)$")
141-
_pre_to_semver_re = re.compile(r"^v(\d+).(\d+)-pre$")
142-
_dev_to_semver_re = re.compile(r"^v(\d+).(\d+)-dev$")
139+
_is_version_re = re.compile(r"^v(\d+)\.(\d+)(?:-dev|-pre)?$")
140+
_stable_to_semver_re = re.compile(r"^v(\d+)\.(\d+)$")
141+
_pre_to_semver_re = re.compile(r"^v(\d+)\.(\d+)-pre$")
142+
_dev_to_semver_re = re.compile(r"^v(\d+)\.(\d+)-dev$")
143143

144144

145145
def _to_fake_sortable_semver(version: str) -> str:
@@ -207,6 +207,9 @@ def compare_mike_version(version1: str, version2: str) -> int:
207207
if is_version_v2: # version1 is not a version
208208
return 1
209209

210+
if version1 == version2:
211+
return 0
212+
210213
return -1 if version1 < version2 else 1
211214

212215

src/frequenz/repo/config/nox/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
nox.configure(RepositoryType.LIB)
1616
```
1717
18-
Again, make sure to pick the correct project typedefault configuration based on the type
18+
Again, make sure to pick the correct project default configuration based on the type
1919
of your project (`actor_config`, `api_config`, `app_config`, `lib_config`,
2020
`model_config`).
2121

src/frequenz/repo/config/setuptools/grpc_tools.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
import pathlib as _pathlib
1414
import subprocess as _subprocess
1515
import sys as _sys
16-
from typing import cast
16+
from collections.abc import Iterable
17+
from typing import assert_never, cast
1718

1819
import setuptools as _setuptools
1920
import setuptools.command.build as _build_command
@@ -30,8 +31,8 @@ class CompileProto(_setuptools.Command):
3031
proto_glob: str
3132
"""The glob pattern to use to find the protobuf files."""
3233

33-
include_paths: str
34-
"""Comma-separated list of paths to include when compiling the protobuf files."""
34+
include_paths: str | Iterable[str]
35+
"""Iterable or comma-separated list of paths to include when compiling the protobuf files."""
3536

3637
py_path: str
3738
"""The path of the root directory where the Python files will be generated."""
@@ -72,15 +73,25 @@ def initialize_options(self) -> None:
7273

7374
self.proto_path = config.proto_path
7475
self.proto_glob = config.proto_glob
75-
self.include_paths = ",".join(config.include_paths)
76+
self.include_paths = config.include_paths
7677
self.py_path = config.py_path
7778

7879
def finalize_options(self) -> None:
7980
"""Finalize options."""
8081

8182
def run(self) -> None:
8283
"""Compile the Python protobuf files."""
83-
include_paths = self.include_paths.split(",")
84+
include_paths: Iterable[str]
85+
match self.include_paths:
86+
case str() as str_paths:
87+
# If it comes as a comma-separated string, split it into a list,
88+
# stripping whitespace and ignoring empty strings.
89+
include_paths = filter(len, map(str.strip, str_paths.split(",")))
90+
case Iterable() as paths_it:
91+
include_paths = paths_it
92+
case unexpected:
93+
assert_never(unexpected)
94+
8495
proto_files = [
8596
str(p) for p in _pathlib.Path(self.proto_path).rglob(self.proto_glob)
8697
]

tests/mkdocs/test_mike.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,8 @@ def test_build_mike_version(
266266
("v2.0-pre", "v1.0-pre", 1),
267267
("v2.0", "v1.0-pre", 1),
268268
("blah", "v1.0-dev", 1),
269+
("blah", "blah", 0),
270+
("v1x0-dev", "v1.0-dev", 1),
269271
("alpha", "beta", -1),
270272
],
271273
)

0 commit comments

Comments
 (0)