From b355ecb59a44db1d90e57bb338ac9493f936283b Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 20 Jan 2018 08:54:51 -0500 Subject: Always encode text-based scripts to UTF-8. Fixes #1246. --- setuptools/command/easy_install.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'setuptools/command') diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index b7396b85..7f8c54dd 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -828,14 +828,15 @@ class easy_install(Command): target = os.path.join(self.script_dir, script_name) self.add_output(target) - if not self.dry_run: + if self.dry_run: return mask = current_umask() ensure_directory(target) if os.path.exists(target): os.unlink(target) - with open(target, "w" + mode) as f: + encoding = 'utf-8' if mode == 't' else None + with io.open(target, "w" + mode, encoding=encoding) as f: f.write(contents) chmod(target, 0o777 - mask) -- cgit v1.2.1