1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
|
#!/usr/bin/env python
# software-properties - graphical abstraction of the sources.list
#
# Copyright (c) 2007 Canonical Ltd.
#
# Author: Jonathan Riddell <jriddell@ubuntu.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA
import gettext
import os
import sys
from optparse import OptionParser
import aptsources
from aptsources.sourceslist import SourcesList
#sys.path.append("@prefix@/share/update-manager/python")
from softwareproperties.kde.SoftwarePropertiesKDE import SoftwarePropertiesKDE
if __name__ == "__main__":
_ = gettext.gettext
# Begin parsing of options
parser = OptionParser()
parser.add_option ("-d", "--debug", action="store_true",
dest="debug", default=False,
help="Print some debug information to the command line")
parser.add_option ("-m", "--massive-debug", action="store_true",
dest="massive_debug", default=False,
help="Print a lot of debug information to the "
"command line")
parser.add_option ("-n", "--no-update", action="store_true",
dest="no_update", default=False,
help="No update on repository change (usefull if called "\
"from a external program).")
parser.add_option("-t", "--toplevel",
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:
""" ##FIXME
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_CLOSE)
dialog.run()
dialog.destroy()
"""
print "not root, quitting"
sys.exit(1)
localesApp="software-properties"
localesDir="/usr/share/locale"
gettext.bindtextdomain(localesApp, localesDir)
gettext.textdomain(localesApp)
data_dir="/usr/share/software-properties/"
#data_dir='/home/jr/src/software-properties/deneutral'
file = None
if len(args) > 0:
file = args[0]
if options.enable_component:
sourceslist = SourcesList()
distro = aptsources.distro.get_distro()
distro.get_sources(sourceslist)
distro.enable_component(options.enable_component)
sourceslist.save()
else:
app = SoftwarePropertiesKDE(datadir=data_dir, options=options, file=file)
app.run()
sys.exit(app.modified_sourceslist)
|