1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 from __future__
import absolute_import
6 from __future__
import print_function
10 from StringIO
import StringIO
13 (file, section
, key
) = sys
.argv
[1:]
15 print("Usage: printconfigsetting.py <file> <section> <setting>")
18 with
open(file) as fh
:
19 content
= re
.sub('^\s*;', '#', fh
.read(), flags
=re
.M
)
21 c
= configobj
.ConfigObj(StringIO(content
))
26 print >>sys
.stderr
, "Section [%s] not found." % section
32 print >>sys
.stderr
, "Key %s not found." % key