Skip to content

Commit fed08db

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

File tree

10 files changed

+209
-0
lines changed

10 files changed

+209
-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: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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+
16+
db: Mapping[str, DBRootDict]
17+
root: str
18+
settings: config
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
from typing import Literal
2+
3+
4+
class dbapi:
5+
def aux_get(self,
6+
mycpv: str,
7+
mylist: list[Literal['DEFINED_PHASES', 'DEPEND', 'EAPI', 'HDEPEND', 'HOMEPAGE',
8+
'INHERITED', 'IUSE', 'KEYWORDS', 'LICENSE', 'PDEPEND',
9+
'PROPERTIES', 'PROVIDE', 'RDEPEND', 'REQUIRED_USE',
10+
'repository', 'RESTRICT', 'SRC_URI', 'SLOT']],
11+
mytree: str | None = ...,
12+
myrepo: str | None = ...) -> list[str]:
13+
...
14+
15+
def xmatch(self, level: Literal['bestmatch-visible', 'match-all-cpv-only', 'match-all',
16+
'match-visible', 'minimum-all', 'minimum-visible',
17+
'minimum-all-ignore-profile'], origdep: str) -> list[str] | str:
18+
...
19+
20+
def findname(self, mycpv: str, mytree: str | None = ..., myrepo: str | None = ...) -> str:
21+
...
22+
23+
def findname2(
24+
self,
25+
mycpv: str,
26+
mytree: str | None = ...,
27+
myrepo: str | None = ...
28+
) -> tuple[None, Literal[0]] | tuple[str, str] | tuple[str, None]:
29+
...
30+
31+
def match(self, mydep: str, use_cache: Literal[0, 1] = ...) -> list[str] | str:
32+
...
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from collections.abc import Sequence
2+
3+
from portage.dbapi import dbapi
4+
5+
6+
class portdbapi(dbapi):
7+
def getFetchMap(self,
8+
mypkg: str,
9+
useflags: Sequence[str] | None = ...,
10+
mytree: str | None = ...) -> dict[str, tuple[str, ...]]:
11+
...
12+
13+
14+
class portagetree:
15+
dbapi: portdbapi

stubs/portage/portage/package/__init__.pyi

Whitespace-only changes.

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

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

stubs/portage/portage/versions.pyi

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

0 commit comments

Comments
 (0)