~mvo/update-manager/not-automatic

« back to all changes in this revision

Viewing changes to update-manager-hildon

  • Committer: Michael Vogt
  • Date: 2008-05-21 16:01:17 UTC
  • mfrom: (952.1.10 hildon)
  • Revision ID: michael.vogt@ubuntu.com-20080521160117-lom591v3zpyk53yt
* UpdateManagerHildon/UpdateManagerHildon.py:
  - add hildon support (thanks to Tollef Fog Heen and
    Emmet Hikory)
  - make networkless upgrades more robust (LP: #227197)
* DistUpgrade/DistUpgradeViewGtk.py:
  - work around hang in svg loader (LP: #186465)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python
 
2
# update-manager.in - easy updating application
 
3
#  
 
4
#  Copyright (c) 2004-2008 Canonical
 
5
#                2004-2008 Michael Vogt
 
6
#                2004 Michiel Sikkes
 
7
#  
 
8
#  Author: Tollef Fog Heen <tfheen@err.no>
 
9
#          Michiel Sikkes <michiel@eyesopened.nl>
 
10
#          Michael Vogt <mvo@debian.org>
 
11
 
12
#  This program is free software; you can redistribute it and/or 
 
13
#  modify it under the terms of the GNU General Public License as 
 
14
#  published by the Free Software Foundation; either version 2 of the
 
15
#  License, or (at your option) any later version.
 
16
 
17
#  This program is distributed in the hope that it will be useful,
 
18
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
19
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
20
#  GNU General Public License for more details.
 
21
 
22
#  You should have received a copy of the GNU General Public License
 
23
#  along with this program; if not, write to the Free Software
 
24
#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 
25
#  USA
 
26
 
 
27
import pygtk
 
28
import os
 
29
pygtk.require('2.0')
 
30
import gtk
 
31
import gtk.glade
 
32
import sys
 
33
 
 
34
from UpdateManagerHildon.UpdateManagerHildon import UpdateManagerHildon
 
35
from DistUpgrade.DistUpgradeVersion import VERSION
 
36
import gettext
 
37
from gettext import gettext as _
 
38
 
 
39
from optparse import OptionParser
 
40
 
 
41
if __name__ == "__main__":
 
42
  APP="update-manager"
 
43
  DIR="/usr/share/locale"
 
44
 
 
45
  gtk.init_check()
 
46
 
 
47
  gettext.bindtextdomain(APP, DIR)
 
48
  gettext.textdomain(APP)
 
49
  gtk.glade.bindtextdomain(APP, DIR)
 
50
  gtk.glade.textdomain(APP)
 
51
 
 
52
  # Begin parsing of options
 
53
  parser = OptionParser()
 
54
  parser.add_option ("-V", "--version", action="store_true",
 
55
                     dest="show_version", default=False,
 
56
                     help=_("Show version and exit"))
 
57
  parser.add_option ("-c", "--check-dist-upgrades", action="store_true",
 
58
                     dest="check_dist_upgrades", default=False,
 
59
                     help=_("Check if a new distribution release is available"))
 
60
  parser.add_option ("-d", "--devel-release", action="store_true",
 
61
                     dest="devel_release", default=False,
 
62
                     help=_("Check if upgrading to the latest devel release "
 
63
                          "is possible"))
 
64
  parser.add_option ("-p","--proposed", action="store_true",
 
65
                     dest="use_proposed", default=False,
 
66
                     help=_("Try to run a dist-upgrade"))
 
67
  parser.add_option ("--dist-upgrade","--dist-ugprade", action="store_true",
 
68
                     dest="dist_upgrade", default=False,
 
69
                     help=_("Try to run a dist-upgrade"))
 
70
 
 
71
  (options, args) = parser.parse_args()
 
72
 
 
73
  data_dir="/usr/share/update-manager/"
 
74
  #data_dir="/tmp/xxx/share/update-manager/"
 
75
 
 
76
  if options.show_version:
 
77
    print "%s: version %s" % (os.path.basename(sys.argv[0]), VERSION)
 
78
    sys.exit(0)
 
79
 
 
80
  if options.dist_upgrade == True:
 
81
    from DistUpgrade.DistUpgradeViewGtk import DistUpgradeViewGtk
 
82
    from DistUpgrade.DistUpgradeController import DistUpgradeController
 
83
    # FIXME: Having a "partial upgrade" view here would make it possible
 
84
    #        to get rid of the ugly hideStep() stuff
 
85
    view = DistUpgradeViewGtk(data_dir)
 
86
    view.label_title.set_markup("<b><big>%s</big></b>" % _("Running partial upgrade"))
 
87
    controler = DistUpgradeController(view, datadir=data_dir)
 
88
    controler.doPartialUpgrade()
 
89
  else:
 
90
    app = UpdateManagerHildon(data_dir)
 
91
    app.main(options)