* massfile: Use the functions in the common.py file above to authenticate with

Launchpad.
This commit is contained in:
Jonathan Patrick Davies 2008-08-12 14:43:02 +01:00
parent 00b3977dd8
commit 615bf224cc
2 changed files with 9 additions and 28 deletions

3
debian/changelog vendored
View File

@ -23,6 +23,9 @@ ubuntu-dev-tools (0.37ubuntu1) intrepid; urgency=low
the ubuntu-dev team on Launchpad. Thus, checking if the user needs
sponsership or not (LP: #130648).
* doc/requestsync.1: Removed mention of -s flag. Obsoleted by the above.
* massfile:
- Use the functions in the common.py file above to authenticate with
Launchpad.
* debian/control: Changed XS-Python-Version to >= 2.5.
[ Siegfried-Angel Gevatter Pujals ]

View File

@ -85,6 +85,12 @@ def check_configfiles():
def file_bug(config):
Bug = Connector.ConnectBug()
sys.path.append('/usr/share/ubuntu-dev-tools/')
import common
cookie = common.prepareLaunchpadCookie()
Bug.authentication = cookie
try:
@ -122,39 +128,11 @@ def read_buglist(url):
packages.add(bug.sourcepackage)
return packages
def lp_cookie():
global cookie
cookie = None
# Search cookiefile (for authentication to lp)
if cookie == None:
try_globs = ('~/.lpcookie.txt', '~/.mozilla/*/*/cookies.sqlite', '~/.mozilla/*/*/cookies.txt')
for try_glob in try_globs:
try:
cookiefile = glob.glob(os.path.expanduser(try_glob))[0]
except IndexError:
continue
# Found:
print "Using cookie file at «%s».\n" % cookiefile
cookie = cookiefile
break
if cookie == None:
raise RuntimeError("Could not find cookie file for Launchpad \
(looked in %s). You should be able to create a valid file by logging into \
Launchpad with Firefox") % ", ".join(try_globs)
def main():
if not check_configfiles():
sys.exit(1)
try:
lp_cookie()
except RuntimeError, e:
print e
sys.exit(1)
config = read_config()
pack_list = read_list()
buglist = read_buglist(config["buglist-url"])