Skip to content

Commit

Permalink
Fix possible UnicodeDecodeError getting the long description.
Browse files Browse the repository at this point in the history
  • Loading branch information
mauritsvanrees committed Aug 24, 2020
1 parent 846adab commit a4413ae
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,34 @@

version = '2.0.3.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 = "\n".join(
[
read("README.rst"),
read("CHANGES.rst"),
]
)


setup(
name='Products.CMFPlacefulWorkflow',
version=version,
description="Workflow policies for Plone",
long_description=(open("README.rst").read() + "\n" +
open("CHANGES.rst").read()),
long_description=long_description,
classifiers=[
"Development Status :: 5 - Production/Stable",
"Framework :: Plone",
Expand Down

0 comments on commit a4413ae

Please sign in to comment.