checking for swig variants in a pre-fetch hook

Joshua Root jmr at macports.org
Thu Jul 3 23:38:36 PDT 2008


Adam Mercer wrote:
> Hi
> 
> The recent changes to the swig port have broken the scipy build on
> Tiger, essentially the problem is that scipy requires the python
> variant of swig to be installed. Therefore to try and fix this I want
> to check for existence of the python variant using something like the
> following pre-fetch hook:
> 
> pre-fetch {
>   if {![file exists ${prefix}/share/swig/1.3.36/python/python.swg]} {
>     ui_error "The python variant of swig is not installed. Please run"
>     ui_error "the following commands:"
>     ui_error "$ sudo port uninstall swig"
>     ui_error "$ sudo port install swig +python"
>     error "python variant of swig required"
>   }
> }
> 
> The problem is that this is dependent on the swig version and will
> need to be updated for every new swig release. I tried using a
> wildcard for the version but this doesn't work. Is there any way that
> I can check for this version dependent path in a version independent
> way?

Changing the if line to this should do it:

if {![llen [glob ${prefix}/share/swig/*/python/python.swg]]} {

- Josh


More information about the macports-dev mailing list