diff --git a/pybktree.py b/pybktree.py index 9715f99..b3d8c33 100644 --- a/pybktree.py +++ b/pybktree.py @@ -14,7 +14,7 @@ __all__ = ['hamming_distance', 'BKTree'] -__version__ = '1.0' +__version__ = '1.1' _getitem0 = itemgetter(0) diff --git a/setup.py b/setup.py index 835cc7c..cba06bf 100644 --- a/setup.py +++ b/setup.py @@ -2,11 +2,19 @@ import os import re +import sys from distutils.core import setup +# Read files as byte strings on Python 2.x, unicode strings on 3.x +if sys.version_info < (3, 0): + open_args = {} +else: + open_args = {'encoding': 'utf-8'} + + # Because it's best not to import the module in setup.py -with open(os.path.join(os.path.dirname(__file__), 'pybktree.py')) as f: +with open(os.path.join(os.path.dirname(__file__), 'pybktree.py'), **open_args) as f: for line in f: match = re.match(r"__version__.*'([0-9.]+)'", line) if match: @@ -17,7 +25,7 @@ # Read long_description from README.rst -with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as f: +with open(os.path.join(os.path.dirname(__file__), 'README.rst'), **open_args) as f: long_description = f.read()