187.2.36
by Sebastian Heinlein
* rename gnome-software-properties to software-properties (there is no |
1 |
#!/usr/bin/env python2.4
|
2 |
# update-manager.in - easy updating application
|
|
3 |
#
|
|
4 |
# Copyright (c) 2004,2005 Canonical
|
|
5 |
# 2004,2005 Michiel Sikkes
|
|
6 |
#
|
|
7 |
# Author: Michiel Sikkes <michiel@eyesopened.nl>
|
|
8 |
# Michael Vogt <mvo@debian.org>
|
|
9 |
#
|
|
10 |
# This program is free software; you can redistribute it and/or
|
|
11 |
# modify it under the terms of the GNU General Public License as
|
|
12 |
# published by the Free Software Foundation; either version 2 of the
|
|
13 |
# License, or (at your option) any later version.
|
|
14 |
#
|
|
15 |
# This program is distributed in the hope that it will be useful,
|
|
16 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
17 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
18 |
# GNU General Public License for more details.
|
|
19 |
#
|
|
20 |
# You should have received a copy of the GNU General Public License
|
|
21 |
# along with this program; if not, write to the Free Software
|
|
22 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
23 |
# USA
|
|
24 |
||
25 |
import pygtk |
|
26 |
pygtk.require('2.0') |
|
27 |
import gtk |
|
28 |
import gtk.gdk |
|
29 |
import gtk.glade |
|
30 |
import gobject |
|
31 |
import gettext |
|
32 |
import os |
|
33 |
import sys |
|
34 |
||
35 |
from optparse import OptionParser |
|
36 |
||
345
by Michael Vogt
* moved aptsources into the Common directory |
37 |
import UpdateManager.Common.aptsources as aptsources |
337.1.22
by glatzor at ubuntu
* Moved the Distribution class to aptsources |
38 |
|
187.2.36
by Sebastian Heinlein
* rename gnome-software-properties to software-properties (there is no |
39 |
#sys.path.append("@prefix@/share/update-manager/python")
|
40 |
||
41 |
from SoftwareProperties import SoftwareProperties |
|
42 |
||
43 |
if __name__ == "__main__": |
|
44 |
_ = gettext.gettext |
|
45 |
||
46 |
# Begin parsing of options
|
|
47 |
parser = OptionParser() |
|
337.4.15
by glatzor at ubuntu
* Fix #58453: handle disabled child sources correctly |
48 |
parser.add_option ("-d", "--debug", action="store_true", |
49 |
dest="debug", default=False, |
|
50 |
help="Print some debug information to the command line") |
|
51 |
parser.add_option ("-m", "--massive-debug", action="store_true", |
|
52 |
dest="massive_debug", default=False, |
|
53 |
help="Print a lot of debug information to the " |
|
54 |
"command line") |
|
187.2.36
by Sebastian Heinlein
* rename gnome-software-properties to software-properties (there is no |
55 |
parser.add_option ("-n", "--no-update", action="store_true", |
56 |
dest="no_update", default=False, |
|
57 |
help="No update on repository change (usefull if called "\ |
|
58 |
"from a external program).") |
|
59 |
parser.add_option("-t", "--toplevel", |
|
60 |
action="store", type="string", dest="toplevel", |
|
61 |
help="Set x-window-id of the toplevel parent for the "\ |
|
62 |
"dialog (usefull for embedding)") |
|
337.1.22
by glatzor at ubuntu
* Moved the Distribution class to aptsources |
63 |
parser.add_option("-e", "--enable-component", |
64 |
action="store", type="string", dest="enable_component", |
|
65 |
help="Enable the specified component of the distro's "\ |
|
66 |
"repositories") |
|
187.2.36
by Sebastian Heinlein
* rename gnome-software-properties to software-properties (there is no |
67 |
|
68 |
||
69 |
(options, args) = parser.parse_args() |
|
70 |
# Check for root permissions
|
|
71 |
if os.geteuid() != 0: |
|
337.1.22
by glatzor at ubuntu
* Moved the Distribution class to aptsources |
72 |
dialog = gtk.MessageDialog(None, 0, gtk.MESSAGE_ERROR, gtk.BUTTONS_CLOSE, |
187.2.36
by Sebastian Heinlein
* rename gnome-software-properties to software-properties (there is no |
73 |
_("You need to be root to run this program") ) |
337.1.22
by glatzor at ubuntu
* Moved the Distribution class to aptsources |
74 |
dialog.set_default_response(gtk.RESPONSE_CLOSE) |
187.2.36
by Sebastian Heinlein
* rename gnome-software-properties to software-properties (there is no |
75 |
dialog.run() |
76 |
dialog.destroy() |
|
77 |
sys.exit(1) |
|
78 |
||
79 |
localesApp="update-manager" |
|
80 |
localesDir="/usr/share/locale" |
|
81 |
gettext.bindtextdomain(localesApp, localesDir) |
|
82 |
gettext.textdomain(localesApp) |
|
83 |
gtk.glade.bindtextdomain(localesApp, localesDir) |
|
84 |
gtk.glade.textdomain(localesApp) |
|
85 |
||
86 |
data_dir="/usr/share/update-manager/" |
|
87 |
#data_dir="/tmp/xxx/share/update-manager/"
|
|
88 |
file = None |
|
89 |
if len(args) > 0: |
|
337.1.22
by glatzor at ubuntu
* Moved the Distribution class to aptsources |
90 |
file = args[0] |
91 |
if options.enable_component: |
|
92 |
sourceslist = aptsources.SourcesList() |
|
93 |
distro = aptsources.Distribution() |
|
94 |
distro.get_sources(sourceslist) |
|
95 |
distro.enable_component(sourceslist, options.enable_component) |
|
96 |
sourceslist.save() |
|
97 |
else: |
|
98 |
app = SoftwareProperties.SoftwareProperties(data_dir, options, file) |
|
99 |
app.run() |
|
100 |
sys.exit(app.modified) |