requestsync: more refactoring

This commit is contained in:
Michael Bienia 2009-08-07 12:53:33 +02:00
parent ce4e0932a5
commit ba14d22954
2 changed files with 14 additions and 11 deletions

View File

@ -129,17 +129,6 @@ def cur_version_component(sourcepkg, release):
print "%s doesn't appear to exist in %s, specify -n for a package not in Ubuntu." % (sourcepkg, release) print "%s doesn't appear to exist in %s, specify -n for a package not in Ubuntu." % (sourcepkg, release)
sys.exit(1) sys.exit(1)
def get_email_address():
'''Get the DEBEMAIL environment variable or give an error.'''
myemailaddr = os.getenv('DEBEMAIL')
if not myemailaddr:
myemailaddr = os.getenv('EMAIL')
if not myemailaddr:
print >> sys.stderr, 'The environment variable DEBEMAIL or ' +\
'EMAIL needs to be set to make use of this script, unless ' +\
'you use option --lp.'
return myemailaddr
def mail_bug(source_package, subscribe, status, bugtitle, bugtext, keyid = None): def mail_bug(source_package, subscribe, status, bugtitle, bugtext, keyid = None):
'''Submit the sync request per email. '''Submit the sync request per email.
Return True if email successfully send, otherwise False.''' Return True if email successfully send, otherwise False.'''

View File

@ -19,6 +19,8 @@
# Please see the /usr/share/common-licenses/GPL-2 file for the full text # Please see the /usr/share/common-licenses/GPL-2 file for the full text
# of the GNU General Public License license. # of the GNU General Public License license.
import os
import sys
import subprocess import subprocess
from ..lp.udtexceptions import PackageNotFoundException from ..lp.udtexceptions import PackageNotFoundException
@ -79,3 +81,15 @@ def getDebianSrcPkg(name, release):
def getUbuntuSrcPkg(name, release): def getUbuntuSrcPkg(name, release):
return getSrcPkg('ubuntu', name, release) return getSrcPkg('ubuntu', name, release)
def get_email_address():
'''
Get the From email address from the DEBEMAIL or EMAIL environment
variable or give an error.
'''
myemailaddr = os.getenv('DEBEMAIL') or os.getenv('EMAIL')
if not myemailaddr:
print >> sys.stderr, 'The environment variable DEBEMAIL or ' \
'EMAIL needs to be set to let this script mail the ' \
'sync request.'
return myemailaddr