MCPcopy Create free account
hub / github.com/boostorg/build / get_invocation_command_nodefault

Function get_invocation_command_nodefault

src/tools/common.py:285–321  ·  view source on GitHub ↗

A helper rule to get the command to invoke some tool. If 'user-provided-command' is not given, tries to find binary named 'tool' in PATH and in the passed 'additional-path'. Otherwise, verifies that the first element of 'user-provided-command' is an existing program.

(
    toolset, tool, user_provided_command=[], additional_paths=[], path_last=False)

Source from the content-addressed store, hash-verified

283
284# Ported from trunk@47077
285def get_invocation_command_nodefault(
286 toolset, tool, user_provided_command=[], additional_paths=[], path_last=False):
287 """
288 A helper rule to get the command to invoke some tool. If
289 'user-provided-command' is not given, tries to find binary named 'tool' in
290 PATH and in the passed 'additional-path'. Otherwise, verifies that the first
291 element of 'user-provided-command' is an existing program.
292
293 This rule returns the command to be used when invoking the tool. If we can't
294 find the tool, a warning is issued. If 'path-last' is specified, PATH is
295 checked after 'additional-paths' when searching for 'tool'.
296 """
297 assert isinstance(toolset, basestring)
298 assert isinstance(tool, basestring)
299 assert is_iterable_typed(user_provided_command, basestring)
300 assert is_iterable_typed(additional_paths, basestring) or additional_paths is None
301 assert isinstance(path_last, (int, bool))
302
303 if not user_provided_command:
304 command = find_tool(tool, additional_paths, path_last)
305 if not command and __debug_configuration:
306 print "warning: toolset", toolset, "initialization: can't find tool, tool"
307 #FIXME
308 #print "warning: initialized from" [ errors.nearest-user-location ] ;
309 else:
310 command = check_tool(user_provided_command)
311 if not command and __debug_configuration:
312 print "warning: toolset", toolset, "initialization:"
313 print "warning: can't find user-provided command", user_provided_command
314 #FIXME
315 #ECHO "warning: initialized from" [ errors.nearest-user-location ]
316 command = []
317 command = ' '.join(command)
318
319 assert(isinstance(command, str))
320
321 return command
322
323# ported from trunk@47174
324def get_invocation_command(toolset, tool, user_provided_command = [],

Callers 1

get_invocation_commandFunction · 0.85

Calls 3

is_iterable_typedFunction · 0.90
find_toolFunction · 0.85
check_toolFunction · 0.85

Tested by

no test coverage detected