mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 957911 - Work around the lack of support for semi-colon comments in python/configobj. r=gps
This commit is contained in:
parent
96845f45a6
commit
c69ea11357
@ -2,7 +2,10 @@
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
import configobj, sys
|
||||
import configobj
|
||||
import sys
|
||||
import re
|
||||
from StringIO import StringIO
|
||||
|
||||
try:
|
||||
(file, section, key) = sys.argv[1:]
|
||||
@ -10,7 +13,10 @@ except ValueError:
|
||||
print "Usage: printconfigsetting.py <file> <section> <setting>"
|
||||
sys.exit(1)
|
||||
|
||||
c = configobj.ConfigObj(file)
|
||||
with open(file) as fh:
|
||||
content = re.sub('^\s*;', '#', fh.read(), flags=re.M)
|
||||
|
||||
c = configobj.ConfigObj(StringIO(content))
|
||||
|
||||
try:
|
||||
s = c[section]
|
||||
|
Loading…
Reference in New Issue
Block a user