Skip to content

Commit

Permalink
Revert "Isolate .pex dir"
Browse files Browse the repository at this point in the history
This reverts commit 3484a8f reviewed at https://rbcommons.com/s/twitter/r/3135/

See github issue pantsbuild#2610 for problems with pex files created with this change.

Testing Done:
CI is running at https://travis-ci.org/pantsbuild/pants/builds/92756063

Bugs closed: 2610, 2611

Reviewed at https://rbcommons.com/s/twitter/r/3163/
  • Loading branch information
ericzundel committed Nov 23, 2015
1 parent 1778380 commit 307dbd4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 50 deletions.
18 changes: 3 additions & 15 deletions src/python/pants/backend/python/tasks/python_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,6 @@ def interpreter(self):
self._interpreter = self.select_interpreter(self._compatibilities)
return self._interpreter

def _wrap_pex_info(self, pex_info):
""" Update pex info with an isolated pex root.
Make sure that we do not interfere with a users personal pex root used
outside of pants. If pex info has no value then we use defaults and
change the root.
"""
pex_info = pex_info or PexInfo.default()
pex_info.pex_root = os.path.join(self.get_options().pants_workdir, '.pex')
return pex_info

def select_interpreter_for_targets(self, targets):
"""Pick an interpreter compatible with all the specified targets."""
allowed_interpreters = OrderedSet(self.interpreter_cache.interpreters)
Expand Down Expand Up @@ -152,20 +141,19 @@ def cached_chroot(self, interpreter, pex_info, targets, platforms=None,
"""
# This PexInfo contains any customizations specified by the caller.
# The process of building a pex modifies it further.
pex_info = self._wrap_pex_info(pex_info)
pex_info = pex_info or PexInfo.default()

path = self._chroot_path(interpreter, pex_info, targets, platforms, extra_requirements,
executable_file_content)
if not os.path.exists(path):
path_tmp = path + '.tmp'

self._build_chroot(path_tmp, interpreter, pex_info, targets, platforms,
extra_requirements, executable_file_content)
shutil.move(path_tmp, path)

# We must read the PexInfo that was frozen into the pex, so we get the modifications
# created when that pex was built.
pex_info = PexInfo.from_pex(path)
pex_info = self._wrap_pex_info(pex_info)
# Now create a PythonChroot wrapper without dumping it.
builder = PEXBuilder(path=path, interpreter=interpreter, pex_info=pex_info, copy=True)
return self.create_chroot(interpreter=interpreter,
Expand All @@ -178,7 +166,7 @@ def cached_chroot(self, interpreter, pex_info, targets, platforms=None,
def temporary_chroot(self, interpreter, pex_info, targets, platforms,
extra_requirements=None, executable_file_content=None):
path = tempfile.mkdtemp() # Not a contextmanager: chroot.delete() will clean this up anyway.
pex_info = self._wrap_pex_info(pex_info)
pex_info = pex_info or PexInfo.default()
chroot = self._build_chroot(path, interpreter, pex_info, targets, platforms,
extra_requirements, executable_file_content)
yield chroot
Expand Down
9 changes: 0 additions & 9 deletions tests/python/pants_test/bin/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,6 @@ python_tests(
]
)

python_tests(
name='pex_root',
sources=['test_pexroot.py'],
dependencies=[
'tests/python/pants_test:int-test',
'src/python/pants/util:contextutil',
]
)

python_tests(
name='repro',
sources=['test_repro.py'],
Expand Down
26 changes: 0 additions & 26 deletions tests/python/pants_test/bin/test_pexroot.py

This file was deleted.

0 comments on commit 307dbd4

Please sign in to comment.