Created
December 1, 2021 11:21
-
-
Save ardabbour/e837080349a2101d71f9c63dd0c24a00 to your computer and use it in GitHub Desktop.
'Uninstall's files installed using cmake via the install_manifest
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
#!/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