Skip to content

Commit c2074ba

Browse files
Merge pull request #540 from linsword13/lic-merged
Allow licenses section in merged config
2 parents f1eecf6 + 8fd1bb0 commit c2074ba

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

lib/ramble/ramble/schema/licenses.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@
4444
"unset": array_of_strings_or_num,
4545
}
4646

47-
licenses_schema = {
47+
#: Properties for inclusion in other schemas
48+
properties = {
4849
"licenses": {
4950
"type": "object",
5051
"default": {},
@@ -64,5 +65,5 @@
6465
"title": "Ramble licenses configuration file schema",
6566
"type": "object",
6667
"additionalProperties": False,
67-
"properties": licenses_schema,
68+
"properties": properties,
6869
}

lib/ramble/ramble/schema/merged.py

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import ramble.schema.applications
1717
import ramble.schema.config
1818
import ramble.schema.formatted_executables
19+
import ramble.schema.licenses
1920
import ramble.schema.repos
2021
import ramble.schema.spack
2122
import ramble.schema.success_criteria
@@ -30,6 +31,7 @@
3031
ramble.schema.applications.properties,
3132
ramble.schema.config.properties,
3233
ramble.schema.formatted_executables.properties,
34+
ramble.schema.licenses.properties,
3335
ramble.schema.repos.properties,
3436
ramble.schema.spack.properties,
3537
ramble.schema.success_criteria.properties,

lib/ramble/ramble/test/end_to_end/merge_config_files.py

+20
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ def test_merge_config_files(mutable_config, mutable_mock_workspace_path, mock_ap
5656
spack:
5757
packages: {}
5858
environments: {}
59+
"""
60+
test_licenses = """
61+
licenses:
62+
zlib:
63+
set:
64+
TEST_LICENSE: 'port@server'
5965
"""
6066
workspace_name = "test_merge_config_files"
6167
with ramble.workspace.create(workspace_name) as ws:
@@ -70,15 +76,20 @@ def test_merge_config_files(mutable_config, mutable_mock_workspace_path, mock_ap
7076

7177
applications_file = os.path.join(ws.root, "applications_test.yaml")
7278
spack_file = os.path.join(ws.root, "spack_test.yaml")
79+
licenses_file = os.path.join(ws.root, "licenses.yaml")
7380

7481
with open(applications_file, "w+") as f:
7582
f.write(test_applications)
7683

7784
with open(spack_file, "w+") as f:
7885
f.write(test_spack)
7986

87+
with open(licenses_file, "w") as f:
88+
f.write(test_licenses)
89+
8090
config("add", "-f", applications_file, global_args=["-w", workspace_name])
8191
config("add", "-f", spack_file, global_args=["-w", workspace_name])
92+
config("add", "-f", licenses_file, global_args=["-w", workspace_name])
8293

8394
ws._re_read()
8495

@@ -88,3 +99,12 @@ def test_merge_config_files(mutable_config, mutable_mock_workspace_path, mock_ap
8899
assert "test_experiment" in data
89100
assert "zlib" in data
90101
assert "spack_spec: [email protected]" in data
102+
assert "licenses" in data
103+
assert "TEST_LICENSE: port@server" in data
104+
105+
workspace("setup", "--dry-run", global_args=["-w", workspace_name])
106+
exec_file = os.path.join(
107+
ws.experiment_dir, "zlib", "ensure_installed", "test_experiment", "execute_experiment"
108+
)
109+
with open(exec_file) as f:
110+
assert "license.inc" in f.read()

0 commit comments

Comments
 (0)