summaryrefslogtreecommitdiff
path: root/portato/backend
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--portato/backend/portage/package.py7
-rw-r--r--portato/backend/portage/package_22.py22
-rw-r--r--portato/backend/portage/system.py8
-rw-r--r--portato/backend/portage/system_22.py31
4 files changed, 63 insertions, 5 deletions
diff --git a/portato/backend/portage/package.py b/portato/backend/portage/package.py
index db9866a..78125ee 100644
--- a/portato/backend/portage/package.py
+++ b/portato/backend/portage/package.py
@@ -18,7 +18,12 @@ from .. import system
from ..exceptions import BlockedException, PackageNotFoundException, DependencyCalcError
from ...helper import debug, error, unique_array
-import portage, portage_dep
+import portage
+
+try:
+ import portage.dep as portage_dep
+except ImportError:
+ import portage_dep
import os.path
diff --git a/portato/backend/portage/package_22.py b/portato/backend/portage/package_22.py
new file mode 100644
index 0000000..4fe03d9
--- /dev/null
+++ b/portato/backend/portage/package_22.py
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+#
+# File: portato/backend/portage/package_22.py
+# This file is part of the Portato-Project, a graphical portage-frontend.
+#
+# Copyright (C) 2008 René 'Necoro' Neumann
+# This is free software. You may redistribute copies of it under the terms of
+# the GNU General Public License version 2.
+# There is NO WARRANTY, to the extent permitted by law.
+#
+# Written by René 'Necoro' Neumann <necoro@necoro.net>
+
+from __future__ import absolute_import, with_statement
+
+from .package import PortagePackage
+
+class PortagePackage_22 (PortagePackage):
+ """
+ The 2.2 specialization of the portage package.
+ Currently this is identical to the normal one.
+ """
+ pass
diff --git a/portato/backend/portage/system.py b/portato/backend/portage/system.py
index 0d81945..db6b6ea 100644
--- a/portato/backend/portage/system.py
+++ b/portato/backend/portage/system.py
@@ -142,7 +142,7 @@ class PortageSystem (SystemInterface):
"""
if not only_cpv:
- return [PortagePackage(x) for x in list_of_packages]
+ return [self.new_package(x) for x in list_of_packages]
else:
return list_of_packages
@@ -154,7 +154,7 @@ class PortageSystem (SystemInterface):
if only_cpv:
return portage.best(list)
else:
- return PortagePackage(portage.best(list))
+ return self.new_package(portage.best(list))
def find_best_match (self, search_key, masked = False, only_installed = False, only_cpv = False):
t = []
@@ -287,7 +287,7 @@ class PortageSystem (SystemInterface):
unresolved = []
for x in list:
cpv = x.strip()
- if len(cpv) and check(cpv):
+ if cpv and check(cpv):
pkg = self.find_best_match(cpv, only_cpv = only_cpv)
if pkg:
resolved.append(pkg)
@@ -304,7 +304,7 @@ class PortageSystem (SystemInterface):
return portage.catpkgsplit(cpv)
def sort_package_list(self, pkglist):
- pkglist.sort(PortagePackage.compare_version)
+ pkglist.sort(PortagePackage.compare_version) # XXX: waaah ... direct package naming... =/
return pkglist
def reload_settings (self):
diff --git a/portato/backend/portage/system_22.py b/portato/backend/portage/system_22.py
new file mode 100644
index 0000000..a4ea4a0
--- /dev/null
+++ b/portato/backend/portage/system_22.py
@@ -0,0 +1,31 @@
+# -*- coding: utf-8 -*-
+#
+# File: portato/backend/portage/system_22.py
+# This file is part of the Portato-Project, a graphical portage-frontend.
+#
+# Copyright (C) 2008 René 'Necoro' Neumann
+# This is free software. You may redistribute copies of it under the terms of
+# the GNU General Public License version 2.
+# There is NO WARRANTY, to the extent permitted by law.
+#
+# Written by René 'Necoro' Neumann <necoro@necoro.net>
+
+from __future__ import absolute_import, with_statement
+
+from .package_22 import PortagePackage_22
+from .settings_22 import PortageSettings_22
+from .system import PortageSystem
+
+class PortageSystem_22 (PortageSystem):
+
+ def __init__ (self):
+ self.settings = PortageSettings_22()
+ portage.WORLD_FILE = os.path.join(self.settings.settings["ROOT"],portage.WORLD_FILE)
+
+ 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)