[Python-modules-commits] [elasticsearch-curator] 11/18: Properly read unicode data from README.md for Python 3

Apollon Oikonomopoulos apoikos at moszumanska.debian.org
Tue Oct 17 08:17:17 UTC 2017


This is an automated email from the git hooks/post-receive script.

apoikos pushed a commit to branch master
in repository elasticsearch-curator.

commit cf948409b776e10fe2c576f8e5b6e2a5379a312d
Author: Apollon Oikonomopoulos <apoikos at debian.org>
Date:   Thu Oct 8 09:00:30 2015 -0700

    Properly read unicode data from README.md for Python 3
    
     README.md contains non-ASCII characters and Python 3 errors out since it was
     not instructed to read unicode data from the file. Fix this by opening the
     file with a utf-8 encoding for Python 3.
    
    Forwarded: no
    Last-Update: 2015-02-02
    Patch-Name: setup.py-read-README-utf-8
---
 setup.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/setup.py b/setup.py
index 9d0bf67..ee13a6e 100644
--- a/setup.py
+++ b/setup.py
@@ -5,7 +5,11 @@ from setuptools import setup
 
 # Utility function to read from file.
 def fread(fname):
-    return open(os.path.join(os.path.dirname(__file__), fname)).read()
+    try:
+        text = open(os.path.join(os.path.dirname(__file__), fname), encoding='utf-8').read()
+    except TypeError:
+        text = open(os.path.join(os.path.dirname(__file__), fname)).read()
+    return text
 
 def get_version():
     VERSIONFILE="curator/_version.py"

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/elasticsearch-curator.git



More information about the Python-modules-commits mailing list