Skip to content

Commit

Permalink
feat: add pip as pipx package prerequisite
Browse files Browse the repository at this point in the history
  • Loading branch information
koterpillar committed Aug 13, 2024
1 parent 3aefc84 commit fa6d28d
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion mybox/package/pipx.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import json
import re
from pathlib import Path
from typing import Any, Optional
from typing import Any, AsyncIterable, Optional

from pydantic import Field, field_validator

from ..tracker import Tracker
from ..utils import GIT_PREFIX, repo_version
from .base import Package
from .manual_version import ManualVersion
from .system import SystemPackage


class PipxPackage(ManualVersion):
Expand Down Expand Up @@ -92,3 +94,19 @@ async def install(self, *, tracker: Tracker) -> None:

if self.is_repo:
await self.cache_version()

async def prerequisites(self) -> AsyncIterable[Package]:
async for package in super().prerequisites():
yield package # pragma: no cover

os = await self.driver.os()

for system in os.switch(
linux=["python3-pip"],
macos=[],
):
yield SystemPackage(
system=system,
db=self.db,
driver=self.driver,
)

0 comments on commit fa6d28d

Please sign in to comment.