Skip to content

Commit 9f514a3

Browse files
committed
[portage] Start of stubs
1 parent ae6f49a commit 9f514a3

File tree

10 files changed

+222
-0
lines changed

10 files changed

+222
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
portage.tests.*
2+
portage.(VERSION|abssymlink|archlist|auxdbkeys|bsd_chflags|create_trees|eapi_is_supported|endversion|endversion_keys|getcwd|getpid|groups|lchown|load_mod|mtimedbfile|ostype|pickle_write|pkglines|portage_gid|portage_uid|portageexit|prelink_capable|profiledir|secpass|selinux|selinux_enabled|thirdpartymirrors|uid|userland|userpriv_groups|utf8_mode|wheelgid)
3+
portage.(binpkg|checksum|const|cvstree|data|debug|dispatch_conf|eapi|eclass_cache|exception|getbinpkg|glsa|gpg|gpkg|installation|localization|locks|mail|manifest|metadata|module|news|output|process|progress|update|xpak)
4+
portage.(binrepo|cache|dep|elog|emaint|env|proxy|repository|sync|util|xml)(..*)?
5+
portage._compat_upgrade..*
6+
portage._emirrordist..*
7+
portage._sets..*
8+
portage.dbapi.(DummyTree|IndexedPortdb|IndexedVardb|bintree|cpv_expand|dep_expand|vartree|virtual)
9+
portage.dbapi.__all__
10+
portage.dbapi.dbapi..*
11+
portage.dbapi.porttree..*
12+
portage.package.ebuild.(deprecated_profile_check|digestcheck|digestgen|fetch|getmaskingreason|getmaskingstatus|prepare_build_dirs|profile_iuse)
13+
portage.package.ebuild._config..*
14+
portage.package.ebuild._ipc..*
15+
portage.package.ebuild._parallel_manifest..*
16+
portage.package.ebuild.config..*
17+
portage.package.ebuild.doebuild..*
18+
portage.versions.(best|catsplit|cpv_getkey|cpv_getversion|cpv_sort_key|pkgcmp|pkgsplit|ververify)
19+
portage.versions.__all__

stubs/portage/METADATA.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
version = "3.0.*"
2+
upstream_repository = "https://gitweb.gentoo.org/proj/portage.git"
3+
4+
[tool.stubtest]
5+
ci_platforms = ["linux"]

stubs/portage/portage/__init__.pyi

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from collections.abc import Mapping
2+
from typing import Any, TypedDict, type_check_only
3+
4+
from .dbapi import dbapi
5+
from .dbapi.porttree import portagetree
6+
from .package.ebuild.config import config
7+
from .package.ebuild.doebuild import doebuild
8+
9+
@type_check_only
10+
class DBRootDict(TypedDict):
11+
bintree: Any
12+
porttree: portagetree
13+
virtuals: Any
14+
15+
db: Mapping[str, DBRootDict]
16+
root: str
17+
settings: config
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
from typing import Literal
2+
3+
class dbapi:
4+
def aux_get(
5+
self,
6+
mycpv: str,
7+
mylist: list[
8+
Literal[
9+
"DEFINED_PHASES",
10+
"DEPEND",
11+
"EAPI",
12+
"HDEPEND",
13+
"HOMEPAGE",
14+
"INHERITED",
15+
"IUSE",
16+
"KEYWORDS",
17+
"LICENSE",
18+
"PDEPEND",
19+
"PROPERTIES",
20+
"PROVIDE",
21+
"RDEPEND",
22+
"REQUIRED_USE",
23+
"repository",
24+
"RESTRICT",
25+
"SRC_URI",
26+
"SLOT",
27+
]
28+
],
29+
mytree: str | None = ...,
30+
myrepo: str | None = ...,
31+
) -> list[str]: ...
32+
def xmatch(
33+
self,
34+
level: Literal[
35+
"bestmatch-visible",
36+
"match-all-cpv-only",
37+
"match-all",
38+
"match-visible",
39+
"minimum-all",
40+
"minimum-visible",
41+
"minimum-all-ignore-profile",
42+
],
43+
origdep: str,
44+
) -> list[str] | str: ...
45+
def findname(self, mycpv: str, mytree: str | None = ..., myrepo: str | None = ...) -> str: ...
46+
def findname2(
47+
self, mycpv: str, mytree: str | None = ..., myrepo: str | None = ...
48+
) -> tuple[None, Literal[0]] | tuple[str, str] | tuple[str, None]: ...
49+
def match(self, mydep: str, use_cache: Literal[0, 1] = ...) -> list[str] | str: ...
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from collections.abc import Sequence
2+
3+
from portage.dbapi import dbapi
4+
5+
class portdbapi(dbapi):
6+
def getFetchMap(
7+
self, mypkg: str, useflags: Sequence[str] | None = ..., mytree: str | None = ...
8+
) -> dict[str, tuple[str, ...]]: ...
9+
10+
class portagetree:
11+
dbapi: portdbapi

stubs/portage/portage/package/__init__.pyi

Whitespace-only changes.

stubs/portage/portage/package/ebuild/__init__.pyi

Whitespace-only changes.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
from typing import Any
2+
3+
class config:
4+
def __init__(
5+
self,
6+
clone: config | None = ...,
7+
mycpv: str | None = ...,
8+
config_profile_path: str | None = ...,
9+
config_incrementals: dict[str, str] | None = ...,
10+
config_root: str | None = ...,
11+
target_root: str | None = ...,
12+
sysroot: str | None = ...,
13+
eprefix: str | None = ...,
14+
local_config: bool = True,
15+
env: dict[str, str] | None = ...,
16+
_unmatched_removal: bool = ...,
17+
repositories: list[str] | None = ...,
18+
) -> None: ...
19+
def __getitem__(self, key: str) -> str: ...
20+
def __setitem__(self, key: str, value: str) -> None: ...
21+
def __delitem__(self, key: str) -> None: ...
22+
def __iter__(self) -> str: ...
23+
def get(self, k: str, x: Any = ...) -> Any: ...
24+
def __len__(self) -> int: ...
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
from typing import Any, Literal
2+
3+
from portage.dbapi.porttree import portdbapi
4+
from .config import config
5+
6+
def doebuild(
7+
myebuild: str,
8+
mydo: Literal[
9+
"clean",
10+
"cleanrm",
11+
"compile",
12+
"config",
13+
"configure",
14+
"depend",
15+
"digest",
16+
"fetch",
17+
"fetchall",
18+
"help",
19+
"info",
20+
"install",
21+
"instprep",
22+
"manifest",
23+
"merge",
24+
"nofetch",
25+
"package",
26+
"postinst",
27+
"postrm",
28+
"preinst",
29+
"prepare",
30+
"prerm",
31+
"pretend",
32+
"qmerge",
33+
"rpm",
34+
"setup",
35+
"test",
36+
"unmerge",
37+
"unpack",
38+
],
39+
settings: config | None = ...,
40+
debug: Literal[0, 1] = ...,
41+
listonly: Literal[0, 1] = ...,
42+
fetchonly: Literal[0, 1] = ...,
43+
cleanup: Literal[0, 1] = ...,
44+
use_cache: Literal[0, 1] = ...,
45+
fetchall: Literal[0, 1] = ...,
46+
tree: Literal["vartree", "porttree", "bintree"] = ...,
47+
mydbapi: portdbapi | None = ...,
48+
vartree: Any = ...,
49+
prev_mtimes: dict[str, Any] | None = ...,
50+
fd_pipes: dict[str, str] | None = ...,
51+
returnproc: int | bool = ...,
52+
) -> Literal[0, 1] | bool | list[int]: # Missing portage.process.MultiprocessingProcess
53+
...

stubs/portage/portage/versions.pyi

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
from typing import Any, Literal
2+
from typing_extensions import Self
3+
4+
def vercmp(ver1: str, ver2: str, silent: Literal[0, 1] = ...) -> int | None: ...
5+
6+
class _pkg_str(str):
7+
@property
8+
def stable(self) -> bool: ...
9+
def __new__(
10+
cls,
11+
cpv: str,
12+
metadata: dict[str, Any] | None = ...,
13+
settings: Any = ...,
14+
eapi: Any = ...,
15+
repo: str | None = ...,
16+
slot: str | None = ...,
17+
build_time: int | None = ...,
18+
build_id: str | None = ...,
19+
file_size: int | None = ...,
20+
mtime: int | None = ...,
21+
db: Any = ...,
22+
repoconfig: Any = ...,
23+
) -> Self: ...
24+
def __init__(
25+
self,
26+
cpv: str,
27+
metadata: dict[str, Any] | None = ...,
28+
settings: Any = ...,
29+
eapi: Any = ...,
30+
repo: str | None = ...,
31+
slot: str | None = ...,
32+
build_time: int | None = ...,
33+
build_id: str | None = ...,
34+
file_size: int | None = ...,
35+
mtime: int | None = ...,
36+
db: Any = ...,
37+
repoconfig: Any = ...,
38+
) -> None: ...
39+
@staticmethod
40+
def _long(var: Any, default: int) -> int: ...
41+
42+
def catpkgsplit(
43+
mydata: str | _pkg_str, silent: Literal[0, 1] = ..., eapi: str | None = ...
44+
) -> tuple[str | None, str, str, str] | None: ...

0 commit comments

Comments
 (0)