Skip to content

Commit

Permalink
Update cache dir when bdist_pex.run called directly (#278 fixes #274).
Browse files Browse the repository at this point in the history
* Add unit test to make sure {pex_root} directory is not created
* Update the cache_dir in bdist_pex
  • Loading branch information
digwanderlust authored and kwlzn committed Jun 9, 2016
1 parent 81a6500 commit 0e1abf7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pex/commands/bdist_pex.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from setuptools import Command

from pex.bin.pex import build_pex, configure_clp
from pex.bin.pex import build_pex, configure_clp, make_relative_to_root
from pex.common import die
from pex.compatibility import ConfigParser, StringIO, string
from pex.variables import ENV
Expand Down Expand Up @@ -74,6 +74,10 @@ def run(self):

options, reqs = parser.parse_args(self.pex_args)

# Update cache_dir with pex_root in case this is being called directly.
if options.cache_dir:
options.cache_dir = make_relative_to_root(options.cache_dir)

if options.entry_point or options.script:
die('Must not specify entry_point or script to --pex-args')

Expand Down
1 change: 1 addition & 0 deletions tests/test_bdist_pex.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def do_something():
process = subprocess.Popen([os.path.join(project_dir, 'dist', 'my_app-0.0.0.pex')],
stdout=subprocess.PIPE)
stdout, _ = process.communicate()
assert '{pex_root}' not in os.listdir(project_dir)
assert 0 == process.returncode
assert stdout == b'hello world!\n'

Expand Down

0 comments on commit 0e1abf7

Please sign in to comment.