Package: elasticsearch-curator / 4.2.5-1

setup.py-read-README-utf-8 Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
From 644ce9423f45c94087058c331d1ee619bdd40afa Mon Sep 17 00:00:00 2001
From: Apollon Oikonomopoulos <apoikos@debian.org>
Date: Thu, 8 Oct 2015 09:00:30 -0700
Subject: 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 01ae5f1..e6f755f 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"