Merge lp:~manjo/ubuntu-archive-tools/create-ppa into lp:ubuntu-archive-tools

Proposed by Manoj Iyer
Status: Rejected
Rejected by: Steve Langasek
Proposed branch: lp:~manjo/ubuntu-archive-tools/create-ppa
Merge into: lp:ubuntu-archive-tools
Diff against target: 56 lines (+52/-0)
1 file modified
create-ppa (+52/-0)
To merge this branch: bzr merge lp:~manjo/ubuntu-archive-tools/create-ppa
Reviewer Review Type Date Requested Status
Steve Langasek Pending
Colin Watson Pending
Review via email: mp+210532@code.launchpad.net

Description of the change

Added script to create PPA in launchpad from cli.

To post a comment you must log in.
Revision history for this message
Steve Langasek (vorlon) wrote :

ubuntu-archive-tools is primarily for tools used by the Ubuntu archive admins and that are not interesting to outside parties. This looks like something that would be more suitable for inclusion in a package in the distro, for general use? (possibly ubuntu-dev-tools?)

Unmerged revisions

819. By Manoj Iyer

Added create-ppa to create PPAs in launchpad

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file 'create-ppa'
--- create-ppa 1970-01-01 00:00:00 +0000
+++ create-ppa 2014-03-12 03:50:15 +0000
@@ -0,0 +1,52 @@
1#! /usr/bin/python
2
3# Copyright (C) 2014 Canonical Ltd.
4# Author: Manoj Iyer <manoj.iyer@canonical.com>
5
6# This program is free software: you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; version 3 of the License.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18import sys
19from optparse import OptionParser
20from launchpadlib.launchpad import Launchpad
21from lazr.restfulclient.errors import HTTPError
22
23
24def main():
25 parser = OptionParser(usage="usage: %prog -p <ppa name> [ -t <my-super-team> ]")
26 parser.add_option(
27 "-p", "--ppa-name", metavar="PPANAME", help="PPA named NAME")
28 parser.add_option(
29 "-t", "--ppa-team", metavar="PPATEAM", help="Team named My-Team")
30 options, args = parser.parse_args()
31
32 if options.ppa_name is None:
33 parser.error("You need to provide PPA name")
34
35 launchpad = Launchpad.login_with("create-ppa", "production", version="devel")
36 try:
37 team = launchpad.people[launchpad.me.name] if options.ppa_team is None else launchpad.people[options.ppa_team]
38
39 try:
40 ppa = team.createPPA(name=options.ppa_name, displayname=options.ppa_name, description=None)
41 except HTTPError, e:
42 print "\n Unable to create PPA \n"
43 print '*'*60
44 print str(e)
45 print '*'*60
46 return
47 print "Succesfully created PPA " + options.ppa_name
48 except Exception, e:
49 print "Unknown team:", "%s" % str(e), sys.exc_info()[0]
50
51if __name__ == '__main__':
52 sys.exit(main())

Subscribers

People subscribed via source and target branches