Mirror of roytam1's UXP fork just in case Moonchild and Tobin decide to go after him
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
767 B

# This Source Code Form is subject to the terms of the Mozilla Public
# 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
import sys
import re
from StringIO import StringIO
(file, section, key) = sys.argv[1:]
except ValueError:
print "Usage: printconfigsetting.py <file> <section> <setting>"
with open(file) as fh:
content = re.sub('^\s*;', '#', fh.read(), flags=re.M)
c = configobj.ConfigObj(StringIO(content))
s = c[section]
except KeyError:
print >>sys.stderr, "Section [%s] not found." % section
print s[key]
except KeyError:
print >>sys.stderr, "Key %s not found." % key