Skip to content

Commit 24d32b0

Browse files
committed
don't use %(version)s template in exts_default_options in dumped easyconfig
1 parent 6334e1f commit 24d32b0

File tree

2 files changed

+26
-8
lines changed

2 files changed

+26
-8
lines changed

easybuild/framework/easyconfig/format/format.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@
5252
DEPENDENCY_PARAMETERS = ['builddependencies', 'dependencies', 'hiddendependencies']
5353

5454
# values for these keys will not be templated in dump()
55-
EXCLUDED_KEYS_REPLACE_TEMPLATES = ['description', 'easyblock', 'exts_list', 'homepage', 'name', 'toolchain',
56-
'version', 'multi_deps'] + DEPENDENCY_PARAMETERS
55+
EXCLUDED_KEYS_REPLACE_TEMPLATES = ['description', 'easyblock', 'exts_default_options', 'exts_list',
56+
'homepage', 'multi_deps', 'name', 'toolchain', 'version'] + DEPENDENCY_PARAMETERS
5757

5858
# ordered groups of keys to obtain a nice looking easyconfig file
5959
GROUPED_PARAMS = [
@@ -69,7 +69,10 @@
6969
['preinstallopts', 'installopts'],
7070
['parallel', 'maxparallel'],
7171
]
72-
LAST_PARAMS = ['sanity_check_paths', 'moduleclass']
72+
LAST_PARAMS = ['exts_default_options', 'exts_list',
73+
'sanity_check_paths', 'sanity_check_commands',
74+
'modextrapaths', 'modextravars',
75+
'moduleclass']
7376

7477
SANITY_CHECK_PATHS_DIRS = 'dirs'
7578
SANITY_CHECK_PATHS_FILES = 'files'

test/framework/easyconfig.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1748,7 +1748,7 @@ def test_dump_template(self):
17481748
"easyblock = 'EB_foo'",
17491749
'',
17501750
"name = 'Foo'",
1751-
"version = '0.0.1'",
1751+
"version = '1.0.0'",
17521752
"versionsuffix = '-test'",
17531753
'',
17541754
"homepage = 'http://foo.com/'",
@@ -1760,22 +1760,31 @@ def test_dump_template(self):
17601760
'}',
17611761
'',
17621762
"sources = [",
1763-
" 'foo-0.0.1.tar.gz',",
1763+
" 'foo-1.0.0.tar.gz',",
17641764
']',
17651765
'',
17661766
"dependencies = [",
17671767
" ('bar', '1.2.3', '-test'),",
17681768
']',
17691769
'',
17701770
"preconfigopts = '--opt1=%s' % name",
1771-
"configopts = '--opt2=0.0.1'",
1771+
"configopts = '--opt2=1.0.0'",
17721772
'',
1773+
'exts_default_options = {',
1774+
" 'source_urls': ['https://example.com/files/1.0.0'],"
1775+
'}',
1776+
'exts_list = [',
1777+
' ("ext1", "1.0.0"),'
1778+
' ("ext2", "2.1.3"),'
1779+
']',
17731780
"sanity_check_paths = {",
17741781
" 'files': ['files/foo/foobar', 'files/x-test'],",
17751782
" 'dirs':[],",
17761783
'}',
17771784
'',
1778-
"foo_extra1 = 'foobar'"
1785+
"foo_extra1 = 'foobar'",
1786+
'',
1787+
'moduleclass = "tools"',
17791788
])
17801789

17811790
handle, testec = tempfile.mkstemp(prefix=self.test_prefix, suffix='.eb')
@@ -1790,7 +1799,7 @@ def test_dump_template(self):
17901799
patterns = [
17911800
r"easyblock = 'EB_foo'",
17921801
r"name = 'Foo'",
1793-
r"version = '0.0.1'",
1802+
r"version = '1.0.0'",
17941803
r"versionsuffix = '-test'",
17951804
r"homepage = 'http://foo.com/'",
17961805
r'description = "foo description"', # no templating for description
@@ -1799,13 +1808,19 @@ def test_dump_template(self):
17991808
# r"dependencies = \[\n \('bar', '1.2.3', '%\(versionsuffix\)s'\),\n\]",
18001809
r"preconfigopts = '--opt1=%\(name\)s'",
18011810
r"configopts = '--opt2=%\(version\)s'",
1811+
# no %(version)s template used in exts_default_options or exts_list
1812+
# see https://github.com/easybuilders/easybuild-framework/issues/3091
1813+
r"exts_default_options = {'source_urls': \['https://example.com/files/1\.0\.0'\]}",
1814+
r"\('ext1', '1\.0\.0'\),",
18021815
r"sanity_check_paths = {\n 'files': \['files/%\(namelower\)s/foobar', 'files/x-test'\]",
18031816
]
18041817

18051818
for pattern in patterns:
18061819
regex = re.compile(pattern, re.M)
18071820
self.assertTrue(regex.search(ectxt), "Pattern '%s' found in: %s" % (regex.pattern, ectxt))
18081821

1822+
ectxt.endswith('moduleclass = "tools"')
1823+
18091824
# reparsing the dumped easyconfig file should work
18101825
EasyConfig(testec)
18111826

0 commit comments

Comments
 (0)