From dd7fd86c3dfafbe82ca0c820e7a18846440b73b8 Mon Sep 17 00:00:00 2001 From: Stefano Rivera Date: Thu, 24 Feb 2011 16:30:45 +0200 Subject: [PATCH] Remove manage-credentials, and credential handling code from ubuntutools.lp.libsupport. Launchpadlib 1.9 handles this via python-keyring. --- debian/changelog | 8 +++ debian/control | 1 - debian/copyright | 2 - doc/manage-credentials.1 | 69 -------------------- doc/requestsync.1 | 3 +- lp-set-dup | 3 - manage-credentials | 132 --------------------------------------- setup.py | 1 - 8 files changed, 9 insertions(+), 210 deletions(-) delete mode 100644 doc/manage-credentials.1 delete mode 100755 manage-credentials diff --git a/debian/changelog b/debian/changelog index 760431b..ee13fb5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +ubuntu-dev-tools (0.119) UNRELEASED; urgency=low + + * Remove manage-credentials, and credential handling code from + ubuntutools.lp.libsupport. Launchpadlib 1.9 handles this via + python-keyring. + + -- Stefano Rivera Thu, 24 Feb 2011 16:28:33 +0200 + ubuntu-dev-tools (0.118) unstable; urgency=low * requestsync: Use from...import require_utf8() to work around unexpected diff --git a/debian/control b/debian/control index 9120245..1f7637f 100644 --- a/debian/control +++ b/debian/control @@ -88,7 +88,6 @@ Description: useful tools for Ubuntu developers - lp-list-bugs - briefly list status of Launchpad bugs. - lp-project-upload - upload a release tarball to a Launchpad project - lp-set-dup - sets the "duplicate of" bug of a bug and its dups. - - manage-credentials - manage Launchpad token credentials. - massfile - fill multiple bugs using a template. - merge-changelog - manually merges two Debian changelogs with the same base version. diff --git a/debian/copyright b/debian/copyright index 5228872..d079cdd 100644 --- a/debian/copyright +++ b/debian/copyright @@ -129,7 +129,6 @@ Files: dch-repeat doc/get-build-deps.1 doc/grep-merges.1 doc/lp-list-bugs.1 - doc/manage-credentials.1 doc/mk-sbuild.1 doc/pull-lp-source.1 doc/pull-revu-source.1 @@ -138,7 +137,6 @@ Files: dch-repeat get-build-deps grep-merges lp-list-bugs - manage-credentials mk-sbuild pull-lp-source pull-revu-source diff --git a/doc/manage-credentials.1 b/doc/manage-credentials.1 deleted file mode 100644 index 90429b8..0000000 --- a/doc/manage-credentials.1 +++ /dev/null @@ -1,69 +0,0 @@ -.TH MANAGE-CREDENTIALS "1" "13 January 2009" "ubuntu-dev-tools" -.SH NAME -manage-credentials \- a tool to create (and manage) credentials which -are used to access launchpad via the API. -.SH SYNOPSIS -.B manage-credentials create -c [--email --password ] [--service ] -.br -.B manage-credentials \-h -.SH DESCRIPTION -\fBmanage-credentials\fR is a tool to create (and manage) credentials which -are used to access Launchpad via the API. - -.PP -Currently this tool can be used -to create a token with or without using the web UI. In the future, once -related methods are available through the API, this tool can also be used -to manage tokens in launchpad and on the users local machine. - -.SH OPTIONS -Listed below are the command line options for requestsync: -.TP -.B \-h -Display a help message and exit. -.TP -.B \-c \-\-consumer -.TP -.B \-e \-\-email -Your email address as registered on Launchpad. -.TP -.B \-p \-\-password -Your Launchpad password. -.TP -.B \-s \-\-service -If we should use the edge or staging root of the Launchpad API. -.TP -.B \-\-cache -Where to store the cache. -.TP -.B \-o -Which file we should save the credentials to. By default -\fBmanage-credentials\fR writes the credentials tokens to the -~/.cache/lp_credentials/ directory. -.TP -.B \-l \-\-level -A number representing the access-level you wish to give to the new -Launchpad token. 0 is unauthorized, 1 is read public data, 2; write public data, -3; read private data and 4; write private data. - -.SH EXAMPLE USAGE -To get Launchpad tokens using \fBmanage-credentials\fR, run the following command: -.TP -manage-credentials create \-c CONSUMER \-\-level 2 - -.TP -This will open your web browser with a Launchpad login page. - -.TP -If you intend to use manage-credentials for Ubuntu development (such as -the ubuntu-dev-tools package). Please be sure to run the following: - -.TP -manage-credentials create \-c ubuntu-dev-tools \-l 2 - -.SH AUTHOR -.B manage-credentials -was written by Markus Korn and this manual page was written by -Jonathan Davies . -.PP -Both are released under the GNU General Public License, version 3. diff --git a/doc/requestsync.1 b/doc/requestsync.1 index a6593e8..67bde76 100644 --- a/doc/requestsync.1 +++ b/doc/requestsync.1 @@ -33,8 +33,7 @@ answer the question about upload permissions honestly to determine if a team with approval rights is to be subscribed to the bug. .PP -\fBrequestsync\fR uses launchpadlib authentication to file its requests. Please -see manage-credentials(1) for more information. +\fBrequestsync\fR uses launchpadlib authentication to file its requests. .SH OPTIONS Listed below are the command line options for requestsync: diff --git a/lp-set-dup b/lp-set-dup index 17d6917..fcda69a 100755 --- a/lp-set-dup +++ b/lp-set-dup @@ -65,9 +65,6 @@ def main(): print "Launchpad setup complete" except ImportError: suggestion = "check whether python-launchpadlib is installed" - except IOError: - suggestion = "you might want to \"manage-credentials create " + \ - "--consumer ubuntu-dev-tools --level 2\"" if launchpad is None: die("Couldn't setup Launchpad for the ubuntu-dev-tools consumer; %s" % \ (suggestion, )) diff --git a/manage-credentials b/manage-credentials deleted file mode 100755 index 1fc31bd..0000000 --- a/manage-credentials +++ /dev/null @@ -1,132 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- -# -# Copyright (C) 2009 Markus Korn -# -# ################################################################## -# -# 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 3 -# 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. -# -# See file /usr/share/common-licenses/GPL for more details. -# -# ################################################################## - -import os -import sys -from optparse import OptionParser, make_option -from launchpadlib.uris import lookup_service_root -from ubuntutools.lp.libsupport import Launchpad, translate_api_web, LEVEL - -class CmdOptions(OptionParser): - - USAGE = ( - "\t%prog create -c [--service ]" - ) - - OPTIONS = ( - make_option("-c", "--consumer", action="store", type="string", - dest="consumer", default=None), - make_option("-s", "--service", action="store", type="string", - dest="service", default="production"), - make_option("--cache", action="store", type="string", - dest="cache", default=None), - make_option("-o", action="store", type="string", - dest="output", default=None), - make_option("-l", "--level", action="store", type="int", - dest="level", default=0, - help="integer representing the access-level (default: 0), " - "mapping: %s" % LEVEL), - ) - - TOOLS = { - "create": ( ("consumer",), - ("service", "cache", "output", - "level")), - "list": (tuple(), ("service", )), - } - - def __init__(self): - OptionParser.__init__(self, option_list=self.OPTIONS) - self.set_usage(self.USAGE) - - def parse_args(self, args=None, values=None): - options, args = OptionParser.parse_args(self, args, values) - given_options = set(i for i, k in self.defaults.iteritems() - if not getattr(options, i) == k) - - if not args: - self.error("Please define a sub-tool you would like to use") - if not len(args) == 1: - self.error("Only one sub-tool allowed") - else: - tool = args.pop() - if not tool in self.TOOLS: - self.error("Unknown tool '%s'" %tool) - needed_options = set(self.TOOLS[tool][0]) - given_options - if needed_options: - self.error("Please define the following options: %s" % \ - ", ".join(needed_options)) - optional_options = given_options - set(sum(self.TOOLS[tool], ())) - if optional_options: - self.error("The following options are not allowed for this tool: " - "%s" % ", ".join(optional_options)) - options.service = lookup_service_root(options.service) - if options.level in LEVEL: - options.level = LEVEL[options.level] - elif options.level.upper() in LEVEL.values(): - options.level = options.level.upper() - else: - self.error("Unknown access-level '%s', level must be in %s" % - (options.level, LEVEL)) - return tool, options - -def create_credentials(options): - launchpad = Launchpad.get_token_and_login(options.consumer, - options.service, options.cache) - credentials = launchpad.credentials - - if options.output: - filepath = options.output - else: - credentials_dir = os.path.expanduser("~/.cache/lp_credentials") - if not os.path.isdir(credentials_dir): - os.makedirs(credentials_dir) - os.chmod(credentials_dir, 0700) - filepath = os.path.expanduser("%s/%s-%s.txt" % - (credentials_dir, options.consumer, - str(options.level).lower())) - - f = open(filepath, "w") - # Make credentials file non-world readable. - os.chmod(filepath, 0600) - credentials.save(f) - f.close() - - print "Credentials successfully written to %s." % filepath - - return - -def list_tokens(options): - print "Not implemented yet." - print ("To get a list of your tokens, please visit " - "%speople/+me/+oauth-tokens") % translate_api_web(options.service) - return 1 - -def main(): - cmdoptions = CmdOptions() - tool, options = cmdoptions.parse_args() - if tool == "create": - return create_credentials(options) - elif tool == "list": - return list_tokens(options) - -if __name__ == "__main__": - sys.exit(main()) diff --git a/setup.py b/setup.py index aa6c392..a262e7c 100755 --- a/setup.py +++ b/setup.py @@ -32,7 +32,6 @@ scripts = ['404main', 'lp-project-upload', 'lp-set-dup', 'lp-shell', - 'manage-credentials', 'massfile', 'merge-changelog', 'mk-sbuild',