mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-08-03 18:56:44 -04:00
Better handling of extra branding.xml files
This commit is contained in:
parent
56777e1533
commit
e8d720e9a0
@ -247,16 +247,21 @@ def step_update_branding_xml(jsdata, **options):
|
|||||||
move_to_android_placeholder()
|
move_to_android_placeholder()
|
||||||
|
|
||||||
# copy and rewrite res/values/branding.xml
|
# copy and rewrite res/values/branding.xml
|
||||||
for root, dirs, files in os.walk(os.path.join(ANDROID_PATH, 'res')):
|
branding_xml = os.path.join(ANDROID_PATH, 'res', 'values', 'branding.xml')
|
||||||
for file in files:
|
soup = soup = BeautifulSoup(open(branding_xml, 'r'),
|
||||||
if file.endswith('branding.xml'):
|
'xml', from_encoding='utf-8')
|
||||||
branding_xml = os.path.join(root, file)
|
for elem in soup.findAll('string'):
|
||||||
soup = soup = BeautifulSoup(open(branding_xml, 'r'),
|
elem.string.replace_with(
|
||||||
'xml', from_encoding='utf-8')
|
elem.text.replace('Kiwix', jsdata.get('app_name')))
|
||||||
for elem in soup.findAll('string'):
|
flushxml(soup, 'resources', branding_xml)
|
||||||
elem.string.replace_with(
|
|
||||||
elem.text.replace('Kiwix', jsdata.get('app_name')))
|
# remove all non-default branding.xml files
|
||||||
flushxml(soup, 'resources', branding_xml)
|
for folder in os.listdir(os.path.join(ANDROID_PATH, 'res')):
|
||||||
|
if re.match(r'^values\-[a-z]{2}$', folder):
|
||||||
|
lbx = os.path.join(ANDROID_PATH, 'res', folder, 'branding.xml')
|
||||||
|
if os.path.exists(lbx):
|
||||||
|
os.remove(lbx)
|
||||||
|
|
||||||
|
|
||||||
def step_gen_constants_java(jsdata, **options):
|
def step_gen_constants_java(jsdata, **options):
|
||||||
''' gen Java Source class (final constants) with all JSON values '''
|
''' gen Java Source class (final constants) with all JSON values '''
|
||||||
|
Loading…
x
Reference in New Issue
Block a user