This file is indexed.

/usr/lib/python3/dist-packages/AptUrl/gtk/backend/InstallBackendAptdaemon.py is in apturl 0.5.2ubuntu14.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# (c) 2005-2009 Canonical, GPL

from aptdaemon import client, errors
from defer import inline_callbacks
from aptdaemon.gtk3widgets import AptProgressDialog
from aptdaemon.enums import EXIT_SUCCESS

from UpdateManager.backend import InstallBackend
from UpdateManager.UnitySupport import UnitySupport

import apt_pkg
import dbus

class InstallBackendAptdaemon(InstallBackend):

    """Makes use of aptdaemon to refresh the cache and to install updates."""

    def __init__(self, window_main):
        # Pass None for datadir because of LP: #1026257
        InstallBackend.__init__(self, window_main, self.ACTION_INSTALL)
        self.client = client.AptClient()
        self.unity = UnitySupport()

    @inline_callbacks
    def update(self):
        """Refresh the package list"""
        try:
            apt_pkg.pkgsystem_unlock()
        except SystemError:
            pass
        try:
            trans = yield self.client.update_cache(defer=True)
            yield self._run_in_dialog(trans, self.ACTION_UPDATE)
        except errors.NotAuthorizedError as e:
            self._action_done(self.ACTION_UPDATE, False, False, str(e), None)
        except:
            self.action_done(self.ACTION_UPDATE, True, False, None, None)
            raise

    @inline_callbacks
    def commit(self, pkgs_install, pkgs_upgrade, close_on_done):
        """Commit a list of package adds and removes"""
        try:
            apt_pkg.pkgsystem_unlock()
        except SystemError:
            pass
        try:
            reinstall = remove = purge = downgrade = []
            trans = yield self.client.commit_packages(
                pkgs_install, reinstall, remove, purge, pkgs_upgrade, 
                downgrade, defer=True)
            trans.connect("progress-changed", self._on_progress_changed)
            yield self._run_in_dialog(trans, self.ACTION_INSTALL)
        except errors.NotAuthorizedError as e:
            self._action_done(self.ACTION_INSTALL, False, False, str(e), None)
        except dbus.DBusException as e:
            if e.get_dbus_name() != "org.freedesktop.DBus.Error.NoReply":
                raise
            self._action_done(self.ACTION_INSTALL, False, False, None, None)
        except Exception as e:
            self._action_done(self.ACTION_INSTALL, True, False, None, None)
            raise

    def _on_progress_changed(self, trans, progress):
        #print("_on_progress_changed", progress)
        self.unity.set_progress(progress)

    @inline_callbacks
    def _run_in_dialog(self, trans, action):
        dia = AptProgressDialog(trans, parent=self.window_main)
        dia.set_icon_name("update-manager")
        dia.connect("finished", self._on_finished, action)
        yield dia.run()

    def _on_finished(self, dialog, action):
        dialog.hide()
        # tell unity to hide the progress again
        self.unity.set_progress(-1)
        self._action_done(action, 
                  True, dialog._transaction.exit == EXIT_SUCCESS, None, None)

if __name__ == "__main__":
    b = InstallBackendAptdaemon(None)
    b.commit(["2vcard"], [], False)

    from gi.repository import Gtk
    Gtk.main()