Skip to content

Commit 13fa24a

Browse files
committed
Use io.open() and 'utf-8' encoding to read version
1 parent 0e77bcd commit 13fa24a

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

setup.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
#!/usr/bin/env python
22

33
from setuptools import setup, find_packages
4+
import io
45
import os
56
import sys
67
import re
78
import shutil
89

9-
1010
def get_version(package):
1111
"""
1212
Return package version as listed in `__version__` in `init.py`.
1313
"""
14-
init_py = open(os.path.join(package, '__init__.py')).read()
14+
init_py = io.open(os.path.join(package, '__init__.py'), encoding='utf-8').read()
1515
return re.search("__version__ = ['\"]([^'\"]+)['\"]", init_py).group(1)
1616

17-
1817
def read_all(f):
1918
with open(f) as I:
2019
return I.read()

0 commit comments

Comments
 (0)