From: Michael Tremer Date: Sat, 3 Dec 2016 19:16:17 +0000 (+0100) Subject: system: Add host distro X-Git-Tag: 0.9.28~1285^2~1404 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9e5e1f1563ad7bcb926b0fe80439131def6d2f0a;p=pakfire.git system: Add host distro The system module loads details about the host's distribution which will be used by Pakfire if nothing else is configured. Signed-off-by: Michael Tremer --- diff --git a/src/pakfire/base.py b/src/pakfire/base.py index acd07a219..aa9bdafd4 100644 --- a/src/pakfire/base.py +++ b/src/pakfire/base.py @@ -46,13 +46,16 @@ from .i18n import _ class Pakfire(object): mode = None - def __init__(self, path="/", arch=None): + def __init__(self, path="/", arch=None, distro=None): # The path where we are operating in self.path = path # Default to system architecture self.arch = arch or system.arch + # Default to system distribution + self.distro = distro or system.distro + # Check if we are operating as the root user self.check_root_user() @@ -66,10 +69,6 @@ class Pakfire(object): # Initialize the keyring self.keyring = keyring.Keyring(self) - # Get more information about the distribution we are running - # or building - self.distro = distro.Distribution(self.config.get("distro")) - self.pool = satsolver.Pool(self.arch.name) self.repos = repository.Repositories(self) diff --git a/src/pakfire/system.py b/src/pakfire/system.py index 1c4b6dc95..f64cd82f1 100644 --- a/src/pakfire/system.py +++ b/src/pakfire/system.py @@ -25,6 +25,7 @@ import socket import tempfile from . import arch +from . import distro from . import shell from . import _pakfire @@ -37,8 +38,12 @@ class System(object): the system this software is running on. """ def __init__(self): + # Load the system's native architecture self.arch = arch.Arch(self.native_arch) + # Load the system's distribution + self.distro = distro.Distribution() + @property def hostname(self): hn = socket.gethostname() @@ -49,14 +54,6 @@ class System(object): return hn - @property - def distro(self): - if not hasattr(self, "_distro"): - from . import distro - self._distro = distro.Distribution() - - return self._distro - @property def native_arch(self): """