Skip to content

Commit

Permalink
Read README.rst as long_description and decode utf-8 strings
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaoming committed Oct 13, 2016
1 parent f6f95a9 commit 99a6008
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions setup.py
Expand Up @@ -3,6 +3,7 @@
from __future__ import absolute_import, unicode_literals

import os
import sys
from setuptools import find_packages, setup

from wiki import __version__
Expand All @@ -16,8 +17,13 @@ def get_path(fname):
return os.path.join(os.path.dirname(__file__), fname)


def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
def read_file(fname):
"""
Read file and decode in py2k
"""
if sys.version_info < (3,):
return open(fname).read().decode("utf-8")
return open(fname).read()


requirements = [
Expand All @@ -44,7 +50,7 @@ def read(fname):
license="GPLv3",
keywords=["django", "wiki", "markdown"],
packages=find_packages(exclude=["testproject", "testproject.*"]),
long_description=read('README'),
long_description=read_file('README.rst'),
zip_safe=False,
install_requires=requirements,
classifiers=[
Expand Down

0 comments on commit 99a6008

Please sign in to comment.