diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2018-01-20 08:41:57 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2018-01-20 08:41:57 -0500 |
commit | 618312bec376e5c71b0938a754106973d8889417 (patch) | |
tree | ec7acddd218e0bfd1160a606ff2775a5b4e0cd8e /setuptools/command/easy_install.py | |
parent | de000c41dbc110839c794337808ad98c1097b263 (diff) | |
download | python-setuptools-git-618312bec376e5c71b0938a754106973d8889417.tar.gz |
Refactor to short-circuit on dry-run
Diffstat (limited to 'setuptools/command/easy_install.py')
-rwxr-xr-x | setuptools/command/easy_install.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index b691e702..b7396b85 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -828,14 +828,16 @@ class easy_install(Command): target = os.path.join(self.script_dir, script_name) self.add_output(target) - mask = current_umask() if not self.dry_run: - ensure_directory(target) - if os.path.exists(target): - os.unlink(target) - with open(target, "w" + mode) as f: - f.write(contents) - chmod(target, 0o777 - mask) + return + + mask = current_umask() + ensure_directory(target) + if os.path.exists(target): + os.unlink(target) + with open(target, "w" + mode) as f: + f.write(contents) + chmod(target, 0o777 - mask) def install_eggs(self, spec, dist_filename, tmpdir): # .egg dirs or files are already built, so just return them |