diff options
Diffstat (limited to 'portato/backend')
-rw-r--r-- | portato/backend/portage/__init__.py | 12 | ||||
-rw-r--r-- | portato/backend/portage/settings_22.py (renamed from portato/backend/portage/setting_22.py) | 2 | ||||
-rw-r--r-- | portato/backend/portage/system.py | 5 | ||||
-rw-r--r-- | portato/backend/portage/system_22.py | 7 |
4 files changed, 18 insertions, 8 deletions
diff --git a/portato/backend/portage/__init__.py b/portato/backend/portage/__init__.py index 6ccbf7f..be6cce6 100644 --- a/portato/backend/portage/__init__.py +++ b/portato/backend/portage/__init__.py @@ -12,5 +12,13 @@ from __future__ import absolute_import -from .system import PortageSystem -from .package import PortagePackage +from portage import VERSION as PV + +VERSION = tuple(map(int, (x.split("_")[0] for x in PV.split(".")))) + +if VERSION >= (2, 2): + from .system_22 import PortageSystem_22 as PortageSystem + from .package_22 import PortagePackage_22 as PortagePackage +else: + from .system import PortageSystem + from .package import PortagePackage diff --git a/portato/backend/portage/setting_22.py b/portato/backend/portage/settings_22.py index 4e68d7c..a43d69e 100644 --- a/portato/backend/portage/setting_22.py +++ b/portato/backend/portage/settings_22.py @@ -12,7 +12,7 @@ from __future__ import absolute_import -import portage +import portage.sets from .settings import PortageSettings class PortageSettings_22 (PortageSettings): diff --git a/portato/backend/portage/system.py b/portato/backend/portage/system.py index db6b6ea..feaf4df 100644 --- a/portato/backend/portage/system.py +++ b/portato/backend/portage/system.py @@ -16,6 +16,7 @@ import re, os, os.path import portage from collections import defaultdict +from . import VERSION from .package import PortagePackage from .settings import PortageSettings from ..system_interface import SystemInterface @@ -36,8 +37,6 @@ class PortageSystem (SystemInterface): self.use_descs = {} self.local_use_descs = defaultdict(dict) - self._version = tuple([x.split("_")[0] for x in portage.VERSION.split(".")]) - def get_version (self): return "Portage %s" % portage.VERSION @@ -166,7 +165,7 @@ class PortageSystem (SystemInterface): t = self.find_packages(search_key, pkgSet = pkgSet, masked = masked, with_version = True, only_cpv = True) - if self._version >= (2,1,5): + if VERSION >= (2,1,5): t += [pkg.get_cpv() for pkg in self.find_packages(search_key, "installed") if not (pkg.is_testing(True) or pkg.is_masked())] else: t = self.find_packages(search_key, "installed", only_cpv=True) diff --git a/portato/backend/portage/system_22.py b/portato/backend/portage/system_22.py index a4ea4a0..be27186 100644 --- a/portato/backend/portage/system_22.py +++ b/portato/backend/portage/system_22.py @@ -12,6 +12,11 @@ from __future__ import absolute_import, with_statement +import os +import portage + +from collections import defaultdict + from .package_22 import PortagePackage_22 from .settings_22 import PortageSettings_22 from .system import PortageSystem @@ -25,7 +30,5 @@ class PortageSystem_22 (PortageSystem): self.use_descs = {} self.local_use_descs = defaultdict(dict) - self._version = tuple([x.split("_")[0] for x in portage.VERSION.split(".")]) - def new_package (self, cpv): return PortagePackage_22(cpv) |