Skip to content

Commit

Permalink
Read setup.cfg into unicode object
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Wilhelm authored and Florian Wilhelm committed Feb 26, 2015
1 parent 8f7ef2c commit 351923a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion pyscaffold/data/setup_py.template
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,12 @@ def get_install_requirements(path):


def read(fname):
return open(os.path.join(__location__, fname)).read()
with open(os.path.join(__location__, fname)) as fh:
content = fh.read()
# StringIO seems to expect a unicode object under Windows 7
if sys.version_info[0] < 3:
content = content.decode(encoding='utf8')
return content


def str2bool(val):
Expand Down
7 changes: 6 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,12 @@ def get_install_requirements(path):


def read(fname):
return open(os.path.join(__location__, fname)).read()
with open(os.path.join(__location__, fname)) as fh:
content = fh.read()
# StringIO seems to expect a unicode object under Windows 7
if sys.version_info[0] < 3:
content = content.decode(encoding='utf8')
return content


def str2bool(val):
Expand Down

0 comments on commit 351923a

Please sign in to comment.