Skip to content

Commit 295c348

Browse files
committed
Add Py2 setup.py support
1 parent 3500cdb commit 295c348

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

setup.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
# coding: utf-8
22
from distutils.version import LooseVersion
3-
43
from setuptools import find_packages, setup
4+
import sys
5+
from os import path
56

67
# Import README.md into long_description
7-
from os import path
8-
this_directory = path.abspath(path.dirname(__file__))
9-
with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
10-
long_description = f.read()
8+
pwd = path.abspath(path.dirname(__file__))
9+
10+
if sys.version_info[0] > 2:
11+
with open(path.join(pwd, 'README.md'), encoding='utf-8') as f:
12+
long_description = f.read()
13+
else:
14+
with open(path.join(pwd, 'README.md')) as f:
15+
long_description = f.read()
1116

1217

1318
def check_setuptools():

0 commit comments

Comments
 (0)