Created
March 12, 2023 19:14
-
-
Save wolfv/67b9a1271a1a68d08caa433ac46e90fb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pathlib import Path | |
ltxt = Path("_rclpy_pybind11.dir/link.txt") | |
cmd = ltxt.read_text().split() | |
final_cmd = [] | |
for c in cmd: | |
if c.startswith("@CMakeFiles"): | |
p = c.removeprefix("@CMakeFiles/") | |
x = Path(p).read_text().split() | |
if p.endswith("linkLibs.rsp"): | |
# use only the first time the library is mentioned | |
final_libs = [] | |
seen_libs = set() | |
for l in x: | |
if l not in seen_libs: | |
final_libs.append(l) | |
seen_libs.add(l) | |
else: | |
print("Library already seen: ", l) | |
final_cmd += final_libs | |
else: | |
final_cmd += x | |
else: | |
final_cmd.append(c) | |
print(' '.join(final_cmd)) | |
# import subprocess | |
# try: | |
# out = subprocess.check_call(final_cmd) | |
# except subrocee: | |
# print(e) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment