(output, inputs, ar)
| 98 | |
| 99 | |
| 100 | def _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 | |
| 126 | def create_staticlib(output, inputs, ar=None): |
no test coverage detected
searching dependent graphs…