Skip to content

Commit c4e9d03

Browse files
committed
setup.py modified to handle UTF-8 encoded README.rst properly with
Python3 at Windows
1 parent 4afc2e7 commit c4e9d03

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

setup.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
# #
2424
###############################################################################
2525

26-
import os
26+
import os, sys
2727

2828
try:
2929
from setuptools import setup, Extension
@@ -39,9 +39,16 @@
3939
else:
4040
setuptoolsPresent = True
4141

42+
43+
def loadUTF8(path):
44+
if sys.version_info.major >= 3:
45+
return open(path, encoding='utf-8').read()
46+
47+
return open(path).read().decode('utf-8')
48+
4249
def loadTextFrom(path):
43-
return open(os.path.join(os.path.dirname(__file__),
44-
path)).read()
50+
return loadUTF8(os.path.join(os.path.dirname(__file__),
51+
path))
4552

4653
cPymice = Extension('pymice._C', sources = ['pymice.cpp'])
4754
#install_requires = ['numpy']?

0 commit comments

Comments
 (0)