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

Subscribers

People subscribed via source and target branches