3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 01:09:22 +01:00

setup.py: work around installation error on Python 3.4

This commit is contained in:
James Lu 2018-07-28 10:52:54 -07:00
parent 9cf507183d
commit c91b5f74ea

View File

@ -30,8 +30,14 @@ with open('__init__.py', 'w') as f:
f.write('real_version = %r\n' % real_version)
try:
with open('README.md') as f:
long_description = f.read()
if sys.version_info >= (3, 5):
with open('README.md') as f:
long_description = f.read()
else:
# Work around "TypeError: a bytes-like object is required, not 'str'" errors on Python 3.4
# when the README has Unicode characters (error in distutils.util.rfc822_escape)
import codecs
long_description = codecs.open('README.md', encoding='utf-8').read()
except OSError:
print('WARNING: Failed to read readme, skipping writing long_description')
long_description = None