From 631d0ec708b5341ba02b821c120755fd814fbc0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C4=81vis=20Mos=C4=81ns?= Date: Sat, 16 Jul 2016 21:11:11 +0300 Subject: [PATCH] Support non-ASCII GNUPGHOME environment variable Here we don't need to encode this gpg_dir string when using Python 2.7 on Linux. Change-Id: I56724e9511d3b1aea61535e654a45c212130630d --- repo | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/repo b/repo index e5cb8904..ebd12c60 100755 --- a/repo +++ b/repo @@ -432,7 +432,10 @@ def SetupGnuPG(quiet): sys.exit(1) env = os.environ.copy() - env['GNUPGHOME'] = gpg_dir.encode() + try: + env['GNUPGHOME'] = gpg_dir + except UnicodeEncodeError: + env['GNUPGHOME'] = gpg_dir.encode() cmd = ['gpg', '--import'] try: @@ -638,7 +641,10 @@ def _Verify(cwd, branch, quiet): _print(file=sys.stderr) env = os.environ.copy() - env['GNUPGHOME'] = gpg_dir.encode() + try: + env['GNUPGHOME'] = gpg_dir + except UnicodeEncodeError: + env['GNUPGHOME'] = gpg_dir.encode() cmd = [GIT, 'tag', '-v', cur] proc = subprocess.Popen(cmd,