MCPcopy Index your code
hub / github.com/nodejs/node / Load

Function Load

tools/gyp/pylib/gyp/__init__.py:71–185  ·  view source on GitHub ↗

Loads one or more specified build files. default_variables and includes will be copied before use. Returns the generator for the specified format and the data returned by loading the specified build files.

(
    build_files,
    format,
    default_variables={},
    includes=[],
    depth=".",
    params=None,
    check=False,
    circular_check=True,
)

Source from the content-addressed store, hash-verified

69
70
71def Load(
72 build_files,
73 format,
74 default_variables={},
75 includes=[],
76 depth=".",
77 params=None,
78 check=False,
79 circular_check=True,
80):
81 """
82 Loads one or more specified build files.
83 default_variables and includes will be copied before use.
84 Returns the generator for the specified format and the
85 data returned by loading the specified build files.
86 """
87 if params is None:
88 params = {}
89
90 if "-" in format:
91 format, params["flavor"] = format.split("-", 1)
92
93 default_variables = copy.copy(default_variables)
94
95 # Default variables provided by this program and its modules should be
96 # named WITH_CAPITAL_LETTERS to provide a distinct "best practice" namespace,
97 # avoiding collisions with user and automatic variables.
98 default_variables["GENERATOR"] = format
99 default_variables["GENERATOR_FLAVOR"] = params.get("flavor", "")
100
101 # Format can be a custom python file, or by default the name of a module
102 # within gyp.generator.
103 if format.endswith(".py"):
104 generator_name = os.path.splitext(format)[0]
105 path, generator_name = os.path.split(generator_name)
106
107 # Make sure the path to the custom generator is in sys.path
108 # Don't worry about removing it once we are done. Keeping the path
109 # to each generator that is used in sys.path is likely harmless and
110 # arguably a good idea.
111 path = os.path.abspath(path)
112 if path not in sys.path:
113 sys.path.insert(0, path)
114 else:
115 generator_name = "gyp.generator." + format
116
117 # These parameters are passed in order (as opposed to by key)
118 # because ActivePython cannot handle key parameters to __import__.
119 generator = __import__(generator_name, globals(), locals(), generator_name)
120 for key, val in generator.generator_default_variables.items():
121 default_variables.setdefault(key, val)
122
123 output_dir = params["options"].generator_output or params["options"].toplevel_dir
124 if default_variables["GENERATOR"] == "ninja":
125 product_dir_abs = os.path.join(
126 output_dir, "out", default_variables.get("build_type", "default")
127 )
128 else:

Callers 1

gyp_mainFunction · 0.70

Calls 10

globalsFunction · 0.85
EscapeForCStringFunction · 0.85
copyMethod · 0.65
getMethod · 0.65
splitMethod · 0.45
insertMethod · 0.45
itemsMethod · 0.45
setdefaultMethod · 0.45
joinMethod · 0.45
LoadMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…