diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2006-07-27 17:37:29 +0200 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2006-07-27 17:37:29 +0200 |
| commit | 180c6903e874cafd56464a0c56865aec0c646941 (patch) | |
| tree | e7781578681531a5327f19fdbc7e8c4df100910b /software-properties | |
| parent | 6d740ab2dee60d3fe10c563932fc62d5dd5d2057 (diff) | |
| parent | 54d5696fa964d3cc7a79a1ba0ed4083d9701de1e (diff) | |
| download | python-apt-180c6903e874cafd56464a0c56865aec0c646941.tar.gz | |
* merged from sebastia* merged from sebastiann
Diffstat (limited to 'software-properties')
| -rw-r--r-- | software-properties | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/software-properties b/software-properties index f21a5b52..6c38d073 100644 --- a/software-properties +++ b/software-properties @@ -34,6 +34,8 @@ import sys from optparse import OptionParser +import SoftwareProperties.aptsources as aptsources + #sys.path.append("@prefix@/share/update-manager/python") from SoftwareProperties import SoftwareProperties @@ -51,14 +53,18 @@ if __name__ == "__main__": action="store", type="string", dest="toplevel", help="Set x-window-id of the toplevel parent for the "\ "dialog (usefull for embedding)") + parser.add_option("-e", "--enable-component", + action="store", type="string", dest="enable_component", + help="Enable the specified component of the distro's "\ + "repositories") (options, args) = parser.parse_args() # Check for root permissions if os.geteuid() != 0: - dialog = gtk.MessageDialog(None, 0, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, + dialog = gtk.MessageDialog(None, 0, gtk.MESSAGE_ERROR, gtk.BUTTONS_CLOSE, _("You need to be root to run this program") ) - dialog.set_default_response(gtk.RESPONSE_OK) + dialog.set_default_response(gtk.RESPONSE_CLOSE) dialog.run() dialog.destroy() sys.exit(1) @@ -74,7 +80,14 @@ if __name__ == "__main__": #data_dir="/tmp/xxx/share/update-manager/" file = None if len(args) > 0: - file = args[0] - app = SoftwareProperties.SoftwareProperties(data_dir, options, file) - app.run() - sys.exit(app.modified) + file = args[0] + if options.enable_component: + sourceslist = aptsources.SourcesList() + distro = aptsources.Distribution() + distro.get_sources(sourceslist) + distro.enable_component(sourceslist, options.enable_component) + sourceslist.save() + else: + app = SoftwareProperties.SoftwareProperties(data_dir, options, file) + app.run() + sys.exit(app.modified) |
