launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #27798
[Merge] ~jugmac00/launchpad:fix-user-creation into launchpad:master
Jürgen Gmach has proposed merging ~jugmac00/launchpad:fix-user-creation into launchpad:master.
Commit message:
Fix gpg parsing for names with non ascii signs
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~jugmac00/launchpad/+git/launchpad/+merge/412533
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~jugmac00/launchpad:fix-user-creation into launchpad:master.
diff --git a/utilities/make-lp-user b/utilities/make-lp-user
index 463e13d..ee792d1 100755
--- a/utilities/make-lp-user
+++ b/utilities/make-lp-user
@@ -119,12 +119,13 @@ def add_ssh_public_keys(person):
def parse_fingerprints(gpg_output):
"""Find key fingerprints in "gpg --fingerprint <email>" output."""
- line_prefix = re.compile(r'\s*Key fingerprint\s*=\s*')
- return [
- ''.join(re.sub(line_prefix, '', line).split())
- for line in gpg_output.splitlines()
- if line_prefix.match(line)
- ]
+ rv = []
+ fingerprint = re.compile(r"([A-F0-9]{4} ){5} ([A-F0-9]{4} ){4}")
+ for line in gpg_output.splitlines():
+ match = re.search(fingerprint, line)
+ if match:
+ rv.append(match.group())
+ return rv
def run_native_gpg(arguments):
@@ -135,12 +136,10 @@ def run_native_gpg(arguments):
if 'GNUPGHOME' in env:
del env['GNUPGHOME']
- # Prevent translated gpg output from messing up our parsing.
- env['LC_ALL'] = 'C'
-
command_line = [get_gpg_path()] + arguments
pipe = subprocess.Popen(
- command_line, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ command_line, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
+ universal_newlines=True)
stdout, stderr = pipe.communicate()
if stderr != '':
print(stderr)