py-appdirs: patch for encoding issue (#28253)

Reading appdirs.py without explicitly requesting UTF-8 decoding results
in the build process to fail for Python 3.6.

See https://github.com/ActiveState/appdirs/pull/152 for the upstream
fix.
This commit is contained in:
Severin Strobl 2022-01-05 18:59:12 +01:00 committed by GitHub
parent 3e992aa283
commit f064c5ee4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,21 @@
diff --git a/setup.py b/setup.py
index 293c1c4..122cd04 100644
--- a/setup.py
+++ b/setup.py
@@ -2,6 +2,7 @@
import sys
import os
import os.path
+from io import open
# appdirs is a dependency of setuptools, so allow installing without it.
try:
from setuptools import setup
@@ -15,7 +16,7 @@ if sys.version_info < (2, 7):
def read(fname):
- inf = open(os.path.join(os.path.dirname(__file__), fname))
+ inf = open(os.path.join(os.path.dirname(__file__), fname), encoding='utf8')
out = "\n" + inf.read().replace("\r\n", "\n")
inf.close()
return out

View File

@ -18,4 +18,5 @@ class PyAppdirs(PythonPackage):
version('1.4.0', sha256='8fc245efb4387a4e3e0ac8ebcc704582df7d72ff6a42a53f5600bbb18fdaadc5') version('1.4.0', sha256='8fc245efb4387a4e3e0ac8ebcc704582df7d72ff6a42a53f5600bbb18fdaadc5')
patch('setuptools-import.patch', when='@:1.4.0') patch('setuptools-import.patch', when='@:1.4.0')
patch('decode-appdirs.patch', when='@1.4.4')
depends_on('py-setuptools', type='build') depends_on('py-setuptools', type='build')