Skip to content

Commit dec1bad

Browse files
authored
Merge pull request #1667 from JonasT/setup_py_fix
Fix setup.py install breaking due to unicode characters in README.md on Python 3
2 parents 8d8d345 + 93d702e commit dec1bad

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

setup.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11

2-
from setuptools import setup, find_packages
2+
import glob
3+
from io import open # for open(..,encoding=...) parameter in python 2
34
from os import walk
45
from os.path import join, dirname, sep
56
import os
6-
import glob
77
import re
8+
from setuptools import setup, find_packages
89

910
# NOTE: All package data should also be set in MANIFEST.in
1011

@@ -52,13 +53,19 @@ def recursively_include(results, directory, patterns):
5253
recursively_include(package_data, 'pythonforandroid',
5354
['liblink', 'biglink', 'liblink.sh'])
5455

55-
with open(join(dirname(__file__), 'README.md')) as fileh:
56+
with open(join(dirname(__file__), 'README.md'),
57+
encoding="utf-8",
58+
errors="replace",
59+
) as fileh:
5660
long_description = fileh.read()
5761

5862
init_filen = join(dirname(__file__), 'pythonforandroid', '__init__.py')
5963
version = None
6064
try:
61-
with open(init_filen) as fileh:
65+
with open(init_filen,
66+
encoding="utf-8",
67+
errors="replace"
68+
) as fileh:
6269
lines = fileh.readlines()
6370
except IOError:
6471
pass

0 commit comments

Comments
 (0)