Debian Codegraph @

installer-test

raw symbols SCIP
1 #!/usr/bin/env python3
2
3 import gi
4 gi.require_version('CinnamonDesktop', '3.0')
5 from gi.repository import CinnamonDesktop, GLib, GObject
6 import sys
7
8
9 def install_finished_cb(success, data=None):
10 if success:
11 print("Install Finished!")
12 else:
13 print("Install Failed!")
14 quit()
15
16 def check_finished_cb(success, data=None):
17 if success:
18 print("Packages already installed!")
19 else:
20 print("Some packages missing!")
21 quit()
22
23 def working_cb():
24 print("working...")
25 return True
26
27 if (len(sys.argv) < 3 or sys.argv[1] not in ("install", "check")):
28 print ("""
29
30 Usage:
31 installer-test install|check package_1 [package_2 ...]
32
33 """)
34 quit()
35
36 i = 2
37 pkgs = []
38
39 while i < len(sys.argv):
40 pkgs.append(sys.argv[i])
41 i+=1
42 print( "Working with packages: %s" % pkgs )
43
44 # Testing non-blocking-ness of the installer
45 GObject.timeout_add(250, working_cb)
46
47
48 if (sys.argv[1] == "install"):
49 CinnamonDesktop.installer_install_packages(pkgs, install_finished_cb, None)
50 else:
51 CinnamonDesktop.installer_check_for_packages(pkgs, check_finished_cb, None)
52
53
54 ml = GLib.MainLoop.new(None, True)
55 ml.run()