Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix python3 setup when system encoding is not utf-8 #120

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import io
import os
import re
import sys
Expand Down Expand Up @@ -32,10 +33,9 @@ def getPackageInfo():
key_remap = {"name": "pypi_name"}

# __about__
with open(os.path.join(os.path.abspath(os.path.dirname(__file__)),
"./src",
"eyed3",
"__about__.py")) as infof:
info_fpath = os.path.join(os.path.abspath(os.path.dirname(__file__)),
"src", "eyed3", "__about__.py")
with io.open(info_fpath, encoding='utf-8') as infof:
for line in infof:
for what in info_keys:
rex = re.compile(r"__{what}__\s*=\s*['\"](.*?)['\"]"
Expand Down Expand Up @@ -64,11 +64,11 @@ def getPackageInfo():
# Info
readme = ""
if os.path.exists("README.rst"):
with open("README.rst") as readme_file:
with io.open("README.rst", encoding='utf-8') as readme_file:
readme = readme_file.read()
history = ""
if os.path.exists("HISTORY.rst"):
with open("HISTORY.rst") as history_file:
with io.open("HISTORY.rst", encoding='utf-8') as history_file:
history = history_file.read().replace(".. :changelog:", "")
info_dict["long_description"] = readme + "\n\n" + history

Expand All @@ -80,7 +80,7 @@ def requirements_yaml():
reqs = {}
reqfile = os.path.join("requirements", "requirements.yml")
if os.path.exists(reqfile):
with open(reqfile) as fp:
with io.open(reqfile, encoding='utf-8') as fp:
curr = None
for line in [l for l in [l.strip() for l in fp.readlines()]
if l and not l.startswith("#")]:
Expand Down