Skip to content

Commit

Permalink
Fix typing
Browse files Browse the repository at this point in the history
  • Loading branch information
fantix committed Aug 12, 2024
1 parent 140c597 commit 8f04b97
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 11 deletions.
4 changes: 2 additions & 2 deletions metapkg/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from cleo.io.outputs.output import Output


class App(BaseApplication): # type: ignore
class App(BaseApplication):
def __init__(self) -> None:
super().__init__(metapkg.__name__, metapkg.__version__)

Expand All @@ -38,4 +38,4 @@ def main() -> int:
cmd = getattr(metapkg_commands, cmd_name)
app.add(cmd())

return app.run() # type: ignore
return app.run()
2 changes: 1 addition & 1 deletion metapkg/commands/base.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from cleo.commands import command as cleo_command


class Command(cleo_command.Command): # type: ignore
class Command(cleo_command.Command):
pass
2 changes: 1 addition & 1 deletion metapkg/packages/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Provider(poetry_provider.Provider):
def __init__(
self,
package: poetry_pkg.Package,
pool: poetry_pool.Pool,
pool: poetry_pool.RepositoryPool,
io: cleo_io.IO,
*,
installed: list[poetry_pkg.Package] | None = None,
Expand Down
9 changes: 9 additions & 0 deletions metapkg/targets/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Literal,
Mapping,
NamedTuple,
TextIO,
)

import collections
Expand All @@ -30,6 +31,7 @@

if TYPE_CHECKING:
from cleo.io.io import IO
from cleo.io.outputs.stream_output import StreamOutput
from distro import distro
from poetry.utils import env as poetry_env
from poetry.repositories import repository as poetry_repo
Expand Down Expand Up @@ -700,6 +702,13 @@ def __init__(
def io(self) -> IO:
return self._io

@property
def stream(self) -> TextIO:
output = self._io.output
if TYPE_CHECKING:
assert isinstance(output, StreamOutput)
return output.stream

@property
def root_package(self) -> mpkg_base.BundledPackage:
return self._root_pkg
Expand Down
2 changes: 1 addition & 1 deletion metapkg/targets/generic/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ def _build(self) -> None:
tools.cmd(
*command,
cwd=str(self._srcroot),
stdout=self._io.output.stream,
stdout=self.stream,
stderr=subprocess.STDOUT,
)

Expand Down
8 changes: 4 additions & 4 deletions metapkg/targets/rpm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def install_build_deps(self, build: rpmbuild.Build, spec: str) -> None:
"rpm-build",
"rpmlint",
"yum-utils",
stdout=build._io.output.stream,
stdout=build.stream,
stderr=subprocess.STDOUT,
)

Expand All @@ -229,7 +229,7 @@ def install_build_deps(self, build: rpmbuild.Build, spec: str) -> None:
"-y",
spec,
cwd=str(build.get_spec_root(relative_to="fsroot")),
stdout=build._io.output.stream,
stdout=build.stream,
stderr=subprocess.STDOUT,
)

Expand Down Expand Up @@ -264,7 +264,7 @@ def install_build_deps(self, build: rpmbuild.Build, spec: str) -> None:
"install",
"-y",
"systemd-rpm-macros", # for %_unitdir
stdout=build._io.output.stream,
stdout=build.stream,
stderr=subprocess.STDOUT,
)

Expand All @@ -283,7 +283,7 @@ def install_build_deps(self, build: rpmbuild.Build, spec: str) -> None:
"-y",
spec,
cwd=str(build.get_spec_root(relative_to="fsroot")),
stdout=build._io.output.stream,
stdout=build.stream,
stderr=subprocess.STDOUT,
)

Expand Down
4 changes: 2 additions & 2 deletions metapkg/targets/rpm/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ def _rpmbuild(self) -> None:
"rpmbuild",
*args,
cwd=str(self.get_spec_root(relative_to="fsroot")),
stdout=self._io.output.stream,
stdout=self.stream,
stderr=subprocess.STDOUT,
)

Expand All @@ -654,7 +654,7 @@ def _rpmbuild(self) -> None:
"-i",
f"{self._root_pkg.name_slot}.spec",
cwd=str(self.get_spec_root(relative_to="fsroot")),
stdout=self._io.output.stream,
stdout=self.stream,
stderr=subprocess.STDOUT,
)

Expand Down

0 comments on commit 8f04b97

Please sign in to comment.