git-pr py3 compatible (#6961)

* py3 print statement

* python3
This commit is contained in:
dahn 2022-12-13 02:15:13 -08:00 committed by GitHub
parent f2e7d6b90e
commit 3106dba28c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -69,68 +69,68 @@ else
fi fi
# Get vars from the GitHub API and parse the returned json # Get vars from the GitHub API and parse the returned json
prAuthor=$(cat ${jsonTmp} | python -c " prAuthor=$(cat ${jsonTmp} | python3 -c "
try: try:
import sys, json import sys, json
print json.load(sys.stdin)['user']['login'].encode('utf-8').decode('ascii','ignore') print (json.load(sys.stdin)['user']['login'].encode('utf-8').decode('ascii','ignore'))
except: except:
print '' print ('')
") ")
prTitle=$(cat ${jsonTmp} | python -c " prTitle=$(cat ${jsonTmp} | python3 -c "
try: try:
import sys, json import sys, json
print json.load(sys.stdin)['title'].encode('utf-8').decode('ascii','ignore') print (json.load(sys.stdin)['title'].encode('utf-8').decode('ascii','ignore'))
except: except:
print '' print ('')
") ")
prBody=$(cat ${jsonTmp} | python -c " prBody=$(cat ${jsonTmp} | python3 -c "
try: try:
import sys, json import sys, json
print json.load(sys.stdin)['body'].encode('utf-8').decode('ascii','ignore') print (json.load(sys.stdin)['body'].encode('utf-8').decode('ascii','ignore'))
except: except:
print '' print ('')
") ")
prOriginBranch=$(cat ${jsonTmp} | python -c " prOriginBranch=$(cat ${jsonTmp} | python3 -c "
try: try:
import sys, json import sys, json
print json.load(sys.stdin)['head']['label'].encode('utf-8').decode('ascii','ignore') print (json.load(sys.stdin)['head']['label'].encode('utf-8').decode('ascii','ignore'))
except: except:
print '' print ('')
" | sed -e "s/:/\//") " | sed -e "s/:/\//")
prState=$(cat ${jsonTmp} | python -c " prState=$(cat ${jsonTmp} | python3 -c "
try: try:
import sys, json import sys, json
print json.load(sys.stdin)['state'].encode('utf-8').decode('ascii','ignore') print (json.load(sys.stdin)['state'].encode('utf-8').decode('ascii','ignore'))
except: except:
print 'Unknown' print ('Unknown')
") ")
prMergeableState=$(cat ${jsonTmp} | python -c " prMergeableState=$(cat ${jsonTmp} | python3 -c "
try: try:
import sys, json import sys, json
print json.load(sys.stdin)['mergeable_state'].encode('utf-8').decode('ascii','ignore') print (json.load(sys.stdin)['mergeable_state'].encode('utf-8').decode('ascii','ignore'))
except: except:
print 'Unknown' print ('Unknown')
") ")
prDestinationBranch=$(cat ${jsonTmp} | python -c " prDestinationBranch=$(cat ${jsonTmp} | python3 -c "
try: try:
import sys, json import sys, json
print json.load(sys.stdin)['base']['ref'].encode('utf-8').decode('ascii','ignore') print (json.load(sys.stdin)['base']['ref'].encode('utf-8').decode('ascii','ignore'))
except: except:
print 'Unknown' print ('Unknown')
") ")
prCommits=$(cat ${jsonTmp} | python -c " prCommits=$(cat ${jsonTmp} | python3 -c "
try: try:
import sys, json import sys, json
print json.load(sys.stdin)['commits'] print (json.load(sys.stdin)['commits'])
except: except:
print 'Unknown' print ('Unknown')
") ")
# Do some sanity checking # Do some sanity checking