requestsync, grep-merges: Require a UTF-8 locale. (Closes: #613114,

LP: #553795)
This commit is contained in:
Stefano Rivera 2011-02-13 16:15:24 +02:00
parent ddf4bac12e
commit d054dcf796
4 changed files with 17 additions and 0 deletions

2
debian/changelog vendored
View File

@ -15,6 +15,8 @@ ubuntu-dev-tools (0.117) UNRELEASED; urgency=low
* grab-merge: Show help when no arguments are provided.
* pull-revu-source: Check for the availability of libwww-perl, and print a
more helpful error.
* requestsync, grep-merges: Require a UTF-8 locale. (Closes: #613114,
LP: #553795)
-- Stefano Rivera <stefanor@ubuntu.com> Sun, 13 Feb 2011 15:28:18 +0200

View File

@ -23,7 +23,10 @@ import sys
import urllib2
import json
import ubuntutools.misc
def main():
ubuntutools.misc.require_utf8()
if len(sys.argv) > 1:
match = sys.argv[1]
else:

View File

@ -35,6 +35,7 @@ from debian.changelog import Version
from ubuntutools.config import UDTConfig, ubu_email
from ubuntutools.distro_info import UbuntuDistroInfo
from ubuntutools.lp import udtexceptions
import ubuntutools.misc
from ubuntutools.requestsync.common import (edit_report, getDebianChangelog,
raw_input_exit_on_ctrlc)
@ -89,6 +90,8 @@ def main():
parser.print_help()
sys.exit(1)
ubuntutools.misc.require_utf8()
config = UDTConfig(options.no_conf)
if not options.lpapi:
options.lpapi = config.get_value('USE_LPAPI', default=False,

View File

@ -22,9 +22,11 @@
# ##################################################################
# Modules.
import locale
import os
import os.path
from subprocess import Popen, PIPE
import sys
from ubuntutools.lp.udtexceptions import PocketDoesNotExistError
@ -119,3 +121,10 @@ def split_release_pocket(release):
pocket)
return (release, pocket)
def require_utf8():
'''Can be called by programs that only function in UTF-8 locales'''
if locale.getpreferredencoding() != 'UTF-8':
print >> sys.stderr, ("This program only functions in a UTF-8 locale. "
"Aborting.")
sys.exit(1)