mirror of
ssh://git.janware.com/janware/proj/jw-pkg
synced 2026-04-24 17:23:36 +02:00
App.distro_pkg_ext: Add property
Add .distro_pkg_ext to App, in order to support something along the lines of jw-pkg distro install "https://my-company.com/repos/%{id}/%{codename}/my-base-pkg-latest.%{pkg-ext}" Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
beab4cb03c
commit
f445b196c9
1 changed files with 9 additions and 1 deletions
|
|
@ -12,7 +12,7 @@ if TYPE_CHECKING:
|
||||||
import os, sys, pwd, re
|
import os, sys, pwd, re
|
||||||
|
|
||||||
import os, sys, argparse, pwd, re
|
import os, sys, argparse, pwd, re
|
||||||
from functools import lru_cache
|
from functools import lru_cache, cached_property
|
||||||
from enum import Enum, auto
|
from enum import Enum, auto
|
||||||
|
|
||||||
from .lib.App import App as Base
|
from .lib.App import App as Base
|
||||||
|
|
@ -374,6 +374,14 @@ class App(Base):
|
||||||
def distro_cascade(self) -> str:
|
def distro_cascade(self) -> str:
|
||||||
return ' '.join(self.os_cascade())
|
return ' '.join(self.os_cascade())
|
||||||
|
|
||||||
|
@cached_property
|
||||||
|
def distro_pkg_ext(self) -> str:
|
||||||
|
for entry in self.os_cascade():
|
||||||
|
ret = entry.replace('pkg-', '')
|
||||||
|
if ret != entry:
|
||||||
|
return ret
|
||||||
|
raise RuntimeError(f'No package extension in found in {self.distro_cascade}')
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def distro_gnu_triplet(self) -> str:
|
def distro_gnu_triplet(self) -> str:
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue