Skip to content

Commit

Permalink
Minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Lionel Vital authored and Chris Livingston committed Jan 30, 2018
1 parent dd99194 commit 4e2b1b9
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/python/pants/backend/python/tasks/pex_build_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
unicode_literals, with_statement)

import os
import zipfile

from pex.bin import pex as pex_main
from pex.fetcher import Fetcher
Expand Down Expand Up @@ -133,21 +134,16 @@ def build_python_distribution_from_target(target, workdir):

pydist_workdir = os.path.join(workdir, '.pydistworkdir')
safe_mkdir(pydist_workdir)
prevdir = os.getcwd()
os.chdir(pydist_workdir)
pex_name = "%s.pex" % target.name

args = ['--disable-cache', '/Users/clivingston/workspace/pants/examples/src/python/example/python_distribution/hello/superhello', '-o', pex_name]
try:
pex_main.main(args=args)
except SystemExit as e:
error_code = e.code
raise TaskError(e)
except Exception as e:
exception = e
raise TaskError(e)

import zipfile
zip_ref = zipfile.ZipFile(os.path.join(pydist_workdir, pex_name), 'r')
safe_mkdir(os.path.join(pydist_workdir, pex_name + '_chroot'))
zip_ref.extractall(os.path.join(pydist_workdir, pex_name + '_chroot'))
Expand All @@ -157,7 +153,6 @@ def build_python_distribution_from_target(target, workdir):
whl_file = [wheel for wheel in contents if target.name in wheel]
whl_location = os.path.join(pydist_workdir, pex_name + '_chroot', '.deps', whl_file[0])

os.chdir(prevdir)
return whl_location


Expand Down

0 comments on commit 4e2b1b9

Please sign in to comment.