Skip to content

Commit 612b766

Browse files
wil93stefano-maggiolo
authored andcommitted
Migrate configuration from "examples/" to "config/"
1 parent 2e23371 commit 612b766

13 files changed

Lines changed: 23 additions & 22 deletions

cms/conf.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
class Config(object):
4242
"""This class will contain the configuration for CMS. This needs
4343
to be populated at the initilization stage. This is loaded by
44-
default with some sane data. See cms.conf.sample in the examples
45-
for information on the meaning of the fields.
44+
default with some sane data. See cms.conf.sample in the config
45+
directory for information on the meaning of the fields.
4646
4747
"""
4848
def __init__(self):
@@ -134,11 +134,11 @@ def __init__(self):
134134
self.cache_dir = "cache"
135135
self.data_dir = "lib"
136136
self.run_dir = "run"
137-
paths = [os.path.join(".", "examples", "cms.conf")]
137+
paths = [os.path.join(".", "config", "cms.conf")]
138138
if '__file__' in globals():
139139
paths += [os.path.abspath(os.path.join(
140140
os.path.dirname(__file__),
141-
'..', 'examples', 'cms.conf'))]
141+
'..', 'config', 'cms.conf'))]
142142
paths += [os.path.join("/", "usr", "local", "etc", "cms.conf"),
143143
os.path.join("/", "etc", "cms.conf")]
144144

cmsranking/Config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def __init__(self):
7070
else:
7171
self.log_dir = os.path.join("log", "ranking")
7272
self.lib_dir = os.path.join("lib", "ranking")
73-
paths = [os.path.join(".", "examples", "cms.ranking.conf"),
73+
paths = [os.path.join(".", "config", "cms.ranking.conf"),
7474
os.path.join("/", "usr", "local", "etc",
7575
"cms.ranking.conf"),
7676
os.path.join("/", "etc", "cms.ranking.conf")]

cmstestsuite/RunFunctionalTests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ def main():
419419
except subprocess.CalledProcessError:
420420
git_root = None
421421
CONFIG["TEST_DIR"] = git_root
422-
CONFIG["CONFIG_PATH"] = "%s/examples/cms.conf" % CONFIG["TEST_DIR"]
422+
CONFIG["CONFIG_PATH"] = "%s/config/cms.conf" % CONFIG["TEST_DIR"]
423423
if CONFIG["TEST_DIR"] is None:
424424
CONFIG["CONFIG_PATH"] = "/usr/local/etc/cms.conf"
425425
cms_config = get_cms_config()

cmstestsuite/RunUnitTests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def main():
183183

184184
# Load config from cms.conf.
185185
CONFIG["TEST_DIR"] = git_root
186-
CONFIG["CONFIG_PATH"] = "%s/examples/cms.conf" % CONFIG["TEST_DIR"]
186+
CONFIG["CONFIG_PATH"] = "%s/config/cms.conf" % CONFIG["TEST_DIR"]
187187
if CONFIG["TEST_DIR"] is None:
188188
CONFIG["CONFIG_PATH"] = "/usr/local/etc/cms.conf"
189189

cmstestsuite/TestCleanCheckout.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def setup_cms():
106106
args = parser.parse_args()
107107

108108
CONFIG["TEST_DIR"] = tempfile.mkdtemp()
109-
CONFIG["CONFIG_PATH"] = "%s/examples/cms.conf" % CONFIG["TEST_DIR"]
109+
CONFIG["CONFIG_PATH"] = "%s/config/cms.conf" % CONFIG["TEST_DIR"]
110110
CONFIG["GIT_ORIGIN"] = subprocess.check_output(
111111
"git rev-parse --show-toplevel", shell=True).strip()
112112
if args.revision is None:

cmstestsuite/__init__.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# Copyright © 2012 Bernard Blackham <bernard@largestprime.net>
66
# Copyright © 2013 Stefano Maggiolo <s.maggiolo@gmail.com>
77
# Copyright © 2013-2014 Luca Wehrstedt <luca.wehrstedt@gmail.com>
8+
# Copyright © 2014 William Di Luigi <williamdiluigi@gmail.com>
89
#
910
# This program is free software: you can redistribute it and/or modify
1011
# it under the terms of the GNU Affero General Public License as
@@ -185,9 +186,10 @@ def configure_cms(options):
185186
options (dict): mapping from parameter to textual JSON argument.
186187
187188
"""
188-
f = io.open("%(TEST_DIR)s/examples/cms.conf.sample" % CONFIG,
189-
"rt", encoding="utf-8")
190-
lines = f.readlines()
189+
with io.open("%(TEST_DIR)s/config/cms.conf.sample" % CONFIG,
190+
"rt", encoding="utf-8") as in_f:
191+
lines = in_f.readlines()
192+
191193
unset = set(options.keys())
192194
for i, line in enumerate(lines):
193195
g = re.match(r'^(\s*)"([^"]+)":', line)
@@ -197,10 +199,9 @@ def configure_cms(options):
197199
lines[i] = '%s"%s": %s,\n' % (whitespace, key, options[key])
198200
unset.remove(key)
199201

200-
out_file = io.open("%(CONFIG_PATH)s" % CONFIG, "wt", encoding="utf-8")
201-
for l in lines:
202-
out_file.write(l)
203-
out_file.close()
202+
with io.open("%(CONFIG_PATH)s" % CONFIG, "wt", encoding="utf-8") as out_f:
203+
for l in lines:
204+
out_f.write(l)
204205

205206
if unset:
206207
print("These configuration items were not set:")
File renamed without changes.

0 commit comments

Comments
 (0)