From e72afd6243713cd0d3f8a5bc5b50fb59934d7ff8 Mon Sep 17 00:00:00 2001 From: Benoit Pierre Date: Sun, 26 Nov 2017 23:11:14 +0100 Subject: fix encoding handling of wheels metadata --- setuptools/tests/files.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'setuptools/tests/files.py') diff --git a/setuptools/tests/files.py b/setuptools/tests/files.py index 98de9fc3..75ec740d 100644 --- a/setuptools/tests/files.py +++ b/setuptools/tests/files.py @@ -1,6 +1,7 @@ import os +from pkg_resources.extern.six import binary_type import pkg_resources.py31compat @@ -30,5 +31,9 @@ def build_files(file_defs, prefix=""): pkg_resources.py31compat.makedirs(full_name, exist_ok=True) build_files(contents, prefix=full_name) else: - with open(full_name, 'w') as f: - f.write(contents) + if isinstance(contents, binary_type): + with open(full_name, 'wb') as f: + f.write(contents) + else: + with open(full_name, 'w') as f: + f.write(contents) -- cgit v1.2.3