From bef973d85e3a81979a003a9bac8d17043af7a82d Mon Sep 17 00:00:00 2001 From: Alexis M Date: Mon, 16 Sep 2019 18:54:10 +0200 Subject: Fix setup.py encoding to be py2 and py3 compatible. --- setup.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index ad441c0..63596c4 100644 --- a/setup.py +++ b/setup.py @@ -1,16 +1,13 @@ # -*- coding: utf-8 -*- import os +import sys + +from io import open from setuptools import setup, find_packages here = os.path.abspath(os.path.dirname(__file__)) -def read_file(filename): - """Open a related file and return its content.""" - with open(os.path.join(here, filename), "r") as f: - return f.read() - - def parse_requirements(filename): """ load requirements from a pip requirements file """ with open(filename) as lines: @@ -18,7 +15,12 @@ def parse_requirements(filename): return [line for line in lineiter if line and not line.startswith("#")] -README = read_file('README.rst') +README = open('README.rst', encoding='utf-8').read() +CHANGELOG = open('CHANGELOG.rst', encoding='utf-8').read() + +description = u'\n'.join([README, CHANGELOG]) +if sys.version_info.major < 3: + description = description.encode('utf-8') ENTRY_POINTS = { 'paste.app_factory': [ @@ -33,7 +35,7 @@ ENTRY_POINTS = { setup(name='ihatemoney', version='4.1', description='A simple shared budget manager web application.', - long_description=README, + long_description=description, license='Custom BSD Beerware', classifiers=[ "Programming Language :: Python", -- cgit v1.1