mirror of
https://gitlab.postmarketos.org/postmarketOS/pmbootstrap.git
synced 2025-07-12 19:09:56 +03:00
make mypy happy (MR 2252)
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
parent
f2ca9c618e
commit
0365438134
10 changed files with 19 additions and 14 deletions
|
@ -6,6 +6,7 @@
|
|||
import sys
|
||||
import os
|
||||
import datetime
|
||||
from typing import Any, Dict
|
||||
|
||||
|
||||
sys.path.insert(0, os.path.abspath('..')) # Allow modules to be found
|
||||
|
@ -41,7 +42,7 @@ exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
|
|||
html_theme = 'sphinx_rtd_theme'
|
||||
html_favicon = 'https://wiki.postmarketos.org/favicon.ico'
|
||||
|
||||
html_theme_options = {'style_nav_header_background': '008b69',}
|
||||
html_theme_options: Dict[str, Any] = {'style_nav_header_background': '008b69',}
|
||||
|
||||
# Output file base name for HTML help builder.
|
||||
htmlhelp_basename = 'pmboostrapdoc'
|
||||
|
|
|
@ -92,4 +92,4 @@ def generate(pkgname: str, fork_alpine: bool):
|
|||
pmb.helpers.run.user(
|
||||
["mv", aportgen, path_target])
|
||||
|
||||
logging.info("*** pmaport generated: " + path_target)
|
||||
logging.info(f"*** pmaport generated: {path_target}")
|
||||
|
|
|
@ -60,7 +60,7 @@ def generate_apkbuild(pkgname: str, deviceinfo: Deviceinfo, patches: List[str]):
|
|||
|
||||
makedepends.sort()
|
||||
makedepends_fmt = ("\n" + " " * 12).join(makedepends)
|
||||
patches = ("\n" + " " * 12).join(patches)
|
||||
patches_str = ("\n" + " " * 12).join(patches)
|
||||
content = f"""\
|
||||
# Reference: <https://postmarketos.org/vendorkernel>
|
||||
# Kernel config based on: arch/{carch}/configs/(CHANGEME!)
|
||||
|
@ -86,7 +86,7 @@ def generate_apkbuild(pkgname: str, deviceinfo: Deviceinfo, patches: List[str]):
|
|||
source="
|
||||
$pkgname-$_commit.tar.gz::https://github.com/LineageOS/$_repository/archive/$_commit.tar.gz
|
||||
$_config
|
||||
{patches}
|
||||
{patches_str}
|
||||
"
|
||||
builddir="$srcdir/$_repository-$_commit"
|
||||
_outdir="out"
|
||||
|
|
|
@ -140,6 +140,8 @@ def packages_get_locally_built_apks(packages, arch: Arch) -> List[Path]:
|
|||
return ret
|
||||
|
||||
|
||||
# FIXME: List[Sequence[PathString]] weirdness
|
||||
# mypy: disable-error-code="operator"
|
||||
def install_run_apk(to_add: List[str], to_add_local: List[Path], to_del: List[str], chroot: Chroot):
|
||||
"""
|
||||
Run apk to add packages, and ensure only the desired packages get
|
||||
|
|
|
@ -116,6 +116,8 @@ def flash_lk2nd(deviceinfo: Deviceinfo, method: str):
|
|||
# Get the lk2nd package (which is a dependency of the device package)
|
||||
device_pkg = f"device-{deviceinfo.codename}"
|
||||
apkbuild = pmb.helpers.pmaports.get(device_pkg)
|
||||
if not apkbuild:
|
||||
raise RuntimeError(f"Failed to find {device_pkg} in pmaports")
|
||||
lk2nd_pkg = None
|
||||
for dep in apkbuild["depends"]:
|
||||
if dep.startswith("lk2nd"):
|
||||
|
|
|
@ -551,9 +551,7 @@ def qemu(args: PmbArgs):
|
|||
|
||||
def stats(args: PmbArgs):
|
||||
# Chroot suffix
|
||||
chroot = Chroot.native()
|
||||
if args.arch != Arch.native():
|
||||
chroot = Chroot.buildroot(args.arch)
|
||||
chroot = Chroot.buildroot(args.arch or Arch.native())
|
||||
|
||||
# Install ccache and display stats
|
||||
pmb.chroot.apk.install(["ccache"], chroot)
|
||||
|
|
|
@ -12,7 +12,9 @@ import pmb.build
|
|||
import pmb.helpers.run
|
||||
import pmb.helpers.pmaports
|
||||
|
||||
|
||||
# FIXME: dest_paths[repo], repo expected to be a Literal.
|
||||
# We should really make Config.mirrors not a TypedDict.
|
||||
# mypy: disable-error-code="index"
|
||||
def check(pkgnames: Sequence[str]):
|
||||
"""Run apkbuild-lint on the supplied packages.
|
||||
|
||||
|
@ -54,7 +56,7 @@ def check(pkgnames: Sequence[str]):
|
|||
options = pmb.config.apkbuild_custom_valid_options
|
||||
|
||||
# For each pkgrepo run the linter on the relevant packages
|
||||
for repo, apkbuild_paths in apkbuilds.items():
|
||||
for pkgrepo, apkbuild_paths in apkbuilds.items():
|
||||
pmb.chroot.root(["apkbuild-lint"] + apkbuild_paths,
|
||||
check=False, output="stdout",
|
||||
output_return=True,
|
||||
|
|
|
@ -233,7 +233,7 @@ def get_with_path(pkgname, must_exist=True, subpackages=True, skip_extra_repos=F
|
|||
return None, None
|
||||
|
||||
|
||||
def get(pkgname, must_exist=True, subpackages=True, skip_extra_repos=False) -> Optional[Dict[str, Any]]:
|
||||
def get(pkgname, must_exist=True, subpackages=True, skip_extra_repos=False) -> Dict[str, Any]:
|
||||
return get_with_path(pkgname, must_exist, subpackages, skip_extra_repos)[1]
|
||||
|
||||
|
||||
|
|
|
@ -50,6 +50,8 @@ def apkindex_hash(url: str, length: int=8) -> Path:
|
|||
return Path(f"APKINDEX.{ret}.tar.gz")
|
||||
|
||||
|
||||
# FIXME: make config.mirrors a normal dict
|
||||
# mypy: disable-error-code="literal-required"
|
||||
@Cache("user_repository", "mirrors_exclude")
|
||||
def urls(user_repository=True, mirrors_exclude: List[str] = []):
|
||||
"""Get a list of repository URLs, as they are in /etc/apk/repositories.
|
||||
|
@ -82,7 +84,7 @@ def urls(user_repository=True, mirrors_exclude: List[str] = []):
|
|||
for repo in pkgrepo_names() + ["alpine"]:
|
||||
if repo in mirrors_exclude:
|
||||
continue
|
||||
mirror = config.mirrors[repo] # mypy: disable-error-code="literal-required"
|
||||
mirror = config.mirrors[repo]
|
||||
mirrordirs = []
|
||||
if repo == "alpine":
|
||||
# FIXME: This is a bit of a mess
|
||||
|
|
|
@ -72,9 +72,7 @@ class PmbArgs(Namespace):
|
|||
flash_method: str
|
||||
folder: str
|
||||
force: bool
|
||||
fork_alpine: str
|
||||
# This is a filthy lie
|
||||
from_argparse: "PmbArgs"
|
||||
fork_alpine: bool
|
||||
full_disk_encryption: str
|
||||
hook: str
|
||||
host: str
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue