Example #1
0
	def print_helper(self, app, args):
		if app.instances:
			manager = System.package_manager()
			package = manager.provided_by(app)
			if package:
				package.load_info(System.package_manager())

			tr = Tracer(System.package_manager(), Rules, Applications)
			tr.now = self.args.now
			if self.packages:
				tr.specified_packages = self.packages

			try: affected_by = tr.trace_application(app)
			except AccessDenied: affected_by = _("You don't have enough permissions")
			affects = self._affects(app, affected_by)

			view = HelperView()
			view.assign("args", args)
			view.assign("processes", app.instances)
			view.assign("application", app)
			view.assign("package", package)
			view.assign("affected_by", affected_by)
			view.assign("affects", affects)
			view.render()
		else:
			print(_("Application called {0} is not running").format(app.name))
Example #2
0
	def print_helper(self, app_name, args):
		processes = Applications.find(app_name).instances
		if processes:
			manager = System.package_manager()
			package = manager.provided_by(app_name)
			if package:
				package.load_info(System.package_manager())

			tr = Tracer(System.package_manager(), Rules, Applications)
			tr.now = self.args.now
			if self.packages:
				tr.specified_packages = self.packages

			try: affected_by = tr.trace_application(app_name)
			except AccessDenied: affected_by = _("You don't have enough permissions")

			app = Applications.find(app_name)
			affects = self._affects(app, affected_by)

			view = HelperView()
			view.assign("args", args)
			view.assign("processes", processes)
			view.assign("application", app)
			view.assign("package", package)
			view.assign("affected_by", affected_by)
			view.assign("affects", affects)
			view.render()
		else:
			print(_("Application called {0} is not running").format(app_name))
Example #3
0
	def render_packages(self):
		timestamp = self.args.timestamp[0] if self.args.timestamp[0] else System.boot_time()
		manager = System.package_manager()
		packages = manager.packages_newer_than(timestamp)

		view = PackagesView()
		view.assign('packages', packages)
		view.assign('boot_time', System.boot_time())
		view.render()
Example #4
0
    def render_packages(self):
        timestamp = self.args.timestamp[0] if self.args.timestamp[
            0] else System.boot_time()
        manager = System.package_manager()
        packages = manager.packages_newer_than(timestamp)

        view = PackagesView()
        view.assign('packages', packages)
        view.assign('boot_time', System.boot_time())
        view.render()
Example #5
0
	def _helper(app):
		if app.type == Applications.TYPES["DAEMON"]:
			if System.init_system() == "systemd" and System.distribution() == "arch":
				return "systemctl restart {0}".format(app.name)
			else:
				return "service {0} restart".format(app.name)

		elif app.type == Applications.TYPES["STATIC"]:
			return _("You will have to reboot your computer")

		elif app.type == Applications.TYPES["SESSION"]:
			return _("You will have to log out & log in again")

		return None
Example #6
0
 def helper(self):
     helper = self._attributes["helper"] if self._attributes[
         "helper"] else Applications._helper(self)
     if System.user(
     ) != "root" and self.type == Applications.TYPES["DAEMON"]:
         if helper and not helper.startswith("sudo "):
             helper = "sudo " + helper
     return helper
Example #7
0
    def _modified_packages(self):
        """Returns list of packages what tracer should care about"""
        if self.specified_packages and self.now:
            return PackagesCollection(self.specified_packages)

        timestamp = self.timestamp if self.timestamp else System.boot_time()
        packages = self._PACKAGE_MANAGER.packages_newer_than(timestamp)
        packages = packages.intersection(self.specified_packages)
        return packages
Example #8
0
	def _modified_packages(self):
		"""Returns list of packages what tracer should care about"""
		if self.specified_packages and self.now:
			return PackagesCollection(self.specified_packages)

		timestamp = self.timestamp if self.timestamp else System.boot_time()
		packages = self._PACKAGE_MANAGER.packages_newer_than(timestamp)
		packages = packages.intersection(self.specified_packages)
		return packages
Example #9
0
	def __init__(self, package_manager, rules, applications, memory=None, hooks_observer=None, erased=False):
		if not package_manager:
			raise UnsupportedDistribution(System.distribution())

		self._PACKAGE_MANAGER = package_manager
		self._rules = rules
		self._applications = applications
		self._memory = memory
		self._hooks_observer = hooks_observer
		self._erased = erased
Example #10
0
	def __init__(self, package_manager, rules, applications, memory=None, hooks_observer=None, erased=False):
		if not package_manager:
			raise UnsupportedDistribution(System.distribution())

		self._PACKAGE_MANAGER = package_manager
		self._rules = rules
		self._applications = applications
		self._memory = memory
		self._hooks_observer = hooks_observer
		self._erased = erased
Example #11
0
	def name(self):
		if System.init_system() == "systemd":
			bus = SystemdDbus()
			if self.instances and bus.unit_path_from_pid(self.instances[0].pid):
				if not bus.has_service_property_from_pid(self.instances[0].pid,'PAMName'):
					Id = bus.get_unit_property_from_pid(self.instances[0].pid,'Id')
					if Id and re.search("\.service$", Id):
						return re.sub('\.service$', '', Id)
		if self.is_interpreted:
			return self.instances[0].real_name
		return self._attributes["name"]
Example #12
0
    def __init__(self, args, packages):
        self.args = args
        self.tracer = Tracer(System.package_manager(erased=args.erased),
                             Rules,
                             Applications,
                             memory=dump_memory,
                             hooks_observer=HooksObserver(),
                             erased=args.erased)
        self.tracer.now = args.now
        self.tracer.timestamp = args.timestamp[0]
        if packages:
            self.tracer.specified_packages = packages

        self.applications = self.tracer.trace_affected(self._user(args.user))
        if self.args.daemons_only:
            self.applications = self.applications.filter_types(
                [Applications.TYPES["DAEMON"]])
Example #13
0
	def __init__(self, args, packages):
		self.args = args
		self.tracer = Tracer(
			System.package_manager(erased=args.erased),
			Rules,
			Applications,
			memory=dump_memory,
			hooks_observer=HooksObserver(),
			erased=args.erased
		)
		self.tracer.now = args.now
		self.tracer.timestamp = args.timestamp[0]
		if packages:
			self.tracer.specified_packages = packages

		self.applications = self.tracer.trace_affected(self._user(args.user))
		if self.args.daemons_only:
			self.applications = self.applications.filter_types([Applications.TYPES["DAEMON"]])
Example #14
0
    def __init__(self, args, call_helper=None):
        #TODO filter blacklisted packages from restart

        tracer = Tracer(System.package_manager(erased=args.erased),
                        Rules,
                        Applications,
                        memory=dump_memory,
                        erased=args.erased)

        daemons = tracer.trace_affected(user="******").filter_types(
            [Applications.TYPES["DAEMON"]])

        if call_helper is None:
            call_helper = RestartController._call_helper
        else:
            call_helper = call_helper
        self.restarted_daemons = RestartController.restart_daemons(
            daemons, call_helper)
Example #15
0
	def __init__(self, args, call_helper=None):
		#TODO filter blacklisted packages from restart

		tracer = Tracer(
			System.package_manager(erased=args.erased),
			Rules,
			Applications,
			memory=dump_memory,
			erased=args.erased
		)

		daemons = tracer.trace_affected(user="******").filter_types([Applications.TYPES["DAEMON"]])

		if call_helper is None:
			call_helper = RestartController._call_helper
		else:
			call_helper = call_helper
		self.restarted_daemons = RestartController.restart_daemons(daemons, call_helper)
Example #16
0
    def render_system(self):
        uptime = datetime.now() - datetime.fromtimestamp(System.boot_time())
        uptime = str(uptime).split('.')[0]

        users = set([user.name for user in psutil.get_users()])
        package_managers = System.package_manager().names()

        view = SystemView()
        view.assign('python', System.python_version())
        view.assign('distribution', System.distribution())
        view.assign('package_managers', package_managers)
        view.assign('init', System.init_system())
        view.assign('uptime', uptime)
        view.assign('user', System.user())
        view.assign('users', users)
        view.assign('version', __version__)
        view.assign('rules_count', len(Rules.all()))
        view.assign('applications_count', len(Applications.all()))
        view.render()
Example #17
0
	def render_system(self):
		uptime = datetime.now() - datetime.fromtimestamp(System.boot_time())
		uptime = str(uptime).split('.')[0]

		users = set([user.name for user in psutil.get_users()])
		package_managers = System.package_manager().names()

		view = SystemView()
		view.assign('python', System.python_version())
		view.assign('distribution', System.distribution())
		view.assign('package_managers', package_managers)
		view.assign('init', System.init_system())
		view.assign('uptime', uptime)
		view.assign('user', System.user())
		view.assign('users', users)
		view.assign('version', __version__)
		view.assign('rules_count', len(Rules.all()))
		view.assign('applications_count', len(Applications.all()))
		view.render()
Example #18
0
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY expressed or implied, including the implied warranties of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
# Public License for more details.  You should have received a copy of the
# GNU General Public License along with this program; if not, write to the
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#

from __future__ import absolute_import

from tracer.resources.system import System
if System.distribution() in ["fedora", "mageia"]:

    import subprocess
    from tracer.packageManagers.rpm import Rpm

    class Dnf(Rpm):
        @property
        def history_path(self):
            return '/var/lib/dnf/history/'

        def package_files(self, pkg_name):
            if self._is_installed(pkg_name):
                return super(Dnf, self).package_files(pkg_name)

            if "erased" not in self.opts or not self.opts["erased"]:
                return []
Example #19
0
#-*- coding: utf-8 -*-
# yum.py
# Module to work with YUM package manager class
#
# Copyright (C) 2013 Jakub Kadlčík
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY expressed or implied, including the implied warranties of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
# Public License for more details.  You should have received a copy of the
# GNU General Public License along with this program; if not, write to the
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#

from __future__ import absolute_import


from tracer.resources.system import System
if System.distribution() in ["fedora", "centos"]:

	from tracer.packageManagers.rpm import Rpm

	class Yum(Rpm):

		@property
		def history_path(self): return '/var/lib/yum/history/'
Example #20
0
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY expressed or implied, including the implied warranties of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
# Public License for more details.  You should have received a copy of the
# GNU General Public License along with this program; if not, write to the
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#

from __future__ import absolute_import

from tracer.resources.system import System
if System.distribution() in ["arch", "archarm"]:

    import bisect
    from .ipackageManager import IPackageManager
    from tracer.resources.package import Package
    from tracer.resources.collections import PackagesCollection
    from tracer.resources.applications import Applications
    import pyalpm

    class Alpm(IPackageManager):
        def __init__(self, *args, **kwargs):
            self.opts = kwargs
            self.handle = pyalpm.Handle('/', '/var/lib/pacman')
            self.db = self.handle.get_localdb()

        def packages_newer_than(self, unix_time):
Example #21
0
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY expressed or implied, including the implied warranties of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
# Public License for more details.  You should have received a copy of the
# GNU General Public License along with this program; if not, write to the
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#

from __future__ import absolute_import
from __future__ import unicode_literals

from tracer.resources.system import System
if System.distribution() == "gentoo":

    from .ipackageManager import IPackageManager
    from tracer.resources.package import Package
    from tracer.resources.collections import PackagesCollection
    from gentoolkit.helpers import FileOwner
    from tracer.resources.exceptions import DatabasePermissions
    from tracer.resources.applications import Applications
    import os
    import portage
    import subprocess
    import time

    class Portage(IPackageManager):
        """
		Package manager class - Portage
Example #22
0
	def _user(self, user):
		if   user == '*':    return None
		elif user == 'root': return user
		elif not user:       return System.user()
		else: return user[0]
Example #23
0
 def is_service(self):
     if System.init_system() == "systemd":
         return SystemdDbus().unit_path_from_id("{0}.service".format(
             self.name))
Example #24
0
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY expressed or implied, including the implied warranties of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
# Public License for more details.  You should have received a copy of the
# GNU General Public License along with this program; if not, write to the
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#

from __future__ import absolute_import

from tracer.resources.system import System
if System.distribution() in ["arch"]:

	import bisect
	from .ipackageManager import IPackageManager
	from tracer.resources.package import Package
	from tracer.resources.collections import PackagesCollection
	from tracer.resources.applications import Applications
	import pyalpm

	class Alpm(IPackageManager):

		def __init__(self, *args, **kwargs):
			self.opts = kwargs
			self.handle = pyalpm.Handle('/', '/var/lib/pacman')
			self.db = self.handle.get_localdb()
Example #25
0
#-*- coding: utf-8 -*-
# yum.py
# Module to work with YUM package manager class
#
# Copyright (C) 2013 Jakub Kadlčík
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY expressed or implied, including the implied warranties of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
# Public License for more details.  You should have received a copy of the
# GNU General Public License along with this program; if not, write to the
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#

from __future__ import absolute_import

from tracer.resources.system import System
if System.distribution() in ["fedora", "centos"]:

    from tracer.packageManagers.rpm import Rpm

    class Yum(Rpm):
        @property
        def history_path(self):
            return '/var/lib/yum/history/'
Example #26
0
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY expressed or implied, including the implied warranties of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
# Public License for more details.  You should have received a copy of the
# GNU General Public License along with this program; if not, write to the
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#

from __future__ import absolute_import

from tracer.resources.system import System
if System.distribution() in ["arch", "archarm"]:

	import bisect
	from .ipackageManager import IPackageManager
	from tracer.resources.package import Package
	from tracer.resources.collections import PackagesCollection
	from tracer.resources.applications import Applications
	import pyalpm

	class Alpm(IPackageManager):

		def __init__(self, *args, **kwargs):
			self.opts = kwargs
			self.handle = pyalpm.Handle('/', '/var/lib/pacman')
			self.db = self.handle.get_localdb()
Example #27
0
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY expressed or implied, including the implied warranties of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
# Public License for more details.  You should have received a copy of the
# GNU General Public License along with this program; if not, write to the
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#

from __future__ import absolute_import
from __future__ import unicode_literals


from tracer.resources.system import System
if System.distribution() == "gentoo":

	from .ipackageManager import IPackageManager
	from tracer.resources.package import Package
	from tracer.resources.collections import PackagesCollection
	from gentoolkit.helpers import FileOwner
	from tracer.resources.exceptions import DatabasePermissions
	from tracer.resources.applications import Applications
	import os
	import portage
	import subprocess
	import time

	class Portage(IPackageManager):

		"""
Example #28
0
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY expressed or implied, including the implied warranties of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
# Public License for more details.  You should have received a copy of the
# GNU General Public License along with this program; if not, write to the
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#

from __future__ import absolute_import

from tracer.resources.system import System
if System.distribution() == "debian":

    from .ipackageManager import IPackageManager
    from tracer.resources.package import Package
    from tracer.resources.collections import PackagesCollection
    import subprocess
    import time
    import os

    class Dpkg(IPackageManager):
        """
		Package manager class - DPKG
		"""

        # noinspection PyMissingConstructor
        def __init__(self, **kwargs):
Example #29
0
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY expressed or implied, including the implied warranties of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
# Public License for more details.  You should have received a copy of the
# GNU General Public License along with this program; if not, write to the
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#

from __future__ import absolute_import


from tracer.resources.system import System
if System.distribution() == "debian":

	from .ipackageManager import IPackageManager
	from tracer.resources.package import Package
	from tracer.resources.collections import PackagesCollection
	import subprocess
	import time
	import os

	class Dpkg(IPackageManager):

		"""
		Package manager class - DPKG
		"""

		# noinspection PyMissingConstructor
Example #30
0
# Enable importing modules from parent directory (tracer's root directory)
import os
parentdir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
os.sys.path.insert(0, parentdir)

import sys
import platform
import unittest
from tracer.resources.system import System

DISTRO = System.distribution()
Example #31
0
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY expressed or implied, including the implied warranties of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
# Public License for more details.  You should have received a copy of the
# GNU General Public License along with this program; if not, write to the
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#

from __future__ import absolute_import


from tracer.resources.system import System
if System.distribution() in ["fedora", "rhel", "centos", "mageia", "ol"]:

	from os import listdir
	from .ipackageManager import IPackageManager
	from tracer.resources.package import Package
	from tracer.resources.collections import PackagesCollection
	from tracer.resources.exceptions import LockedDatabase, DatabasePermissions
	from tracer.resources.applications import Applications
	import sqlite3
	import rpm
	import os

	class Rpm(IPackageManager):

		"""
		Package manager class - RPM
Example #32
0
	def __init__(self, tracer=Tracer):
		self._tracer = tracer(System.package_manager(), Rules, Applications, dump_memory)
Example #33
0
			return path
	return paths[0]


PROJECT_DIR = dirname(dirname(realpath(__file__)))

DATA_DIR = __([
	PROJECT_DIR + '/' + 'data',
	'/usr/share/tracer',
])

USER_CONFIG_DIRS = [
	'/etc/tracer',
]

HOOKS_DIRS = [
	'/etc/tracer/hooks',
]

LANG_DIR = __([
	PROJECT_DIR + '/build/' + 'locale',
	'/usr/share/locale',
])

try:
	user = System.user()
	USER_CONFIG_DIRS.append(expanduser('~' + user) + '/.config/tracer')
	HOOKS_DIRS.append(expanduser('~' + user) + '/.config/tracer/hooks')
except OSError:
	pass
Example #34
0
	def is_service(self):
		if System.init_system() == "systemd":
			return SystemdDbus().unit_path_from_id("{0}.service".format(self.name))
Example #35
0
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY expressed or implied, including the implied warranties of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
# Public License for more details.  You should have received a copy of the
# GNU General Public License along with this program; if not, write to the
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#

from __future__ import absolute_import


from tracer.resources.system import System
if System.distribution() in ["fedora", "rhel", "centos", "mageia", "ol"]:

	from os import listdir
	from .ipackageManager import IPackageManager
	from tracer.resources.package import Package
	from tracer.resources.collections import PackagesCollection
	from tracer.resources.exceptions import LockedDatabase, DatabasePermissions
	from tracer.resources.applications import Applications
	import sqlite3
	import rpm
	import os

	class Rpm(IPackageManager):

		"""
		Package manager class - RPM
Example #36
0
	def __init__(self, tracer=Tracer):
		self._tracer = tracer(System.package_manager(), Rules, Applications, dump_memory)
Example #37
0
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY expressed or implied, including the implied warranties of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
# Public License for more details.  You should have received a copy of the
# GNU General Public License along with this program; if not, write to the
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#

from __future__ import absolute_import

import os.path

from tracer.resources.system import System
if System.distribution() in ["fedora", "mageia"]:

	import subprocess
	from tracer.packageManagers.rpm import Rpm

	class Dnf(Rpm):

		def __init__(self, **kwargs):
			super(Dnf, self).__init__(**kwargs)
			if os.path.exists('/var/lib/dnf/history.sqlite'):
				self.opts['modern_swdb'] = True

		@property
		def history_path(self):
			if self.opts.get('modern_swdb'):
				return '/var/lib/dnf/history.sqlite'
Example #38
0
	def helper(self):
		helper = self._attributes["helper"] if self._attributes["helper"] else Applications._helper(self)
		if System.user() != "root" and self.type == Applications.TYPES["DAEMON"]:
			if helper and not helper.startswith("sudo "):
				helper = "sudo " + helper
		return helper
Example #39
0
            return path
    return paths[0]


PROJECT_DIR = dirname(dirname(realpath(__file__)))

DATA_DIR = __([
    PROJECT_DIR + '/' + 'data',
    '/usr/share/tracer',
])

USER_CONFIG_DIRS = [
    '/etc/tracer',
]

HOOKS_DIRS = [
    '/etc/tracer/hooks',
]

LANG_DIR = __([
    PROJECT_DIR + '/build/' + 'locale',
    '/usr/share/locale',
])

try:
    user = System.user()
    USER_CONFIG_DIRS.append(expanduser('~' + user) + '/.config/tracer')
    HOOKS_DIRS.append(expanduser('~' + user) + '/.config/tracer/hooks')
except OSError:
    pass