From 990720bc8a2e262023dd1a740c3a3ada4825e413 Mon Sep 17 00:00:00 2001 From: Julien Malard Date: Fri, 17 Aug 2018 12:51:49 -0400 Subject: [PATCH 1/5] Fix unicode error on Windows This fixes an issue reported to setuptools that prevents the installation of packages containing unicode module or package names in Windows: https://github.com/pypa/setuptools/issues/1399 --- Lib/distutils/log.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Lib/distutils/log.py b/Lib/distutils/log.py index b301a8338c20db..3a6602bc8b8ef6 100644 --- a/Lib/distutils/log.py +++ b/Lib/distutils/log.py @@ -31,7 +31,10 @@ def _log(self, level, msg, args): # emulate backslashreplace error handler encoding = stream.encoding msg = msg.encode(encoding, "backslashreplace").decode(encoding) - stream.write('%s\n' % msg) + try: + stream.write('%s\n' % msg) + except UnicodeEncodeError: + stream.write('%s\n' % msg.encode('unicode-escape').decode('ascii')) stream.flush() def log(self, level, msg, *args): From 825a483e1aef0062579d0f55e47009a267fc21fb Mon Sep 17 00:00:00 2001 From: Julien Malard Date: Fri, 7 Sep 2018 11:40:02 -0400 Subject: [PATCH 2/5] Create 2018-09-07-10-57-00.bpo-34421.AKJISD.rst --- .../next/Windows/2018-09-07-10-57-00.bpo-34421.AKJISD.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Windows/Misc/NEWS.d/next/Windows/2018-09-07-10-57-00.bpo-34421.AKJISD.rst diff --git a/Misc/NEWS.d/next/Windows/Misc/NEWS.d/next/Windows/2018-09-07-10-57-00.bpo-34421.AKJISD.rst b/Misc/NEWS.d/next/Windows/Misc/NEWS.d/next/Windows/2018-09-07-10-57-00.bpo-34421.AKJISD.rst new file mode 100644 index 00000000000000..20bd5418b71793 --- /dev/null +++ b/Misc/NEWS.d/next/Windows/Misc/NEWS.d/next/Windows/2018-09-07-10-57-00.bpo-34421.AKJISD.rst @@ -0,0 +1,2 @@ +Fixed installation issue with setuptools setuptools that crashed with +packages containing unicode module or package names in Windows. From eb398369e81574ce4026014a2c382e8ef3f724de Mon Sep 17 00:00:00 2001 From: Julien Malard Date: Fri, 7 Sep 2018 11:44:55 -0400 Subject: [PATCH 3/5] Create 2018-09-07-10-57-00.bpo-34421.AKJISD.rst --- .../next/Library/2018-09-07-10-57-00.bpo-34421.AKJISD.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2018-09-07-10-57-00.bpo-34421.AKJISD.rst diff --git a/Misc/NEWS.d/next/Library/2018-09-07-10-57-00.bpo-34421.AKJISD.rst b/Misc/NEWS.d/next/Library/2018-09-07-10-57-00.bpo-34421.AKJISD.rst new file mode 100644 index 00000000000000..5d66ae23e998fb --- /dev/null +++ b/Misc/NEWS.d/next/Library/2018-09-07-10-57-00.bpo-34421.AKJISD.rst @@ -0,0 +1,2 @@ +Fixed installation issue with setuptools distutils that crashed with +packages containing unicode module or package names in Windows. From 0b44dc9239b3804b2b8574d127c63647e4d4dd76 Mon Sep 17 00:00:00 2001 From: Julien Malard Date: Fri, 7 Sep 2018 11:45:02 -0400 Subject: [PATCH 4/5] Delete 2018-09-07-10-57-00.bpo-34421.AKJISD.rst --- .../next/Windows/2018-09-07-10-57-00.bpo-34421.AKJISD.rst | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 Misc/NEWS.d/next/Windows/Misc/NEWS.d/next/Windows/2018-09-07-10-57-00.bpo-34421.AKJISD.rst diff --git a/Misc/NEWS.d/next/Windows/Misc/NEWS.d/next/Windows/2018-09-07-10-57-00.bpo-34421.AKJISD.rst b/Misc/NEWS.d/next/Windows/Misc/NEWS.d/next/Windows/2018-09-07-10-57-00.bpo-34421.AKJISD.rst deleted file mode 100644 index 20bd5418b71793..00000000000000 --- a/Misc/NEWS.d/next/Windows/Misc/NEWS.d/next/Windows/2018-09-07-10-57-00.bpo-34421.AKJISD.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fixed installation issue with setuptools setuptools that crashed with -packages containing unicode module or package names in Windows. From d6a17886ee8c31b3f4dfc9aac798c57801ba336d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Fri, 7 Sep 2018 11:52:45 -0400 Subject: [PATCH 5/5] Update news --- .../next/Library/2018-09-07-10-57-00.bpo-34421.AKJISD.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Misc/NEWS.d/next/Library/2018-09-07-10-57-00.bpo-34421.AKJISD.rst b/Misc/NEWS.d/next/Library/2018-09-07-10-57-00.bpo-34421.AKJISD.rst index 5d66ae23e998fb..cc1db086f0c469 100644 --- a/Misc/NEWS.d/next/Library/2018-09-07-10-57-00.bpo-34421.AKJISD.rst +++ b/Misc/NEWS.d/next/Library/2018-09-07-10-57-00.bpo-34421.AKJISD.rst @@ -1,2 +1 @@ -Fixed installation issue with setuptools distutils that crashed with -packages containing unicode module or package names in Windows. +Fix distutils logging for non-ASCII strings. This caused installation issues on Windows.