checking for swig variants in a pre-fetch hook

Joshua Root jmr at macports.org
Fri Jul 4 09:01:45 PDT 2008


Adam Mercer wrote:
> On Fri, Jul 4, 2008 at 10:23 AM, Joshua Root <jmr at macports.org> wrote:
> 
> Josh
> 
>> Ah, sorry, I forgot that glob errors if nothing matches. Add -nocomplain:
>>
>> if {![llen [glob -nocomplain ${prefix}/share/swig/*/python/python.swg]]}
> 
> Still not working quite right, the error is now:
> 
> --->  Fetching py25-scipy
> Error: Target org.macports.fetch returned: invalid command name "llen"
> Error: Status 1 encountered during processing.
> 
> removing the -nocomplain flag results in the previous error.

Oh right, Tcl doesn't let you do that with the ! operator. Either 
compare the length to 0 like so:

if {[llen [glob -nocomplain ${prefix}/share/swig/*/python/python.swg]] 
== 0} {

or remove the -nocomplain and just catch the error:

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

- Josh


More information about the macports-dev mailing list