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
6250d987c6
commit
57f7635242
@ -2,7 +2,10 @@
|
|||||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
# 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/.
|
# 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:
|
try:
|
||||||
(file, section, key) = sys.argv[1:]
|
(file, section, key) = sys.argv[1:]
|
||||||
@ -10,7 +13,10 @@ except ValueError:
|
|||||||
print "Usage: printconfigsetting.py <file> <section> <setting>"
|
print "Usage: printconfigsetting.py <file> <section> <setting>"
|
||||||
sys.exit(1)
|
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:
|
try:
|
||||||
s = c[section]
|
s = c[section]
|
||||||
|
Loading…
Reference in New Issue
Block a user