Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 26 additions & 18 deletions src/frequenz/repo/config/setuptools/grpc_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import pathlib as _pathlib
import subprocess as _subprocess
import sys as _sys
from typing import cast

import setuptools as _setuptools
import setuptools.command.build as _build_command
Expand All @@ -38,24 +39,31 @@ class CompileProto(_setuptools.Command):
description: str = "compile protobuf files"
"""Description of the command."""

user_options: list[tuple[str, str | None, str]] = [
(
"proto-path=",
None,
"path of the root directory containing the protobuf files",
),
("proto-glob=", None, "glob pattern to use to find the protobuf files"),
(
"include-paths=",
None,
"comma-separated list of paths to include when compiling the protobuf files",
),
(
"py-path=",
None,
"path of the root directory where the Python files will be generated",
),
]
# We need the cast here because Command.user_options has the type annoatation
# ClassVar[list[tuple[str, str, str]] | list[tuple[str, str | None, str]]] but the
# expression resolves to list[tuple[str, None, str]] and mypy is not smart enough to
# see that this is compatible with the list[tuple[str, str | None, str]] variant.
user_options = cast(
list[tuple[str, str, str]] | list[tuple[str, str | None, str]],
[
(
"proto-path=",
None,
"path of the root directory containing the protobuf files",
),
("proto-glob=", None, "glob pattern to use to find the protobuf files"),
(
"include-paths=",
None,
"comma-separated list of paths to include when compiling the protobuf files",
),
(
"py-path=",
None,
"path of the root directory where the Python files will be generated",
),
],
)
"""Options of the command."""

def initialize_options(self) -> None:
Expand Down
Loading