~ubuntu-branches/ubuntu/wily/bleachbit/wily

« back to all changes in this revision

Viewing changes to bleachbit/Update.py

  • Committer: Package Import Robot
  • Author(s): Luca Falavigna
  • Date: 2013-05-05 14:34:45 UTC
  • mfrom: (28.1.2 experimental)
  • Revision ID: package-import@ubuntu.com-20130505143445-jjx0zylbgfp1mlty
Tags: 0.9.5-2
Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# vim: ts=4:sw=4:expandtab
2
2
 
3
3
## BleachBit
4
 
## Copyright (C) 2012 Andrew Ziem
 
4
## Copyright (C) 2013 Andrew Ziem
5
5
## http://bleachbit.sourceforge.net
6
6
##
7
7
## This program is free software: you can redistribute it and/or modify
24
24
"""
25
25
 
26
26
 
27
 
import gtk
28
27
import hashlib
29
28
import os
30
29
import os.path
37
36
 
38
37
import Common
39
38
from Common import _
40
 
from GuiBasic import open_url
41
39
 
42
40
 
43
41
def update_winapp2(url, hash_expected, append_text):
56
54
        delete_current = True
57
55
    # download update
58
56
    opener = urllib2.build_opener()
59
 
    opener.addheaders =[('User-Agent', user_agent())]
 
57
    opener.addheaders = [('User-Agent', user_agent())]
60
58
    doc = opener.open(url).read()
61
59
    # verify hash
62
60
    hash_actual = hashlib.sha512(doc).hexdigest()
83
81
        # misleading: Python 2.5.4 shows uname()[2] as Vista on Windows 7
84
82
        __os = platform.uname()[3][0:3] # 5.1 = Windows XP, 6.0 = Vista, 6.1 = 7
85
83
    elif sys.platform.startswith('linux'):
86
 
        dist = platform.dist() 
 
84
        dist = platform.dist()
87
85
        # example: ('fedora', '11', 'Leonidas')
88
86
        # example: ('', '', '') for Arch Linux
89
87
        if 0 < len(dist[0]):
108
106
 
109
107
def update_dialog(parent, updates):
110
108
    """Updates contains the version numbers and URLs"""
 
109
    import gtk
 
110
    from GuiBasic import open_url
111
111
    dlg = gtk.Dialog(title = _("Update BleachBit"), \
112
112
        parent = parent, \
113
113
        flags = gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT)