Backed out changeset 2a94e8bad21e (bug 1874716) for causing CXX related build bustage...
[gecko.git] / config / printconfigsetting.py
blobe2b7487760c2f4e79b117f0b2b22e64345aaf40e
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 import sys
6 from configparser import ConfigParser, NoOptionError, NoSectionError
8 try:
9 (filename, section, key) = sys.argv[1:]
10 except ValueError:
11 print("Usage: printconfigsetting.py <filename> <section> <setting>")
12 sys.exit(1)
14 cfg = ConfigParser()
15 cfg.read(filename)
17 try:
18 print(cfg.get(section, key))
19 except NoOptionError:
20 print("Key %s not found." % key, file=sys.stderr)
21 sys.exit(1)
22 except NoSectionError:
23 print("Section [%s] not found." % section, file=sys.stderr)
24 sys.exit(1)