Skip to content

Commit

Permalink
Fixed package install error with Python 3.6 without locale.
Browse files Browse the repository at this point in the history
  • Loading branch information
mauritsvanrees committed Mar 10, 2020
1 parent 7bed774 commit 344c4f8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
3 changes: 3 additions & 0 deletions news/642.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Fixed package install error with Python 3.6 without locale.
See `coredev issue 642 <https://github.com/plone/buildout.coredev/issues/642#issuecomment-597008272>`_.
[maurits]
24 changes: 20 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,29 @@

version = '6.3.1.dev0'


def read(filename):
with open(filename) as myfile:
try:
return myfile.read()
except UnicodeDecodeError:
# Happens on one Jenkins node on Python 3.6,
# so maybe it happens for users too.
pass
# Opening and reading as text failed, so retry opening as bytes.
with open(filename, "rb") as myfile:
contents = myfile.read()
return contents.decode("utf-8")

long_description = (
open("README.rst").read() + "\n" + "Contributors\n"
"============\n"
read("README.rst")
+ "\n"
+ "Contributors\n"
+ "============\n"
+ "\n"
+ open("CONTRIBUTORS.rst").read()
+ read("CONTRIBUTORS.rst")
+ "\n"
+ open("CHANGES.rst").read()
+ read("CHANGES.rst")
+ "\n"
)

Expand Down

0 comments on commit 344c4f8

Please sign in to comment.