From 42e5d7c9b560e454f1131889567715e41693f156 Mon Sep 17 00:00:00 2001 From: jliersch <10142712+jliersch@users.noreply.github.com> Date: Wed, 21 Dec 2022 20:01:46 +0100 Subject: [PATCH] Enabled opening README.md with python2 in setup.py (#160) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Enabled opening README.md with python2 in setup.py * remove comment Co-authored-by: Sylvain Chevallier Co-authored-by: Quentin Barthélemy --- setup.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 15eee4ef..0ed832ed 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,4 @@ +import sys import os.path as op from setuptools import setup, find_packages @@ -13,7 +14,9 @@ if version is None: raise RuntimeError("Could not determine version") -with open("README.md", "r", encoding="utf8") as fid: +is_python3 = sys.version_info.major >= 3 +kwargs_open = {"encoding": "utf8"} if is_python3 else {} +with open('README.md', 'r', **kwargs_open) as fid: long_description = fid.read() setup(