Merge "Make get_email() work with python3"
This commit is contained in:
commit
46a751138e
@ -21,6 +21,7 @@ import pickle
|
|||||||
import pytz
|
import pytz
|
||||||
import re
|
import re
|
||||||
import requests
|
import requests
|
||||||
|
import six
|
||||||
import subprocess
|
import subprocess
|
||||||
import time
|
import time
|
||||||
import yaml
|
import yaml
|
||||||
@ -77,7 +78,12 @@ def gerrit_query(url):
|
|||||||
def get_email(filepath):
|
def get_email(filepath):
|
||||||
cmd = ["git", "log", "--follow", "--format=%aE", filepath]
|
cmd = ["git", "log", "--follow", "--format=%aE", filepath]
|
||||||
git = subprocess.Popen(cmd, stdout=subprocess.PIPE)
|
git = subprocess.Popen(cmd, stdout=subprocess.PIPE)
|
||||||
return git.stdout.readlines()[-1][:-1]
|
email = git.stdout.readlines()[-1][:-1]
|
||||||
|
# Force to text_type in py2 or py3
|
||||||
|
if isinstance(email, six.text_type):
|
||||||
|
return email
|
||||||
|
else:
|
||||||
|
return email.decode('utf-8')
|
||||||
|
|
||||||
|
|
||||||
def get_gerrit_account(email):
|
def get_gerrit_account(email):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user