Beispiel #1
0
        def __init__(self, image_directory, application_path):
                global_settings.client_name = gui_misc.get_um_name()
                self.api_lock = nrlock.NRLock()
                self.image_dir_arg = image_directory
                if self.image_dir_arg == None:
                        self.image_dir_arg = gui_misc.get_image_path()
                self.application_path = application_path
                self.gconf = pmgconf.PMGConf()
                try:
                        self.application_dir = os.environ["PACKAGE_MANAGER_ROOT"]
                except KeyError:
                        self.application_dir = "/"
                misc.setlocale(locale.LC_ALL, "")
                for module in (gettext, gtk.glade):
                        module.bindtextdomain("pkg", os.path.join(
                            self.application_dir,
                            "usr/share/locale"))
                        module.textdomain("pkg")
                gui_misc.init_for_help(self.application_dir)

                self.icon_theme = gtk.icon_theme_get_default()
                pkg_icon_location = os.path.join(self.application_dir, PKG_ICON_LOCATION)
                self.icon_theme.append_search_path(pkg_icon_location)
                icon_location = os.path.join(self.application_dir, ICON_LOCATION)
                self.icon_theme.append_search_path(icon_location)
                self.progress_tracker = progress.NullProgressTracker()
                self.api_obj = None
                self.installupdate = None
                self.return_status = enumerations.UPDATES_UNDETERMINED
                self.pylintstub = None
                
                gui_misc.setup_logging()
                gobject.idle_add(self.__do_image_update)
Beispiel #2
0
    def __init__(self, image_directory, application_path, nice, check_all,
                 check_cache):
        global_settings.client_name = nongui_misc.get_um_name()
        self.api_lock = nrlock.NRLock()
        self.image_dir_arg = image_directory
        if self.image_dir_arg == None:
            self.image_dir_arg = nongui_misc.get_image_path()
        self.application_path = application_path
        self.nice = nice
        self.check_all = check_all
        self.check_cache_only = check_cache
        try:
            self.application_dir = os.environ["PACKAGE_MANAGER_ROOT"]
        except KeyError:
            self.application_dir = "/"
        misc.setlocale(locale.LC_ALL, "")

        self.progress_tracker = progress.NullProgressTracker()
        self.api_obj = None
        self.return_status = enumerations.UPDATES_UNDETERMINED
        self.pylintstub = None

        # Check Updates - by default check all
        if self.check_all:
            self.api_obj = self.__get_api_obj()
            self.__check_for_updates()
        elif self.check_cache_only:
            self.api_obj = self.__get_api_obj()
            ret = self.__check_for_updates_cache_only()
            if ret == enumerations.UPDATES_UNDETERMINED:
                self.__send_return(enumerations.UPDATES_UNDETERMINED)
Beispiel #3
0
    def __init__(self,
                 filepath,
                 set_lockstr=None,
                 get_lockstr=None,
                 failure_exc=None,
                 provide_mutex=True):
        """Create a LockFile object.  The 'filepath' argument
                should be the path to the file that will be used as the
                lockfile.  If the caller may supply the following
                optional arguments:

                set_lockstr - A function that returns a string.  This
                is called when the lock operation wants to write
                implementation specific text into the lock file.

                get_lockstr - A function that takes a string and returns
                a dictionary.  This function must be able to parse
                the lock string created by set_lockstr.  The dictionary
                object is passed as **kwargs to 'failure_exc' if
                the lock is non-blocking and fails.

                failure_exc - If a non-blocking lock acquisition fails,
                this exception will be raised.  It should allow the
                caller to specify a kwargs argument, but not all
                invocations will provide kwargs.

                provide_mutex - By default, the LockFile object
                will use a mutex to sychronize access for threads in
                the current process.  If the caller is already providing
                mutual exclusion to the LockFile object, this should
                be set to False."""

        self._fileobj = None
        self._filepath = filepath
        self._set_lockstr = set_lockstr
        self._get_lockstr = get_lockstr
        self._provide_mutex = False
        if failure_exc:
            self._failure_exc = failure_exc
        else:
            self._failure_exc = FileLocked
        if provide_mutex:
            self._lock = nrlock.NRLock()
            self._provide_mutex = True
        else:
            self._lock = DummyLock()