mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-05 15:00:30 +03:00
Use proper regex to remove signing from build.gradle files
This fixes apps like ifixit
This commit is contained in:
parent
0fce807f35
commit
1f01250618
1 changed files with 10 additions and 4 deletions
|
|
@ -1460,6 +1460,10 @@ def FDroidPopen(commands, cwd=None):
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def remove_signing_keys(build_dir):
|
def remove_signing_keys(build_dir):
|
||||||
|
comment = re.compile(r'[ ]*//')
|
||||||
|
signing_configs = re.compile(r'[\t ]*signingConfigs[ \t]*{[ \t]*$')
|
||||||
|
r_open = re.compile(r'.*{[\t ]*$')
|
||||||
|
r_close = re.compile(r'.*}[\t ]*$')
|
||||||
for root, dirs, files in os.walk(build_dir):
|
for root, dirs, files in os.walk(build_dir):
|
||||||
if 'build.gradle' in files:
|
if 'build.gradle' in files:
|
||||||
path = os.path.join(root, 'build.gradle')
|
path = os.path.join(root, 'build.gradle')
|
||||||
|
|
@ -1471,13 +1475,15 @@ def remove_signing_keys(build_dir):
|
||||||
opened = 0
|
opened = 0
|
||||||
with open(path, "w") as o:
|
with open(path, "w") as o:
|
||||||
for line in lines:
|
for line in lines:
|
||||||
if 'signingConfigs ' in line:
|
if comment.match(line):
|
||||||
|
pass
|
||||||
|
elif signing_configs.match(line):
|
||||||
opened = 1
|
opened = 1
|
||||||
changed = True
|
changed = True
|
||||||
elif opened > 0:
|
elif opened > 0:
|
||||||
if '{' in line:
|
if r_open.match(line):
|
||||||
opened += 1
|
opened += 1
|
||||||
elif '}' in line:
|
elif r_close.match(line):
|
||||||
opened -= 1
|
opened -= 1
|
||||||
elif any(s in line for s in (
|
elif any(s in line for s in (
|
||||||
' signingConfig ',
|
' signingConfig ',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue