MCPcopy Create free account
hub / github.com/nodejs/node / ResolveTarget

Function ResolveTarget

tools/gyp/pylib/gyp/common.py:75–107  ·  view source on GitHub ↗
(build_file, target, toolset)

Source from the content-addressed store, hash-verified

73
74
75def ResolveTarget(build_file, target, toolset):
76 # This function resolves a target into a canonical form:
77 # - a fully defined build file, either absolute or relative to the current
78 # directory
79 # - a target name
80 # - a toolset
81 #
82 # build_file is the file relative to which 'target' is defined.
83 # target is the qualified target.
84 # toolset is the default toolset for that target.
85 [parsed_build_file, target, parsed_toolset] = ParseQualifiedTarget(target)
86
87 if parsed_build_file:
88 if build_file:
89 # If a relative path, parsed_build_file is relative to the directory
90 # containing build_file. If build_file is not in the current directory,
91 # parsed_build_file is not a usable path as-is. Resolve it by
92 # interpreting it as relative to build_file. If parsed_build_file is
93 # absolute, it is usable as a path regardless of the current directory,
94 # and os.path.join will return it as-is.
95 build_file = os.path.normpath(
96 os.path.join(os.path.dirname(build_file), parsed_build_file)
97 )
98 # Further (to handle cases like ../cwd), make it relative to cwd)
99 if not os.path.isabs(build_file):
100 build_file = RelativePath(build_file, ".")
101 else:
102 build_file = parsed_build_file
103
104 if parsed_toolset:
105 toolset = parsed_toolset
106
107 return [build_file, target, toolset]
108
109
110def BuildFile(fully_qualified_target):

Callers

nothing calls this directly

Calls 3

ParseQualifiedTargetFunction · 0.85
RelativePathFunction · 0.85
joinMethod · 0.45

Tested by

no test coverage detected