mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-09 00:40:11 +01:00
when generating config.py during init, uncomment changed options
The defaults are set in config.py and are often commented out. Before, the regex would only change the value, but leave it commented out. Now, it will also uncomment it.
This commit is contained in:
parent
40fdc2a943
commit
0736367675
@ -38,8 +38,8 @@ def write_to_config(key, value):
|
||||
'''write a key/value to the local config.py'''
|
||||
with open('config.py', 'r') as f:
|
||||
data = f.read()
|
||||
pattern = key + '\s*=.*'
|
||||
repl = key + ' = "' + value + '"'
|
||||
pattern = '\n[\s#]*' + key + '\s*=\s*"[^"]*"'
|
||||
repl = '\n' + key + ' = "' + value + '"'
|
||||
data = re.sub(pattern, repl, data)
|
||||
with open('config.py', 'w') as f:
|
||||
f.writelines(data)
|
||||
|
Loading…
Reference in New Issue
Block a user