-
-
Save DNI9/b154a47cbb8a80f32ee30371b71e4067 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
#!/usr/bin/env python3 | |
# NOTE: This is only useful until Meson 0.38.0 which includes an `uninstall` target. | |
import argparse | |
from contextlib import suppress | |
from os import path, remove | |
parser = argparse.ArgumentParser() | |
parser.add_argument('--dry-run', action='store_true') | |
parser.add_argument('directory', type=str, default='.', nargs='?') | |
args = parser.parse_args() | |
log_file = path.join(args.directory, 'meson-logs', 'install-log.txt') | |
with open(log_file) as f: | |
for line in f: | |
line = line.strip() | |
if line.startswith('#'): | |
continue | |
if args.dry_run: | |
print('Would delete:', line) | |
else: | |
print('Deleting:', line) | |
with suppress(FileNotFoundError): | |
remove(line) | |
print('Note that empty directories and post-install script created files maybe left over') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment