Fix bash-completion goal when run from sdist/pex. Also add tests, and beef up &

Review Request #2403 - Created June 22, 2015 and submitted

Andy Reitz
benjyw, ity, jsirois, patricklaw, stuhood, zundel

When running the latest pants from a PEX inside of Twitter, I noticed that the new bash-completion goal didn't work. This sort of error is actually hard to detect, so I added the ability to test releases, and then used this to show that my fix for bash-completion is correct.

New output from

[== 00:57 Installing and testing package pantsbuild.pants.contrib.spindle-0.0.33 ... ==]

You are using pip version 6.1.1, however version 7.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
/var/folders/1c/zrk9_1hs2k16fkxssdx800gr0000gn/T/pants.XXXXX.hizmtZzH/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see
INFO] Detected git repository at /Users/andyr/workspace/pants on branch master

Optional: If you want to poke around with the new version of pants that has been
built and installed in a temporary virtualenv, fire up another shell window and

  source /var/folders/1c/zrk9_1hs2k16fkxssdx800gr0000gn/T/pants.XXXXX.hizmtZzH/bin/activate
  cd /Users/andyr/workspace/pants

From there, you can run 'pants' (not './pants') to do some testing.

When you're done testing, press enter to continue.

[== 01:12 Dry run release succeeded. ==]

Running -t venv:

This will test pantsbuild.pants==0.0.33:

(pants.XXXXX.r6ax6tyS)[drift pants (master)]$ pants bash-completion
INFO] Detected git repository at /Users/andyr/workspace/pants on branch master

Exception caught:
  File "/var/folders/1c/zrk9_1hs2k16fkxssdx800gr0000gn/T/pants.XXXXX.r6ax6tyS/bin/pants", line 9, in <module>
    load_entry_point('pantsbuild.pants==0.0.33', 'console_scripts', 'pants')()
  File "/var/folders/1c/zrk9_1hs2k16fkxssdx800gr0000gn/T/pants.XXXXX.r6ax6tyS/lib/python2.7/site-packages/pants/bin/", line 81, in main
  File "/var/folders/1c/zrk9_1hs2k16fkxssdx800gr0000gn/T/pants.XXXXX.r6ax6tyS/lib/python2.7/site-packages/pants/bin/", line 74, in _run
    result =
  File "/var/folders/1c/zrk9_1hs2k16fkxssdx800gr0000gn/T/pants.XXXXX.r6ax6tyS/lib/python2.7/site-packages/pants/bin/", line 218, in run
    result = self._do_run()
  File "/var/folders/1c/zrk9_1hs2k16fkxssdx800gr0000gn/T/pants.XXXXX.r6ax6tyS/lib/python2.7/site-packages/pants/bin/", line 275, in _do_run
    return engine.execute(context, self.goals)
  File "/var/folders/1c/zrk9_1hs2k16fkxssdx800gr0000gn/T/pants.XXXXX.r6ax6tyS/lib/python2.7/site-packages/pants/engine/", line 26, in execute
    self.attempt(context, goals)
  File "/var/folders/1c/zrk9_1hs2k16fkxssdx800gr0000gn/T/pants.XXXXX.r6ax6tyS/lib/python2.7/site-packages/pants/engine/", line 212, in attempt
  File "/var/folders/1c/zrk9_1hs2k16fkxssdx800gr0000gn/T/pants.XXXXX.r6ax6tyS/lib/python2.7/site-packages/pants/engine/", line 45, in attempt
  File "/var/folders/1c/zrk9_1hs2k16fkxssdx800gr0000gn/T/pants.XXXXX.r6ax6tyS/lib/python2.7/site-packages/pants/backend/core/tasks/", line 56, in execute
    for value in self.console_output(targets):
  File "/var/folders/1c/zrk9_1hs2k16fkxssdx800gr0000gn/T/pants.XXXXX.r6ax6tyS/lib/python2.7/site-packages/pants/backend/core/tasks/", line 111, in console_output
    resource_string(__name__, os.path.join('templates', 'bash_completion', '')),
  File "/var/folders/1c/zrk9_1hs2k16fkxssdx800gr0000gn/T/pants.XXXXX.r6ax6tyS/lib/python2.7/site-packages/", line 966, in resource_string
    self, resource_name
  File "/var/folders/1c/zrk9_1hs2k16fkxssdx800gr0000gn/T/pants.XXXXX.r6ax6tyS/lib/python2.7/site-packages/", line 1393, in get_resource_string
    return self._get(self._fn(self.module_path, resource_name))
  File "/var/folders/1c/zrk9_1hs2k16fkxssdx800gr0000gn/T/pants.XXXXX.r6ax6tyS/lib/python2.7/site-packages/", line 1514, in _get
    with open(path, 'rb') as stream:

Exception message: [Errno 2] No such file or directory: u'/var/folders/1c/zrk9_1hs2k16fkxssdx800gr0000gn/T/pants.XXXXX.r6ax6tyS/lib/python2.7/site-packages/pants/backend/core/tasks/templates/bash_completion/'

Running -n venv:

This will build new sdists off of HEAD, and install them in a virtualenv:

(pants.XXXXX.mYzg1nQq)[drift pants (master)]$ pants bash-completion
INFO] Detected git repository at /Users/andyr/workspace/pants on branch master
# Copyright 2014 Pants project contributors (see


  • 0
  • 3
  • 0
  • 3
Description From Last Updated
John Sirois
Andy Reitz
Andy Reitz
Eric Ayers
Andy Reitz
Andy Reitz
Stu Hood
Stu Hood
Andy Reitz
Tom Dyas
Eric Ayers
Andy Reitz
Andy Reitz
Review request changed

Status: Closed (submitted)

Andy Reitz

Thanks folks, submitted @ 31c182098734ac4cb0a90e81d22d3b4704ec75e1