~ubuntu-branches/ubuntu/maverick/software-properties/maverick

« back to all changes in this revision

Viewing changes to add-apt-repository

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt
  • Date: 2009-07-14 16:54:38 UTC
  • Revision ID: james.westby@ubuntu.com-20090714165438-s1uk4qcm4hcu0clr
Tags: 0.75
* new helper script "add-apt-repository" that can be used to
  enable a repository from the commandline. Useful for e.g.
  'add-apt-repository ppa:gnome-desktop'
* fix error in auto-upgrade settings when 
  dpkg-reconfigure unattended-upgrades was used (LP: #387704)
* po/zh_TW.po:
  - updated, thanks to Roy Chan (LP: #365040)
* softwareproperties/kde/SoftwarePropertiesKDE.py:
  - do not error on cancel (LP: #364288)
  - use the SUDO_USER home instead of /root (if available) 
    (LP: #364197)
  - add utf8() function and replace the custom converts to it
    (hopefully fixes LP: #362188)
  - disable "Find best server" for now, the threading crashing
    KDE
* softwareproperties/gtk/DialogCacheOutdated.py:
  - fix incorrect wait on synaptic (LP: #357617, LP: #349639)
* softwareproperties/SoftwareProperties.py:
  - check/ensure apt daily cron job is executable (LP: #390319)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python
 
2
 
 
3
import os
 
4
import sys
 
5
import gettext
 
6
import locale
 
7
 
 
8
from softwareproperties.SoftwareProperties import SoftwareProperties
 
9
from optparse import OptionParser
 
10
from gettext import gettext as _
 
11
 
 
12
if __name__ == "__main__":
 
13
    locale.setlocale(locale.LC_ALL, "")
 
14
    parser = OptionParser()
 
15
    (options, args) = parser.parse_args()
 
16
 
 
17
    if os.geteuid() != 0:
 
18
        print _("Error: must run as root")
 
19
        sys.exit(1)
 
20
 
 
21
    if (len(args) != 1):
 
22
        print _("Error: need a repostiroy as argument")
 
23
        sys.exit(1)
 
24
 
 
25
    sp = SoftwareProperties(options)    
 
26
    line = args[0]
 
27
    if not sp.add_source_from_line(line):
 
28
        print _("Error: '%s' invalid" % line)
 
29
        sys.exit(1)
 
30
    sp.sourceslist.save()