From 81bd5cc4c3a0fe2ffc21b00f8d049f1a51b66377 Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Wed, 4 Jul 2018 23:04:39 +0200 Subject: [PATCH] A couple of setup.py fixes (#5338) * setup: fix long description read in python2 * setup: fix git_get_sha in python3 Fix #5317 --- setup.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 340190284..0e7243f35 100644 --- a/setup.py +++ b/setup.py @@ -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 ''