MCPcopy Create free account
hub / github.com/apache/tvm / _linux_ar

Function _linux_ar

python/tvm/support/cc.py:100–123  ·  view source on GitHub ↗
(output, inputs, ar)

Source from the content-addressed store, hash-verified

98
99
100def _linux_ar(output, inputs, ar):
101 ar = ar or "ar"
102
103 libname = os.path.basename(output)
104 if not libname.startswith("lib"):
105 libname = "lib" + libname
106 temp = _utils.tempdir()
107 temp_output = temp.relpath(libname)
108 cmd = [ar, "-crs", temp_output]
109
110 # handles the case where some input files are tar of objects
111 # unpack them and return the list of files inside
112 objects = _tar.normalize_file_list_by_unpacking_tars(temp, inputs)
113
114 cmd += objects
115 proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
116 (out, _) = proc.communicate()
117 if proc.returncode != 0:
118 msg = "AR error:\n"
119 msg += out.decode("utf-8", errors="replace")
120 msg += "\nCommand line: " + " ".join(cmd)
121 raise RuntimeError(msg)
122
123 shutil.move(temp_output, output)
124
125
126def create_staticlib(output, inputs, ar=None):

Callers 1

create_staticlibFunction · 0.85

Calls 3

relpathMethod · 0.80
decodeMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…