Improve build_with_deb_info (#138290)

To skip over the command that do not have output file specified

Recently I've noticed that `generate_torch_version.py` started to run on every rebuild, and this results in a failed plan for deb info rebuilds

Pull Request resolved: https://github.com/pytorch/pytorch/pull/138290
Approved by: https://github.com/Skylion007
This commit is contained in:
Nikita Shulga
2024-10-18 18:50:10 +00:00
committed by PyTorch MergeBot
parent 4e9273c84e
commit ea8ea2f33f

View File

@ -78,8 +78,11 @@ def create_build_plan() -> list[tuple[str, str]]:
if line.startswith(": &&") and line.endswith("&& :"):
line = line[4:-4]
line = line.replace("-O2", "-g").replace("-O3", "-g")
name = line.split("-o ", 1)[1].split(" ")[0]
rc.append((name, line))
try:
name = line.split("-o ", 1)[1].split(" ")[0]
rc.append((name, line))
except IndexError:
print(f"Skipping {line} as it does not specify output file")
return rc