def _select_binary_base_path(self, supportdir, version, name, uname_func=None): """Calculate the base path. Exposed for associated unit tests. :param supportdir: the path used to make a path under --pants_bootstrapdir. :param version: the version number of the tool used to make a path under --pants-bootstrapdir. :param name: name of the binary to search for. (e.g 'protoc') :param uname_func: method to use to emulate os.uname() in testing :returns: Base path used to select the binary file. """ uname_func = uname_func or os.uname os_id = get_os_id(uname_func=uname_func) if not os_id: raise self.MissingMachineInfo( 'Pants has no binaries for {}'.format(' '.join(uname_func()))) try: middle_path = self._path_by_id[os_id] except KeyError: 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 _select_binary_base_path(self, supportdir, version, name, uname_func=None): """Calculate the base path. Exposed for associated unit tests. :param supportdir: the path used to make a path under --pants_bootstrapdir. :param version: the version number of the tool used to make a path under --pants-bootstrapdir. :param name: name of the binary to search for. (e.g 'protoc') :param uname_func: method to use to emulate os.uname() in testing :returns: Base path used to select the binary file. """ uname_func = uname_func or os.uname sysname, _, release, _, machine = uname_func() try: os_id = get_os_id(uname_func=uname_func) except KeyError: os_id = None if os_id is None: raise self.MissingMachineInfo("Pants has no binaries for {}".format(sysname)) try: middle_path = self._path_by_id[os_id] except KeyError: raise self.MissingMachineInfo( "Update --binaries-path-by-id to find binaries for {sysname} {machine} {release}.".format( sysname=sysname, release=release, machine=machine)) return os.path.join(supportdir, *(middle_path + [version, name]))
def _select_binary_base_path(self, supportdir, version, name, uname_func=None): """Calculate the base path. Exposed for associated unit tests. :param supportdir: the path used to make a path under --pants_bootstrapdir. :param version: the version number of the tool used to make a path under --pants-bootstrapdir. :param name: name of the binary to search for. (e.g 'protoc') :param uname_func: method to use to emulate os.uname() in testing :returns: Base path used to select the binary file. """ uname_func = uname_func or os.uname sysname, _, release, _, machine = uname_func() try: os_id = get_os_id(uname_func=uname_func) except KeyError: os_id = None if os_id is None: raise self.MissingMachineInfo("Pants has no binaries for {}".format(sysname)) try: middle_path = self._path_by_id[os_id] except KeyError: raise self.MissingMachineInfo( "Update --binaries-path-by-id to find binaries for {sysname} {machine} {release}.".format( sysname=sysname, release=release, machine=machine)) return os.path.join(supportdir, *(middle_path + [version, name]))
def _select_binary_base_path(self, supportdir, version, name, uname_func=None): """Calculate the base path. Exposed for associated unit tests. :param supportdir: the path used to make a path under --pants_bootstrapdir. :param version: the version number of the tool used to make a path under --pants-bootstrapdir. :param name: name of the binary to search for. (e.g 'protoc') :param uname_func: method to use to emulate os.uname() in testing :returns: Base path used to select the binary file. """ uname_func = uname_func or os.uname os_id = get_os_id(uname_func=uname_func) if not os_id: raise self.MissingMachineInfo('Pants has no binaries for {}'.format(' '.join(uname_func()))) try: middle_path = self._path_by_id[os_id] except KeyError: 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)))