summaryrefslogtreecommitdiff
path: root/setuptools/command/easy_install.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2018-01-20 08:54:51 -0500
committerJason R. Coombs <jaraco@jaraco.com>2018-01-20 08:54:51 -0500
commitb355ecb59a44db1d90e57bb338ac9493f936283b (patch)
treea2dd923f16f0545a8784f9ce5108096e866d4cfc /setuptools/command/easy_install.py
parent618312bec376e5c71b0938a754106973d8889417 (diff)
downloadpython-setuptools-git-feature/1246-utf-8-in-scripts.tar.gz
Always encode text-based scripts to UTF-8. Fixes #1246.feature/1246-utf-8-in-scripts
Diffstat (limited to 'setuptools/command/easy_install.py')
-rwxr-xr-xsetuptools/command/easy_install.py5
1 files changed, 3 insertions, 2 deletions
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)