summaryrefslogtreecommitdiff
path: root/geneticone/backend
diff options
context:
space:
mode:
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
5 files changed, 34 insertions, 41 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."""