From b10eb9201741f62aee701d9871f7e131662f0047 Mon Sep 17 00:00:00 2001 From: lilydjwg Date: Fri, 28 Jun 2024 19:50:33 +0800 Subject: [PATCH] support specifying a name on cmdline building --- lilac | 6 +++++- lilac2/nomypy.py | 12 ++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/lilac b/lilac index 3b579654..0058632a 100755 --- a/lilac +++ b/lilac @@ -577,7 +577,11 @@ def main_may_raise( if pkgs_from_args: for p in pkgs_from_args: - build_reasons[p].append(BuildReason.Cmdline()) + if ':' in p: + p, runner = p.split(':', 1) + else: + runner = None + build_reasons[p].append(BuildReason.Cmdline(runner)) for p in need_rebuild_pkgrel: build_reasons[p].append(BuildReason.UpdatedPkgrel()) diff --git a/lilac2/nomypy.py b/lilac2/nomypy.py index 14809267..c230a640 100644 --- a/lilac2/nomypy.py +++ b/lilac2/nomypy.py @@ -1,6 +1,6 @@ # type: ignore -from typing import Union +from typing import Union, Optional from .typing import OnBuildEntry @@ -96,7 +96,15 @@ class FailedByDeps(BuildReason): def __init__(self, deps: tuple[str]) -> None: self.deps = deps -class Cmdline(BuildReason): pass +class Cmdline(BuildReason): + def __init__(self, runner: Optional[str]) -> None: + self.runner = runner + + def _extra_info(self) -> str: + if self.runner: + return repr(self.runner) + else: + return '' class OnBuild(BuildReason): def __init__(self, update_on_build: list[OnBuildEntry]) -> None: