summaryrefslogtreecommitdiff
path: root/portato/helper.py
diff options
context:
space:
mode:
Diffstat (limited to 'portato/helper.py')
-rw-r--r--portato/helper.py31
1 files changed, 21 insertions, 10 deletions
diff --git a/portato/helper.py b/portato/helper.py
index 8a312c0..d3fc70b 100644
--- a/portato/helper.py
+++ b/portato/helper.py
@@ -3,7 +3,7 @@
# File: portato/helper.py
# This file is part of the Portato-Project, a graphical portage-frontend.
#
-# Copyright (C) 2006-2007 René 'Necoro' Neumann
+# Copyright (C) 2006-2009 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.
@@ -13,22 +13,21 @@
"""
Some nice functions used in the program.
"""
-from __future__ import absolute_import
+from __future__ import absolute_import, with_statement
import os, signal, logging, grp
-debug = logging.getLogger("portatoLogger.stream").debug
-info = logging.getLogger("portatoLogger.stream").info
-warning = logging.getLogger("portatoLogger.stream").warning
-error = logging.getLogger("portatoLogger.stream").error
-critical = logging.getLogger("portatoLogger.stream").critical
+from .log import set_log_level
+
+debug = logging.getLogger("portatoLogger").debug
+info = logging.getLogger("portatoLogger").info
+warning = logging.getLogger("portatoLogger").warning
+error = logging.getLogger("portatoLogger").error
+critical = logging.getLogger("portatoLogger").critical
def N_ (s):
return s
-def set_log_level (lvl):
- logging.getLogger("portatoLogger.stream").setLevel(lvl)
-
def send_signal_to_group (sig):
"""Sends a signal to all processes of our process group (w/o ourselves).
@@ -44,6 +43,18 @@ def send_signal_to_group (sig):
pgid = os.getpgrp()
os.killpg(pgid, sig)
+def get_runsystem ():
+ # check for sabayon first, as sabayon also has the gentoo release
+ for sp in ("/etc/sabayon-release", "/etc/sabayon-edition"):
+ if os.path.exists(sp):
+ with open(sp) as r:
+ return ("Sabayon", r.readline().strip())
+
+ if os.path.exists("/etc/gentoo-release"):
+ return ("Gentoo", "")
+
+ else: return ("Unknown", "")
+
def paren_reduce(mystr):
"""
Take a string and convert all paren enclosed entities into sublists, optionally