@@ -1423,6 +1423,30 @@ def test_start_dir_template(self):
14231423 self .assertIn ('start_dir in extension configure is %s &&' % ext_start_dir , logtxt )
14241424 self .assertIn ('start_dir in extension build is %s &&' % ext_start_dir , logtxt )
14251425
1426+ def test_rpath_template (self ):
1427+ """Test the %(rpath)s template"""
1428+ test_easyconfigs = os .path .join (os .path .abspath (os .path .dirname (__file__ )), 'easyconfigs' , 'test_ecs' )
1429+ toy_ec = os .path .join (test_easyconfigs , 't' , 'toy' , 'toy-0.0.eb' )
1430+
1431+ test_ec = os .path .join (self .test_prefix , 'test.eb' )
1432+ test_ec_txt = read_file (toy_ec )
1433+ test_ec_txt += "configopts = '--with-rpath=%(rpath)s'"
1434+ write_file (test_ec , test_ec_txt )
1435+
1436+ ec = EasyConfig (test_ec )
1437+ expected = '--with-rpath=yes' if get_os_name () == 'Linux' else '--with-rpath=no'
1438+ self .assertEqual (ec ['configopts' ], expected )
1439+
1440+ # force True
1441+ update_build_option ('rpath' , True )
1442+ ec = EasyConfig (test_ec )
1443+ self .assertEqual (ec ['configopts' ], "--with-rpath=yes" )
1444+
1445+ # force False
1446+ update_build_option ('rpath' , False )
1447+ ec = EasyConfig (test_ec )
1448+ self .assertEqual (ec ['configopts' ], "--with-rpath=no" )
1449+
14261450 def test_sysroot_template (self ):
14271451 """Test the %(sysroot)s template"""
14281452
@@ -3365,6 +3389,8 @@ def test_template_constant_dict(self):
33653389
33663390 arch_regex = re .compile ('^[a-z0-9_]+$' )
33673391
3392+ rpath = 'yes' if get_os_name () == 'Linux' else 'no'
3393+
33683394 expected = {
33693395 'bitbucket_account' : 'gzip' ,
33703396 'github_account' : 'gzip' ,
@@ -3374,6 +3400,7 @@ def test_template_constant_dict(self):
33743400 'nameletter' : 'g' ,
33753401 'nameletterlower' : 'g' ,
33763402 'parallel' : None ,
3403+ 'rpath' : rpath ,
33773404 'software_commit' : '' ,
33783405 'sysroot' : '' ,
33793406 'toolchain_name' : 'foss' ,
@@ -3457,6 +3484,7 @@ def test_template_constant_dict(self):
34573484 'pyminver' : '7' ,
34583485 'pyshortver' : '3.7' ,
34593486 'pyver' : '3.7.2' ,
3487+ 'rpath' : rpath ,
34603488 'software_commit' : '' ,
34613489 'sysroot' : '' ,
34623490 'version' : '0.01' ,
@@ -3523,6 +3551,7 @@ def test_template_constant_dict(self):
35233551 'namelower' : 'foo' ,
35243552 'nameletter' : 'f' ,
35253553 'nameletterlower' : 'f' ,
3554+ 'rpath' : rpath ,
35263555 'software_commit' : '' ,
35273556 'sysroot' : '' ,
35283557 'version' : '1.2.3' ,
0 commit comments