~xubuntu-dev/ubiquity/lp1437180_feh

« back to all changes in this revision

Viewing changes to bin/oem-config-remove-gtk

  • Committer: Colin Watson
  • Date: 2012-07-16 14:29:13 UTC
  • Revision ID: cjwatson@canonical.com-20120716142913-hh1qmfjejxa9dfyb
Make all Python code pass pep8(1), and add a test to enforce this.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
# GNU General Public License for more details.
19
19
#
20
20
# You should have received a copy of the GNU General Public License along
21
 
# with this application; if not, write to the Free Software Foundation, Inc., 51
22
 
# Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
23
 
################################################################################
 
21
# with this application; if not, write to the Free Software Foundation, Inc.,
 
22
# 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
24
23
 
25
24
import os
26
25
import sys
32
31
 
33
32
loop = GObject.MainLoop()
34
33
 
 
34
 
35
35
def _on_failure(error):
36
36
    dia = Gtk.MessageDialog(type=Gtk.MessageType.ERROR,
37
37
                            buttons=Gtk.ButtonsType.CLOSE,
41
41
    loop.quit()
42
42
    sys.exit(1)
43
43
 
 
44
 
44
45
def _on_finished(dia):
45
46
    loop.quit()
46
47
    if dia._transaction.exit == enums.EXIT_SUCCESS:
48
49
    else:
49
50
        sys.exit(1)
50
51
 
 
52
 
51
53
def _on_transaction(trans):
52
54
    apt_dialog = AptProgressDialog(trans)
53
55
    theme = Gtk.IconTheme.get_default()
56
58
    apt_dialog.run()
57
59
    apt_dialog.connect("finished", _on_finished)
58
60
 
 
61
 
59
62
def using_cryptsetup():
60
63
    if os.path.exists("/home/.ecryptfs"):
61
64
        return True
70
73
 
71
74
    return False
72
75
 
 
76
 
73
77
def main():
74
78
    purge = []
75
79
    for pkg in ('ubiquity', 'ubiquity-casper',
82
86
        purge.append("cryptsetup")
83
87
 
84
88
    ac = client.AptClient()
85
 
    ac.commit_packages(install=[], reinstall=[], remove=[], purge=purge, upgrade=[],
86
 
                       downgrade=[],
87
 
                       error_handler=_on_failure,
88
 
                       reply_handler=_on_transaction)
 
89
    ac.commit_packages(
 
90
        install=[], reinstall=[], remove=[], purge=purge, upgrade=[],
 
91
        downgrade=[], error_handler=_on_failure, reply_handler=_on_transaction)
89
92
    loop.run()
90
93
 
 
94
 
91
95
if __name__ == "__main__":
92
96
    main()