A couple of setup.py fixes (#5338)

* setup: fix long description read in python2

* setup: fix git_get_sha in python3

Fix #5317
This commit is contained in:
Riccardo Magliocchetti 2018-07-04 23:04:39 +02:00 committed by Maxime Beauchemin
parent 976e815a6e
commit 81bd5cc4c3
1 changed files with 4 additions and 3 deletions

View File

@ -4,6 +4,7 @@ from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import io
import json
import os
import subprocess
@ -16,14 +17,14 @@ PACKAGE_FILE = os.path.join(PACKAGE_DIR, 'package.json')
with open(PACKAGE_FILE) as package_file:
version_string = json.load(package_file)['version']
with open('README.md', encoding='utf-8') as f:
with io.open('README.md', encoding='utf-8') as f:
long_description = f.read()
def get_git_sha():
try:
s = str(subprocess.check_output(['git', 'rev-parse', 'HEAD']))
return s.strip()
s = subprocess.check_output(['git', 'rev-parse', 'HEAD'])
return s.decode().strip()
except Exception:
return ''