Alans answer is probably the best, but `BAR_BIN`: '`which bar`' might work as an alternativ to the Tcl specific hack (untested).
On Mon, Jan 8, 2018 at 2:01 PM, Alan O'Cais <a.oc...@fz-juelich.de> wrote: > Hi Caspar, > > You can use > modextravars = { 'BAR_BIN': '%(installdir)s/bin'} > in the Bar easyconfig. If Bar is a dep of Foo, then when Foo is loaded Bar > will be too and the value will be set. If you *only *want this to be set > if Foo is loaded then that is custom behaviour and you will need to write a > custom easyblock for the wrapper software (I don't see another way around > it). > > Kind regards, > > Alan > > On 8 January 2018 at 13:17, Caspar van Leeuwen < > caspar.vanleeu...@surfsara.nl> wrote: > >> I'm sorry, maybe I should have clarified: Foo requires BAR_BIN to be >> present *at runtime*, so yes, I really do want it to be set in the >> module file of Foo. Foo provides a (GUI) wrapper for Bar, but it needs to >> know the location of the Bar binary. Rather than searching the path - as >> other programs might have done -, Foo uses the BAR_BIN environment variable >> to locate and call Bar (in fact, the installation instructions for Foo list >> that you have to set BAR_BIN). >> >> Regards, >> >> Caspar >> >> ------------------------------ >> *From: *"Alan O'Cais" <a.oc...@fz-juelich.de> >> *To: *"easybuild" <easybuild@lists.ugent.be> >> *Sent: *Monday, 8 January, 2018 12:38:32 >> *Subject: *Re: [easybuild] Use of EBROOT of a dependency as modextravar >> >> I think you are misunderstanding the scope of modextravars, it is there >> to set additional variables in the resultant module file from the >> installation (it is not relevant to the install process of the software, >> only the final module file that is written). The modextravars should be set >> in the Bar easyconfig if you wish to leverage it in Foo? Otherwise you just >> use something like >> >> preconfigopts = 'BAR_BIN=$EBROOTBAR/bin ' >> >> in the Foo easyconfig. >> >> On 8 January 2018 at 12:29, Caspar van Leeuwen < >> caspar.vanleeu...@surfsara.nl> wrote: >> >>> Dear EasyBuilders, >>> >>> >>> Question: I have a Package Foo that provides a wrapper for a software >>> package Bar. Thus, in the EasyConfig for Foo, I list Bar as a dependency. >>> >>> >>> Now, Foo requires an environment variable BAR_BIN to be set that points >>> to the Bar binary. Thus, what I would like to do in the Foo EasyConfig is >>> something like: >>> >>> >>> modextravars = {‘BAR_BIN’: ‘$EBROOTBAR/bin’} >>> >>> >>> This doesn’t work: I get an error (something like ‘no variable >>> EBROOTBAR’). I presume the reason is that in the modextravars step for >>> 'Foo', the 'Bar' module isn’t actually loaded - thus EBROOTBAR is not set. >>> >>> >>> I could use $root (which points to the FOO root, and does exist when >>> modextravars is executed) and peal off the …/Foo/(version)-(toolchain), >>> then add .../Bar/(version)-(toolchain), but this feels like a very dirty >>> solution. >>> >>> >>> Does anyone know of an elegant way to achieve this? And just to check: >>> is it correct that the dependencies are not loaded when modextravars is >>> executed? >>> >>> >>> Best regards, >>> >>> >>> Caspar van Leeuwen >>> >> >> >> >> -- >> Dr. Alan O'Cais >> E-CAM Software Manager >> Juelich Supercomputing Centre >> Forschungszentrum Juelich GmbH >> 52425 Juelich, Germany >> >> Phone: +49 2461 61 5213 <02461%20615213> >> Fax: +49 2461 61 6656 <02461%20616656> >> E-mail: a.oc...@fz-juelich.de >> WWW: http://www.fz-juelich.de/ias/jsc/EN >> >> >> ------------------------------------------------------------ >> ------------------------------------ >> ------------------------------------------------------------ >> ------------------------------------ >> Forschungszentrum Juelich GmbH >> 52425 Juelich >> Sitz der Gesellschaft: Juelich >> Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498 >> Vorsitzender des Aufsichtsrats: MinDir Dr. Karl Eugen Huthmacher >> Geschaeftsfuehrung: Prof. Dr.-Ing. Wolfgang Marquardt (Vorsitzender), >> Karsten Beneke (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt, >> Prof. Dr. Sebastian M. Schmidt >> ------------------------------------------------------------ >> ------------------------------------ >> ------------------------------------------------------------ >> ------------------------------------ >> >> >> > > > -- > Dr. Alan O'Cais > E-CAM Software Manager > Juelich Supercomputing Centre > Forschungszentrum Juelich GmbH > 52425 Juelich, Germany > > Phone: +49 2461 61 5213 <+49%202461%20615213> > Fax: +49 2461 61 6656 <+49%202461%20616656> > E-mail: a.oc...@fz-juelich.de > WWW: http://www.fz-juelich.de/ias/jsc/EN >