[pkg] Use io.open with utf-8 encoding to read long description from README
authorDenis Laxalde <denis.laxalde@logilab.fr>
Fri, 10 Jun 2016 13:23:54 +0200
changeset 11276 6eeb7abda47a
parent 11273 c655e19cbc35
child 11277 baed516c6f6e
[pkg] Use io.open with utf-8 encoding to read long description from README This forces decoding so that this is consistent between Python 2 and 3 as, in Python 3, decoding which would occur anyways and may fail depending on the environment locale settings.
setup.py
--- a/setup.py	Tue Jun 07 10:05:30 2016 +0200
+++ b/setup.py	Fri Jun 10 13:23:54 2016 +0200
@@ -21,6 +21,7 @@
 """Generic Setup script, takes package info from __pkginfo__.py file
 """
 
+import io
 import os
 import sys
 import shutil
@@ -53,7 +54,8 @@
 author = __pkginfo__['author']
 author_email = __pkginfo__['author_email']
 
-long_description = open('README').read()
+with io.open('README', encoding='utf-8') as f:
+    long_description = f.read()
 
 # import optional features
 if USE_SETUPTOOLS: