~mvo/update-manager/not-automatic

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