mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-05-08 23:41:28 +00:00
Take code from requestsync to make massfile work with Firefox 3 cookies
This commit is contained in:
parent
b9270bfb77
commit
d7d19fd41a
37
massfile
37
massfile
@ -2,11 +2,15 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# (C) Canonical, 2007, GPL v3
|
# (C) Canonical, 2007, GPL v3
|
||||||
|
# Authors:
|
||||||
|
# Iain Lane <iain@orangesquash.org.uk>, taking some code written by:
|
||||||
|
# Daniel Hahler <ubuntu-launchpad@thequod.de>
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import email
|
import email
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import glob
|
||||||
|
|
||||||
import launchpadbugs.connector as Connector
|
import launchpadbugs.connector as Connector
|
||||||
|
|
||||||
@ -66,7 +70,7 @@ def check_configfiles():
|
|||||||
|
|
||||||
def file_bug(config):
|
def file_bug(config):
|
||||||
Bug = Connector.ConnectBug()
|
Bug = Connector.ConnectBug()
|
||||||
Bug.authentication = os.path.expanduser("~/.lpcookie")
|
Bug.authentication = cookie
|
||||||
|
|
||||||
try:
|
try:
|
||||||
summary = config["subject"].replace("$pack", config["sourcepackage"])
|
summary = config["subject"].replace("$pack", config["sourcepackage"])
|
||||||
@ -85,6 +89,7 @@ def file_bug(config):
|
|||||||
if tag.strip("\n").strip():
|
if tag.strip("\n").strip():
|
||||||
bug.tags.append(tag.strip("\n").strip())
|
bug.tags.append(tag.strip("\n").strip())
|
||||||
bug.assignee = config["assignee"]
|
bug.assignee = config["assignee"]
|
||||||
|
bug.status = "Confirmed"
|
||||||
bug.commit()
|
bug.commit()
|
||||||
except:
|
except:
|
||||||
"Bug for '%s' was not filed." % config["sourcepackage"]
|
"Bug for '%s' was not filed." % config["sourcepackage"]
|
||||||
@ -100,16 +105,38 @@ def read_buglist(url):
|
|||||||
|
|
||||||
return packages
|
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():
|
def main():
|
||||||
if not check_configfiles():
|
if not check_configfiles():
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if not os.path.exists(os.path.expanduser("~/.lpcookie")):
|
try:
|
||||||
print >> sys.stderr, \
|
lp_cookie()
|
||||||
"Launchpad cookie not found in ~/.lpcookie."
|
except RuntimeError, e:
|
||||||
|
print e
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
config = read_config()
|
config = read_config()
|
||||||
pack_list = read_list()
|
pack_list = read_list()
|
||||||
buglist = read_buglist(config["buglist-url"])
|
buglist = read_buglist(config["buglist-url"])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user