Skip to content

Commit

Permalink
Mention name of binary we can't find
Browse files Browse the repository at this point in the history
This gives better debugging information for what went wrong.
  • Loading branch information
illicitonion committed Oct 6, 2017
1 parent 5d1dd81 commit a844e3d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/python/pants/binaries/binary_util.py
Expand Up @@ -103,8 +103,9 @@ def _select_binary_base_path(self, supportdir, version, name, uname_func=None):
try:
middle_path = self._path_by_id[os_id]
except KeyError:
raise self.MissingMachineInfo('Update --binaries-path-by-id to find binaries for {!r}'
.format(os_id))
raise self.MissingMachineInfo(('Unable to find binary {name} version {version}. ' +
'Update --binaries-path-by-id to find binaries for {os_id!r}')
.format(name=name, version=version, os_id=os_id))
return os.path.join(supportdir, *(middle_path + (version, name)))

def __init__(self, baseurls, timeout_secs, bootstrapdir, path_by_id=None):
Expand Down
6 changes: 3 additions & 3 deletions tests/python/pants_test/binaries/test_binary_util.py
Expand Up @@ -165,7 +165,7 @@ def uname_func():

with self.assertRaisesRegexp(BinaryUtil.MissingMachineInfo,
r'Pants has no binaries for vms'):
binary_util._select_binary_base_path("supportdir", "name", "version", uname_func=uname_func)
binary_util._select_binary_base_path("supportdir", "version", "name", uname_func=uname_func)

def test_select_binary_base_path_missing_version(self):
binary_util = BinaryUtil([], 0, '/tmp')
Expand All @@ -175,9 +175,9 @@ def uname_func():

os_id = ('darwin', '999')
with self.assertRaisesRegexp(BinaryUtil.MissingMachineInfo,
r'Update --binaries-path-by-id to find binaries for '
r'myname.*Update --binaries-path-by-id to find binaries for '
r'{}'.format(re.escape(repr(os_id)))):
binary_util._select_binary_base_path("supportdir", "name", "version", uname_func=uname_func)
binary_util._select_binary_base_path("supportdir", "myversion", "myname", uname_func=uname_func)

def test_select_binary_base_path_override(self):
binary_util = BinaryUtil([], 0, '/tmp',
Expand Down

0 comments on commit a844e3d

Please sign in to comment.