summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornecoro <>2006-09-29 20:20:30 +0000
committernecoro <>2006-09-29 20:20:30 +0000
commit8146fd4955dd15c51bffecc3f578e4a0d7dbb121 (patch)
treeec61f3661531a36a62f9806a13bb319432e9d9ad
parent74e6944a93674636b9ae5826a27218c30be335b5 (diff)
downloadportato-8146fd4955dd15c51bffecc3f578e4a0d7dbb121.tar.gz
portato-8146fd4955dd15c51bffecc3f578e4a0d7dbb121.tar.bz2
portato-8146fd4955dd15c51bffecc3f578e4a0d7dbb121.zip
Made structure change work
Diffstat (limited to '')
-rw-r--r--geneticone/backend/__init__.py12
-rw-r--r--geneticone/backend/exceptions.py2
-rw-r--r--geneticone/backend/flags.py31
-rw-r--r--geneticone/backend/package.py10
-rw-r--r--geneticone/backend/portage_helper.py20
-rw-r--r--geneticone/gui/gui_helper.py14
-rw-r--r--geneticone/gui/windows.py27
7 files changed, 54 insertions, 62 deletions
diff --git a/geneticone/backend/__init__.py b/geneticone/backend/__init__.py
index 2478ddf..4f00258 100644
--- a/geneticone/backend/__init__.py
+++ b/geneticone/backend/__init__.py
@@ -1,13 +1,4 @@
-#
-# File: geneticone/__init__.py
-# This file is part of the Genetic/One-Project, a graphical portage-frontend.
-#
-# Copyright (C) 2006 Necoro d.M.
-# 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 Necoro d.M. <necoro@necoro.net>
+
import sys
@@ -26,7 +17,6 @@ porttree = gentoolkit.porttree
vartree = gentoolkit.vartree
# import our packages
-from helper import *
from exceptions import *
from portage_helper import *
from package import *
diff --git a/geneticone/backend/exceptions.py b/geneticone/backend/exceptions.py
index 5780de6..6381527 100644
--- a/geneticone/backend/exceptions.py
+++ b/geneticone/backend/exceptions.py
@@ -1,5 +1,5 @@
#
-# File: geneticone/exceptions.py
+# File: geneticone/backend/exceptions.py
# This file is part of the Genetic/One-Project, a graphical portage-frontend.
#
# Copyright (C) 2006 Necoro d.M.
diff --git a/geneticone/backend/flags.py b/geneticone/backend/flags.py
index 8899fc5..214faf9 100644
--- a/geneticone/backend/flags.py
+++ b/geneticone/backend/flags.py
@@ -1,5 +1,5 @@
#
-# File: geneticone/flags.py
+# File: geneticone/backend/flags.py
# This file is part of the Genetic/One-Project, a graphical portage-frontend.
#
# Copyright (C) 2006 Necoro d.M.
@@ -13,8 +13,9 @@ import os
import os.path
from subprocess import Popen, PIPE # needed for grep
-import geneticone
-from helper import *
+from geneticone.helper import *
+import package
+
import portage
from portage_util import unique_array
@@ -30,8 +31,8 @@ def grep (pkg, path):
@returns: occurences of pkg in the format: "file:line-no:complete_line_found"
@rtype: string"""
- if not isinstance(pkg, geneticone.Package):
- pkg = geneticone.Package(pkg) # assume it is a cpv or a gentoolkit.Package
+ if not isinstance(pkg, package.Package):
+ pkg = package.Package(pkg) # assume it is a cpv or a gentoolkit.Package
command = "egrep -x -n -r -H '^[<>!=~]{0,2}%s(-[0-9].*)?[[:space:]]?.*$' %s"
return Popen((command % (pkg.get_cp(), path)), shell = True, stdout = PIPE).communicate()[0].splitlines()
@@ -99,8 +100,8 @@ def set_use_flag (pkg, flag):
global useFlags, newUseFlags
- if not isinstance(pkg, geneticone.Package):
- pkg = geneticone.Package(pkg) # assume cpv or gentoolkit.Package
+ if not isinstance(pkg, package.Package):
+ pkg = package.Package(pkg) # assume cpv or gentoolkit.Package
cpv = pkg.get_cpv()
invFlag = invert_use_flag(flag)
@@ -162,7 +163,7 @@ def remove_new_use_flags (cpv):
"""Removes all new use-flags for a specific package.
@param cpv: the package for which to remove the flags
@type cpv: string (cpv) or L{geneticone.Package}-object"""
- if isinstance(cpv, geneticone.Package):
+ if isinstance(cpv, package.Package):
cpv = cpv.get_cpv()
try:
@@ -177,7 +178,7 @@ def get_new_use_flags (cpv):
@returns: list of flags
@rtype: list"""
- if isinstance(cpv, geneticone.Package):
+ if isinstance(cpv, package.Package):
cpv = cpv.get_cpv()
list2return = []
@@ -283,8 +284,8 @@ new_unmasked = {}
def set_masked (pkg):
global new_masked, newunmasked
- if not isinstance(pkg, geneticone.Package):
- pkg = geneticone.Package(pkg)
+ if not isinstance(pkg, package.Package):
+ pkg = package.Package(pkg)
cpv = pkg.get_cpv()
@@ -327,8 +328,8 @@ def set_masked (pkg):
def set_unmasked (pkg):
global new_masked, new_unmasked
- if not isinstance(pkg, geneticone.Package):
- pkg = geneticone.Package(pkg)
+ if not isinstance(pkg, package.Package):
+ pkg = package.Package(pkg)
cpv = pkg.get_cpv()
@@ -442,8 +443,8 @@ def set_testing (pkg, enable):
@type enable: boolean"""
global arch, newTesting
- if not isinstance(pkg, geneticone.Package):
- pkg = geneticone.Package(pkg)
+ if not isinstance(pkg, package.Package):
+ pkg = package.Package(pkg)
arch = pkg.get_settings("ARCH")
cpv = pkg.get_cpv()
diff --git a/geneticone/backend/package.py b/geneticone/backend/package.py
index 73355ed..8803955 100644
--- a/geneticone/backend/package.py
+++ b/geneticone/backend/package.py
@@ -1,5 +1,5 @@
#
-# File: geneticone/package.py
+# File: geneticone/backend/package.py
# This file is part of the Genetic/One-Project, a graphical portage-frontend.
#
# Copyright (C) 2006 Necoro d.M.
@@ -9,9 +9,11 @@
#
# Written by Necoro d.M. <necoro@necoro.net>
-from geneticone import *
-from geneticone import flags
-import geneticone
+#from portage_helper import *
+#from exceptions import *
+from geneticone.backend import *
+from geneticone.helper import *
+import flags
import gentoolkit
import portage
diff --git a/geneticone/backend/portage_helper.py b/geneticone/backend/portage_helper.py
index aab9426..58f0081 100644
--- a/geneticone/backend/portage_helper.py
+++ b/geneticone/backend/portage_helper.py
@@ -1,5 +1,5 @@
#
-# File: geneticone/portage_helper.py
+# File: geneticone/backend/portage_helper.py
# This file is part of the Genetic/One-Project, a graphical portage-frontend.
#
# Copyright (C) 2006 Necoro d.M.
@@ -9,9 +9,6 @@
#
# Written by Necoro d.M. <necoro@necoro.net> et.al.
-from geneticone import *
-import geneticone
-
import re
import os
@@ -19,6 +16,9 @@ import gentoolkit
import portage
from portage_util import unique_array
+from geneticone.backend import *
+import package
+
def find_lambda (name):
"""Returns the function needed by all the find_all_*-functions. Returns None if no name is given.
@param name: name to build the function of
@@ -33,12 +33,12 @@ def find_lambda (name):
return lambda x: True
def geneticize_list (list_of_packages):
- """Convertes a list of gentoolkit.Packages into L{geneticone.Packages}.
+ """Convertes a list of gentoolkit.Packages into L{geneticone.backend.Packages}.
@param list_of_packages: the list of packages
@type list_of_packages: list of gentoolkit.Packages
@returns: converted list
- @rtype: list of geneticone.Packages"""
- return [geneticone.Package(x) for x in list_of_packages]
+ @rtype: list of geneticone.backend.Packages"""
+ return [package.Package(x) for x in list_of_packages]
def find_best_match (search_key, only_installed = False):
"""Finds the best match in the portage tree."""
@@ -48,7 +48,7 @@ def find_best_match (search_key, only_installed = False):
else:
t = vartree.dep_bestmatch(search_key)
if t:
- return geneticone.Package(t)
+ return package.Package(t)
return None
def find_packages (search_key, masked=False):
@@ -89,14 +89,14 @@ def find_all_world_files (name=None):
Returns ALL world packages if name is None."""
world = filter(find_lambda(name), [x.get_cpv() for x in find_world_packages()[0]])
world = unique_array(world)
- return [geneticone.Package(x) for x in world]
+ return [package.Package(x) for x in world]
def find_all_system_files (name=None):
"""Returns a list of all system packages matching ".*name.*".
Returns ALL system packages if name is None."""
sys = filter(find_lambda(name), [x.get_cpv() for x in find_system_packages()[0]])
sys = unique_array(sys)
- return [geneticone.Package(x) for x in sys]
+ return [package.Package(x) for x in sys]
def list_categories (name=None):
"""Returns a list of categories matching ".*name.*" or all categories."""
diff --git a/geneticone/gui/gui_helper.py b/geneticone/gui/gui_helper.py
index 7b5094e..abe5106 100644
--- a/geneticone/gui/gui_helper.py
+++ b/geneticone/gui/gui_helper.py
@@ -9,8 +9,8 @@
#
# Written by Necoro d.M. <necoro@necoro.net>
-import geneticone
-from geneticone import flags
+from geneticone import backend
+from geneticone.backend import flags
from geneticone.helper import *
from subprocess import *
@@ -60,7 +60,7 @@ class EmergeQueue:
if cpv in self.deps:
return # in list already
else:
- deps = geneticone.find_packages("="+cpv)[0].get_dep_packages()
+ deps = backend.find_packages("="+cpv)[0].get_dep_packages()
self.deps.update({cpv : deps})
subIt = self.tree.append(it, [cpv])
@@ -69,7 +69,7 @@ class EmergeQueue:
for d in deps:
try:
self.update_tree(subIt, d)
- except geneticone.BlockedException, e:
+ except backend.BlockedException, e:
# remove the project
while self.tree.iter_parent(subIt):
subIt = self.tree.iter_parent(subIt)
@@ -93,7 +93,7 @@ class EmergeQueue:
if not unmerge:
try:
# insert dependencies
- pkg = geneticone.find_packages("="+cpv)[0]
+ pkg = backend.find_packages("="+cpv)[0]
deps = pkg.get_dep_packages()
if update:
@@ -108,7 +108,7 @@ class EmergeQueue:
self.mergequeue.append(cpv)
if self.emergeIt: self.update_tree(self.emergeIt, cpv)
- except geneticone.BlockedException, e : # there is sth blocked --> call blocked_dialog
+ except backend.BlockedException, e : # there is sth blocked --> call blocked_dialog
blocks = e[0]
blocked_dialog(cpv, blocks)
return
@@ -128,7 +128,7 @@ class EmergeQueue:
if process: process.wait()
for p in packages:
try:
- cat = geneticone.split_package_name(p)[0] # get category
+ cat = backend.split_package_name(p)[0] # get category
while cat[0] in ["=",">","<","!"]:
cat = cat[1:]
del self.packages[cat]
diff --git a/geneticone/gui/windows.py b/geneticone/gui/windows.py
index 3add5da..082454b 100644
--- a/geneticone/gui/windows.py
+++ b/geneticone/gui/windows.py
@@ -21,9 +21,9 @@ pygtk.require("2.0")
import gtk
import gobject
-import geneticone
-from geneticone import flags
from geneticone.helper import *
+from geneticone import backend
+from geneticone.backend import flags
from gui_helper import *
# for the terminal
@@ -90,8 +90,8 @@ class PackageWindow:
#self.window.connect("configure-event", self.cbSizeCheck)
# packages and installed packages
- self.packages = geneticone.sort_package_list(geneticone.find_packages(cp, masked=True))
- self.instPackages = geneticone.sort_package_list(geneticone.find_installed_packages(cp, masked=True))
+ self.packages = backend.sort_package_list(backend.find_packages(cp, masked=True))
+ self.instPackages = backend.sort_package_list(backend.find_installed_packages(cp, masked=True))
# main structure - the table
self.table = gtk.Table(rows=4,columns=2)
@@ -207,7 +207,7 @@ class PackageWindow:
if self.version:
best_version = self.version
else:
- best_version = geneticone.find_best_match(self.packages[0].get_cp(), (self.instPackages != [])).get_version()
+ best_version = backend.find_best_match(self.packages[0].get_cp(), (self.instPackages != [])).get_version()
for i in range(len(self.packages)):
if self.packages[i].get_version() == best_version:
combo.set_active(i)
@@ -220,7 +220,7 @@ class PackageWindow:
return combo
def actual_package (self):
- """Returns the actual package (a geneticone.Package-object)."""
+ """Returns the actual package (a backend.Package-object)."""
return self.packages[self.vCombo.get_active()]
def cb_button_pressed (self, b, event, data = None):
@@ -251,7 +251,7 @@ class PackageWindow:
def cb_unmerge_clicked (self, button, data = None):
"""Adds the package to the UnmergeQueue."""
- if not geneticone.am_i_root():
+ if not backend.am_i_root():
errorMB = gtk.MessageDialog(self.window, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, "You cannot (un)merge without being root.")
errorMB.run()
errorMB.destroy()
@@ -289,7 +289,7 @@ class PackageWindow:
enabled = True
else:
enabled = False
- store.append([enabled, use, geneticone.get_use_desc(use, self.cp)])
+ store.append([enabled, use, backend.get_use_desc(use, self.cp)])
# build view
view = gtk.TreeView(store)
@@ -506,7 +506,7 @@ class MainWindow:
elif view == self.emergeView:
if len(path) > 1:
package = store.get_value(store.get_iter(path), 0)
- cat, name, vers, rev = geneticone.split_package_name(package)
+ cat, name, vers, rev = backend.split_package_name(package)
if rev != "r0": vers = vers+"-"+rev
PackageWindow(self.window, cat+"/"+name, queue = self.queue, version = vers, delOnClose = False, doEmerge = False)
return True
@@ -516,7 +516,7 @@ class MainWindow:
store = gtk.ListStore(str)
# build categories
- for p in geneticone.list_categories():
+ for p in backend.list_categories():
store.append([p])
# sort them alphabetically
store.set_sort_column_id(0, gtk.SORT_ASCENDING)
@@ -541,8 +541,8 @@ class MainWindow:
if name:
if name not in self.packages and not force: # only calc packages if not already done
self.packages[name] = []
- for p in unique_array([x.get_name() for x in geneticone.find_all_packages(name+"/")]):
- if geneticone.find_installed_packages(name+"/"+p, masked=True) != []:
+ for p in unique_array([x.get_name() for x in backend.find_all_packages(name+"/")]):
+ if backend.find_installed_packages(name+"/"+p, masked=True) != []:
p += "*" # append a '*' if the package is installed
self.packages[name].append(p)
@@ -585,7 +585,6 @@ class MainWindow:
def cb_emerge_clicked (self, button, data = None):
"""Do emerge or unemerge."""
- debug(button)
if button == self.emergeBtn or button == MENU_EMERGE:
if len(flags.newUseFlags) > 0:
hintMB = gtk.MessageDialog(self.window, gtk.DIALOG_MODAL, gtk.MESSAGE_INFO, gtk.BUTTONS_OK,
@@ -602,7 +601,7 @@ class MainWindow:
def cb_search_clicked (self, button, data = None):
"""Do a search."""
if self.searchEntry.get_text() != "":
- packages = geneticone.find_all_packages(self.searchEntry.get_text())
+ packages = backend.find_all_packages(self.searchEntry.get_text())
if packages == []:
dialog = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_INFO, gtk.BUTTONS_OK, "Package not found!")