Created
December 24, 2014 00:20
-
-
Save u8sand/1d0c47a42c0ec657a18c to your computer and use it in GitHub Desktop.
Sometimes Qt Creator doesn't clean up after itself--this should take care of that.
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
#!/bin/python3 | |
import sys; | |
from lxml import etree; | |
def clean(f): | |
print("Processing "+f+"...") | |
tree = etree.parse(f) | |
root = tree.getroot() | |
used_actions=[] | |
for child in root.iter('addaction'): | |
used_actions.append(child.get('name')) | |
for child in root.iter('action'): | |
if child.get('name') not in used_actions: | |
print("Cleaning "+child.get('name')) | |
child.getparent().remove(child) | |
tree.write(f) | |
args = iter(sys.argv) | |
next(args) | |
for arg in args: | |
clean(arg) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment