aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/command/install_egg_info.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2014-06-22 10:10:54 -0400
committerJason R. Coombs <jaraco@jaraco.com>2014-06-22 10:10:54 -0400
commit24978070e68c58dfd787b93d6f1e0a35f6871c52 (patch)
treea2f45563bad0468d94fb9eead82602d7fe061aa9 /setuptools/command/install_egg_info.py
parent17d0ff6e1f9d2efb134cac3fc734c0cf5fa55f68 (diff)
downloadexternal_python_setuptools-24978070e68c58dfd787b93d6f1e0a35f6871c52.tar.gz
external_python_setuptools-24978070e68c58dfd787b93d6f1e0a35f6871c52.tar.bz2
external_python_setuptools-24978070e68c58dfd787b93d6f1e0a35f6871c52.zip
Use short-circuit for less nesting
Diffstat (limited to 'setuptools/command/install_egg_info.py')
-rwxr-xr-xsetuptools/command/install_egg_info.py28
1 files changed, 15 insertions, 13 deletions
diff --git a/setuptools/command/install_egg_info.py b/setuptools/command/install_egg_info.py
index 67ba7453..6aba68be 100755
--- a/setuptools/command/install_egg_info.py
+++ b/setuptools/command/install_egg_info.py
@@ -83,19 +83,21 @@ class install_egg_info(Command):
filename += '-nspkg.pth'
self.outputs.append(filename)
log.info("Installing %s", filename)
- if not self.dry_run:
- f = open(filename, 'wt')
- for pkg in nsp:
- # ensure pkg is not a unicode string under Python 2.7
- pkg = str(pkg)
- pth = tuple(pkg.split('.'))
- tmpl_lines = self._nspkg_tmpl
- parent, sep, child = pkg.rpartition('.')
- if parent:
- tmpl_lines += self._nspkg_tmpl_multi
- dat = ';'.join(tmpl_lines) % locals() + '\n'
- f.write(dat)
- f.close()
+ if self.dry_run:
+ return
+
+ f = open(filename, 'wt')
+ for pkg in nsp:
+ # ensure pkg is not a unicode string under Python 2.7
+ pkg = str(pkg)
+ pth = tuple(pkg.split('.'))
+ tmpl_lines = self._nspkg_tmpl
+ parent, sep, child = pkg.rpartition('.')
+ if parent:
+ tmpl_lines += self._nspkg_tmpl_multi
+ dat = ';'.join(tmpl_lines) % locals() + '\n'
+ f.write(dat)
+ f.close()
def _get_all_ns_packages(self):
"""Return sorted list of all package namespaces"""