From 2f092ea9dbe46d1bebe1576cd7626bf325fe82e5 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Tue, 10 Jun 2014 15:22:56 -0500 Subject: Install missing stuff into /usr/local/sbin. Closes: #$741 --- src/leap/bitmask/util/__init__.py | 19 +++++++++++++++++++ src/leap/bitmask/util/privilege_policies.py | 10 ++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) (limited to 'src/leap/bitmask/util') diff --git a/src/leap/bitmask/util/__init__.py b/src/leap/bitmask/util/__init__.py index c35be99e..25b86874 100644 --- a/src/leap/bitmask/util/__init__.py +++ b/src/leap/bitmask/util/__init__.py @@ -110,3 +110,22 @@ def make_address(user, provider): :type provider: basestring """ return "%s@%s" % (user, provider) + + +def force_eval(items): + """ + Return a sequence that evaluates any callable in the sequence, + instantiating it beforehand if the item is a class, and + leaves the non-callable items without change. + """ + def do_eval(thing): + if isinstance(thing, type): + return thing()() + if callable(thing): + return thing() + return thing + + if isinstance(items, (list, tuple)): + return map(do_eval, items) + else: + return do_eval(items) diff --git a/src/leap/bitmask/util/privilege_policies.py b/src/leap/bitmask/util/privilege_policies.py index 9d1e2c9a..adc3503f 100644 --- a/src/leap/bitmask/util/privilege_policies.py +++ b/src/leap/bitmask/util/privilege_policies.py @@ -24,6 +24,8 @@ import platform from abc import ABCMeta, abstractmethod +from leap.bitmask.config import flags + logger = logging.getLogger(__name__) @@ -71,6 +73,8 @@ class LinuxPolicyChecker(PolicyChecker): """ LINUX_POLKIT_FILE = ("/usr/share/polkit-1/actions/" "se.leap.bitmask.policy") + LINUX_POLKIT_FILE_BUNDLE = ("/usr/share/polkit-1/actions/" + "se.leap.bitmask.bundle.policy") @classmethod def get_polkit_path(self): @@ -79,7 +83,8 @@ class LinuxPolicyChecker(PolicyChecker): :rtype: str """ - return self.LINUX_POLKIT_FILE + return (self.LINUX_POLKIT_FILE_BUNDLE if flags.STANDALONE + else self.LINUX_POLKIT_FILE) def is_missing_policy_permissions(self): # FIXME this name is quite confusing, it does not have anything to do with @@ -90,4 +95,5 @@ class LinuxPolicyChecker(PolicyChecker): :rtype: bool """ - return not os.path.isfile(self.LINUX_POLKIT_FILE) + path = self.get_polkit_path() + return not os.path.isfile(path) -- cgit v1.2.3 From 66183a1b24797b8aabc86053505d5fd115ffd988 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Fri, 13 Jun 2014 13:22:34 -0500 Subject: remove unneeded exec bit --- src/leap/bitmask/util/pastebin.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 src/leap/bitmask/util/pastebin.py (limited to 'src/leap/bitmask/util') diff --git a/src/leap/bitmask/util/pastebin.py b/src/leap/bitmask/util/pastebin.py old mode 100755 new mode 100644 -- cgit v1.2.3 From 771d6eecb83dded2301983f2fc1025b4bc1ea45a Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Mon, 9 Jun 2014 12:41:58 -0300 Subject: Use a better naming for argparse helper. --- src/leap/bitmask/util/leap_argparse.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/leap/bitmask/util') diff --git a/src/leap/bitmask/util/leap_argparse.py b/src/leap/bitmask/util/leap_argparse.py index 84af4e8d..0717aea5 100644 --- a/src/leap/bitmask/util/leap_argparse.py +++ b/src/leap/bitmask/util/leap_argparse.py @@ -123,7 +123,13 @@ def build_parser(): return parser -def init_leapc_args(): +def get_options(): + """ + Get the command line options used when the app was started. + + :return: the command options + :rtype: argparse.Namespace + """ parser = build_parser() opts, unknown = parser.parse_known_args() - return parser, opts + return opts -- cgit v1.2.3