forked from firebase/FirebaseUI-Android
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathremove_string.py
More file actions
34 lines (27 loc) · 696 Bytes
/
Copy pathremove_string.py
File metadata and controls
34 lines (27 loc) · 696 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# coding=UTF-8
#
# Description:
# Removes a string resource from resource files.
#
# Usage:
# python remove_string.py [string_name] [file1] [file2] ...
# string_name: the name of a string resource, like app_name
import os
import re
import sys
from base_string_script import BaseStringScript
# Get string to remove
QUERY = 'name="{}"'.format(sys.argv[1])
# List of iles
FILES = sys.argv[2:]
# Remove any tags with the wrong name
class RemoveStringScript(BaseStringScript):
def ProcessTag(self, line, type):
if QUERY in '\n'.join(line):
return []
else:
return line
# Process all files
for file_name in FILES:
rss = RemoveStringScript()
rss.ProcessFile(file_name)