Skip to content

Instantly share code, notes, and snippets.

@ardabbour
Created December 1, 2021 11:21
Show Gist options
  • Save ardabbour/e837080349a2101d71f9c63dd0c24a00 to your computer and use it in GitHub Desktop.
Save ardabbour/e837080349a2101d71f9c63dd0c24a00 to your computer and use it in GitHub Desktop.
'Uninstall's files installed using cmake via the install_manifest
#!/usr/bin/env python3
from pathlib import Path
from argparse import ArgumentParser
if __name__ == "__main__":
PARSER = ArgumentParser()
PARSER.add_argument(
"--install_manifest",
"-m",
help="path to the install manifest",
default="install_manifest.txt",
type=str,
)
ARGS = PARSER.parse_args()
with open(ARGS.install_manifest, "r") as f:
for line in f:
if line[-1] == "\n":
line = line[:-1]
try:
Path(line).unlink()
print("Uninstalling: " + line)
except FileNotFoundError as e:
print("File not found: " + line)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment