mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-05-09 07:51:28 +00:00
More module reorganzation.
This commit is contained in:
parent
0bbef6d974
commit
88abaa56cf
12
buildd
12
buildd
@ -31,9 +31,9 @@ from optparse import OptionParser
|
|||||||
from urllib import urlencode
|
from urllib import urlencode
|
||||||
|
|
||||||
# ubuntu-dev-tools modules.
|
# ubuntu-dev-tools modules.
|
||||||
from ubuntutools import lpcookie
|
import ubuntutools.lp.cookie as lp_cookie
|
||||||
from ubuntutools import lplibfunctions
|
import ubuntutools.lp.functions as lp_functions
|
||||||
from ubuntutools import lpurlopener
|
import ubuntutools.lp.urlopener as lp_urlopener
|
||||||
from ubuntutools import packages
|
from ubuntutools import packages
|
||||||
|
|
||||||
# Usage.
|
# Usage.
|
||||||
@ -96,8 +96,8 @@ else:
|
|||||||
oneArch = False
|
oneArch = False
|
||||||
|
|
||||||
# Prepare Launchpad cookie.
|
# Prepare Launchpad cookie.
|
||||||
launchpadCookie = lpcookie.prepareLaunchpadCookie()
|
launchpadCookie = lp_cookie.prepareLaunchpadCookie()
|
||||||
urlopener = lpurlopener.setupLaunchpadUrlOpener(launchpadCookie)
|
urlopener = lp_urlopener.setupLaunchpadUrlOpener(launchpadCookie)
|
||||||
|
|
||||||
# Check the release exists.
|
# Check the release exists.
|
||||||
packages.checkReleaseExists(release)
|
packages.checkReleaseExists(release)
|
||||||
@ -153,7 +153,7 @@ if op == "retry":
|
|||||||
else:
|
else:
|
||||||
teamNeeded = "ubuntu-dev"
|
teamNeeded = "ubuntu-dev"
|
||||||
|
|
||||||
necessaryPrivs = lplibfunctions.isLPTeamMember(teamNeeded)
|
necessaryPrivs = lp_functions.isLPTeamMember(teamNeeded)
|
||||||
|
|
||||||
if not necessaryPrivs:
|
if not necessaryPrivs:
|
||||||
print >> sys.stderr, "You cannot perform the %s operation on a %s package " \
|
print >> sys.stderr, "You cannot perform the %s operation on a %s package " \
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from ubuntutools.lplibsupport import get_launchpad
|
from ubuntutools.lp.libsupport import get_launchpad
|
||||||
|
|
||||||
USAGE = "grab-attachments <bug numbers>"
|
USAGE = "grab-attachments <bug numbers>"
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ import string
|
|||||||
import sys
|
import sys
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
|
|
||||||
from ubuntutools.lplibsupport import get_launchpad, translate_web_api, translate_api_web
|
from ubuntutools.lp.libsupport import get_launchpad, translate_web_api, translate_api_web
|
||||||
|
|
||||||
def check_args():
|
def check_args():
|
||||||
howmany = -1
|
howmany = -1
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
import os, sys
|
import os, sys
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
|
|
||||||
from ubuntutools import lplibsupport
|
from ubuntutools.lp.libsupport as lp_libsupport
|
||||||
|
|
||||||
def die(message):
|
def die(message):
|
||||||
print >> sys.stderr, "Fatal: " + message
|
print >> sys.stderr, "Fatal: " + message
|
||||||
@ -46,7 +46,7 @@ if __name__ == '__main__':
|
|||||||
launchpad = None
|
launchpad = None
|
||||||
try:
|
try:
|
||||||
print "Setting up Launchpad"
|
print "Setting up Launchpad"
|
||||||
launchpad = lplibsupport.get_launchpad("ubuntu-dev-tools")
|
launchpad = lp_libsupport.get_launchpad("ubuntu-dev-tools")
|
||||||
print "Launchpad setup complete"
|
print "Launchpad setup complete"
|
||||||
except ImportError:
|
except ImportError:
|
||||||
suggestion = "check whether python-launchpadlib is installed"
|
suggestion = "check whether python-launchpadlib is installed"
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from optparse import OptionParser, make_option
|
from optparse import OptionParser, make_option
|
||||||
from ubuntutools.lplibsupport import *
|
from ubuntutools.lp.libsupport import *
|
||||||
from ubuntutools.misc import mkdir
|
from ubuntutools.misc import mkdir
|
||||||
|
|
||||||
class CmdOptions(OptionParser):
|
class CmdOptions(OptionParser):
|
||||||
|
2
massfile
2
massfile
@ -29,7 +29,7 @@ import email
|
|||||||
import subprocess
|
import subprocess
|
||||||
import glob
|
import glob
|
||||||
|
|
||||||
from ubuntutools.lplibsupport import get_launchpad, translate_api_web, translate_web_api
|
from ubuntutools.lp.libsupport import get_launchpad, translate_api_web, translate_web_api
|
||||||
|
|
||||||
def read_config():
|
def read_config():
|
||||||
instructions_file = open("instructions")
|
instructions_file = open("instructions")
|
||||||
|
22
requestsync
22
requestsync
@ -36,12 +36,12 @@ from optparse import OptionParser
|
|||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
# ubuntu-dev-tools modules.
|
# ubuntu-dev-tools modules.
|
||||||
from ubuntutools import lpcookie
|
import ubuntutools.lp.cookie as lp_cookie
|
||||||
from ubuntutools import lplibfunctions
|
import ubuntutools.lp.functions as lp_functions
|
||||||
from ubuntutools import lplibsupport
|
import ubuntutools.lp.libsupport as lp_libsupport
|
||||||
from ubuntutools import lpurlopener
|
import ubuntutools.lp.urlopener as lp_urlopener
|
||||||
|
|
||||||
launchpad_cookiefile = lpcookie.prepareLaunchpadCookie()
|
launchpad_cookiefile = lp_cookie.prepareLaunchpadCookie()
|
||||||
|
|
||||||
def checkNeedsSponsorship(component):
|
def checkNeedsSponsorship(component):
|
||||||
"""
|
"""
|
||||||
@ -62,7 +62,7 @@ def checkNeedsSponsorship(component):
|
|||||||
# >>> me = launchpad.me
|
# >>> me = launchpad.me
|
||||||
# >>> me.inTeam(<TEAM>) #or
|
# >>> me.inTeam(<TEAM>) #or
|
||||||
# >>> me in <TEAM>
|
# >>> me in <TEAM>
|
||||||
urlopener = lpurlopener.setupLaunchpadUrlOpener(launchpad_cookiefile)
|
urlopener = lp_urlopener.setupLaunchpadUrlOpener(launchpad_cookiefile)
|
||||||
|
|
||||||
# Check where the package is and assign the appropriate variables.
|
# Check where the package is and assign the appropriate variables.
|
||||||
if component in ['main', 'restricted']:
|
if component in ['main', 'restricted']:
|
||||||
@ -73,7 +73,7 @@ def checkNeedsSponsorship(component):
|
|||||||
sponsor = "ubuntu-universe-sponsors"
|
sponsor = "ubuntu-universe-sponsors"
|
||||||
|
|
||||||
# Check if they are a member of the team.
|
# Check if they are a member of the team.
|
||||||
teamMember = lplibfunctions.isLPTeamMember(team)
|
teamMember = lp_functions.isLPTeamMember(team)
|
||||||
|
|
||||||
if not teamMember:
|
if not teamMember:
|
||||||
print "You are not a member (direct or indirect) of the '%s' " \
|
print "You are not a member (direct or indirect) of the '%s' " \
|
||||||
@ -102,7 +102,7 @@ def checkExistingReports(package):
|
|||||||
launchpad = None
|
launchpad = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
launchpad = lplibsupport.get_launchpad("ubuntu-dev-tools")
|
launchpad = lp_libsupport.get_launchpad("ubuntu-dev-tools")
|
||||||
except ImportError:
|
except ImportError:
|
||||||
print >> sys.stderr, 'Importing launchpadlib failed. Is ' \
|
print >> sys.stderr, 'Importing launchpadlib failed. Is ' \
|
||||||
'python-launchpadlib installed?'
|
'python-launchpadlib installed?'
|
||||||
@ -133,7 +133,7 @@ def checkExistingReports(package):
|
|||||||
|
|
||||||
for bug in matchingBugs:
|
for bug in matchingBugs:
|
||||||
print " *", bug.title
|
print " *", bug.title
|
||||||
print " -", lplibsupport.translate_api_web(bug.self_link)
|
print " -", lp_libsupport.translate_api_web(bug.self_link)
|
||||||
|
|
||||||
print "Please check the above URLs to verify this before filing a " \
|
print "Please check the above URLs to verify this before filing a " \
|
||||||
"possible duplicate report."
|
"possible duplicate report."
|
||||||
@ -352,7 +352,7 @@ def post_bug(source_package, subscribe, status, bugtitle, bugtext):
|
|||||||
import glob, os.path
|
import glob, os.path
|
||||||
|
|
||||||
try:
|
try:
|
||||||
launchpad = lplibsupport.get_launchpad("ubuntu-dev-tools")
|
launchpad = lp_libsupport.get_launchpad("ubuntu-dev-tools")
|
||||||
except ImportError:
|
except ImportError:
|
||||||
print >> sys.stderr, 'Importing launchpadlib failed. Is python-launchpadlib installed?'
|
print >> sys.stderr, 'Importing launchpadlib failed. Is python-launchpadlib installed?'
|
||||||
return False
|
return False
|
||||||
@ -396,7 +396,7 @@ def post_bug(source_package, subscribe, status, bugtitle, bugtext):
|
|||||||
bug.subscribe(person=subscribe_url)
|
bug.subscribe(person=subscribe_url)
|
||||||
|
|
||||||
print 'Sync request filed as bug #%i: %s' % (bug.id,
|
print 'Sync request filed as bug #%i: %s' % (bug.id,
|
||||||
lplibsupport.translate_api_web(bug.self_link))
|
lp_libsupport.translate_api_web(bug.self_link))
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def edit_report(subject, body, changes_required=False):
|
def edit_report(subject, body, changes_required=False):
|
||||||
|
3
ubuntutools/lp/__init__.py
Normal file
3
ubuntutools/lp/__init__.py
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
##
|
||||||
|
## ubuntu-dev-tools Launchpad Python modules.
|
||||||
|
##
|
@ -1,5 +1,5 @@
|
|||||||
import lpcookie
|
import cookie
|
||||||
import lpurlopener
|
import urlopener
|
||||||
|
|
||||||
def isLPTeamMember(team):
|
def isLPTeamMember(team):
|
||||||
""" Checks if the user is a member of a certain team on Launchpad.
|
""" Checks if the user is a member of a certain team on Launchpad.
|
||||||
@ -15,9 +15,9 @@ def isLPTeamMember(team):
|
|||||||
# TODO: Check if launchpadlib may be a better way of doing this.
|
# TODO: Check if launchpadlib may be a better way of doing this.
|
||||||
|
|
||||||
# Prepare cookie.
|
# Prepare cookie.
|
||||||
cookieFile = lpcookie.prepareLaunchpadCookie()
|
cookieFile = cookie.prepareLaunchpadCookie()
|
||||||
# Prepare URL opener.
|
# Prepare URL opener.
|
||||||
urlopener = lpurlopener.setupLaunchpadUrlOpener(cookieFile)
|
urlopener = urlopener.setupLaunchpadUrlOpener(cookieFile)
|
||||||
|
|
||||||
# Try to open the Launchpad team page:
|
# Try to open the Launchpad team page:
|
||||||
try:
|
try:
|
Loading…
x
Reference in New Issue
Block a user