From 4075c921085cd2fa9235c57cfec5c21f2a734bdf Mon Sep 17 00:00:00 2001 From: Guannan Ma Date: Tue, 10 Dec 2019 11:21:39 +0800 Subject: [PATCH] for py3 compatible --- setup.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 3e0b6ad..250a615 100644 --- a/setup.py +++ b/setup.py @@ -9,6 +9,7 @@ import os import re import sys +import platform import textwrap import traceback import setuptools @@ -24,8 +25,13 @@ print(traceback.print_exc()) exit(-1) -with open('README.md', 'r', encoding='utf-8') as fh: - LONG_DESCRIPTION = fh.read() +LONG_DESCRIPTION = None +if platform.python_version() < str(3): + with open('README.md', 'r') as fh: + LONG_DESCRIPTION = fh.read() +else: + with open('README.md', 'r', encoding='utf-8') as fh: + LONG_DESCRIPTION = fh.read() # Guannan add windows platform support on 2014/11/4 20:04 def _find_packages(prefix=''): @@ -34,6 +40,8 @@ def _find_packages(prefix=''): path = '.' prefix = prefix for root, _, files in os.walk(path): + if root.find('examples') >= 0: + continue if '__init__.py' in files: item = None if sys.platform.startswith('linux'):