aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/command/easy_install.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2015-08-19 19:58:12 +0100
committerJason R. Coombs <jaraco@jaraco.com>2015-08-19 19:58:12 +0100
commit5cbb2ada2e22f95b1dd0cd8ed14643a8cb3766cd (patch)
tree37de81a4d412e9a33ecc3ad3a0081db72c3f9fb5 /setuptools/command/easy_install.py
parent50aaf9938a4437db7f2949df6ecb6460c789ff28 (diff)
downloadexternal_python_setuptools-5cbb2ada2e22f95b1dd0cd8ed14643a8cb3766cd.tar.gz
external_python_setuptools-5cbb2ada2e22f95b1dd0cd8ed14643a8cb3766cd.tar.bz2
external_python_setuptools-5cbb2ada2e22f95b1dd0cd8ed14643a8cb3766cd.zip
Calculate prelude and postlude early
Diffstat (limited to 'setuptools/command/easy_install.py')
-rwxr-xr-xsetuptools/command/easy_install.py33
1 files changed, 17 insertions, 16 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index 0e912156..b6b0cffd 100755
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -1547,25 +1547,26 @@ class PthDistributions(Environment):
self.dirty = False
- def _wrap_lines(self, lines):
- yield self._inline("""
- import sys
- sys.__plen = len(sys.path)
- """)
+ @classmethod
+ def _wrap_lines(cls, lines):
+ yield cls.prelude
for line in lines:
yield line
- yield self._inline("""
- import sys
- new = sys.path[sys.__plen:]
- del sys.path[sys.__plen:]
- p = getattr(sys, '__egginsert', 0)
- sys.path[p:p] = new
- sys.__egginsert = p + len(new)
- """)
+ yield cls.postlude
- @staticmethod
- def _inline(text):
- return textwrap.dedent(text).strip().replace('\n', '; ')
+ _inline = lambda text: textwrap.dedent(text).strip().replace('\n', '; ')
+ prelude = _inline("""
+ import sys
+ sys.__plen = len(sys.path)
+ """)
+ postlude = _inline("""
+ import sys
+ new = sys.path[sys.__plen:]
+ del sys.path[sys.__plen:]
+ p = getattr(sys, '__egginsert', 0)
+ sys.path[p:p] = new
+ sys.__egginsert = p + len(new)
+ """)
def add(self, dist):
"""Add `dist` to the distribution map"""