File:  [cvs.NetBSD.org] / pkgsrc / math / py-ephem / patches / Attic / patch-setup.py
Revision 1.1: download - view: text, annotated - select for diffs
Sun May 31 20:49:33 2020 UTC (4 years, 5 months ago) by joerg
Branches: MAIN
CVS tags: pkgsrc-2021Q4-base, pkgsrc-2021Q4, pkgsrc-2021Q3-base, pkgsrc-2021Q3, pkgsrc-2021Q2-base, pkgsrc-2021Q2, pkgsrc-2021Q1-base, pkgsrc-2021Q1, pkgsrc-2020Q4-base, pkgsrc-2020Q4, pkgsrc-2020Q3-base, pkgsrc-2020Q3, pkgsrc-2020Q2-base, pkgsrc-2020Q2, HEAD
Explicitly read files as unicode for Python 3. The content is converted
using the system locale with Python 3.6 otherwise, falling back to
ASCII.

$NetBSD: patch-setup.py,v 1.1 2020/05/31 20:49:33 joerg Exp $

Python 3.6 doesn't default to UTF-8, but still tries to convert to Unicode.

--- setup.py.orig	2020-05-31 17:37:01.440042910 +0000
+++ setup.py
@@ -24,7 +24,7 @@ libastro_files = glob('libastro-%s/*.c' 
 libastro_data = glob('extensions/data/*.c')
 
 def read(*filenames):
-    return open(os.path.join(os.path.dirname(__file__), *filenames)).read()
+    return open(os.path.join(os.path.dirname(__file__), *filenames), **({'encoding': 'UTF-8'} if sys.version_info.major >= 3 else {})).read()
 
 extensions = [
     Extension('ephem._libastro',

CVSweb <webmaster@jp.NetBSD.org>