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

Apollon Oikonomopoulos apoikos at moszumanska.debian.org
Sat Sep 10 09:12:10 UTC 2016


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

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

commit abc074dae3bce28c4c2eaa8b160f5ff3fe77932f
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 3a0494d..bd9c857 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