checking for swig variants in a pre-fetch hook

Jordan K. Hubbard jkh at apple.com
Fri Jul 4 13:07:14 PDT 2008


Doh, I hate it when tcl "helps" by automatically intuiting command  
names at the shell!   Rainer is, of course, correct:  The correct  
command name is llength, not llen, hence the problem.  My face is red...

- Jordan

On Jul 4, 2008, at 1:04 PM, Jordan K. Hubbard wrote:

>
> On Jul 4, 2008, at 9:01 AM, Joshua Root wrote:
>
>>>> 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:
>
> Hmmm?
>
> % if {![llen {}]} {puts "empty"} else {puts "not empty"}
> empty
> % if {![llen {one two}]} {puts "empty"} else {puts "not empty"}
> not empty
>
> I'm not sure why Adam sees that particular error (I don't know the  
> containing expression) but you're also right in saying that catching  
> the glob is probably the most straight-forward approach.  I just  
> don't like to see Tcl's operators unfairly maligned like this. :-)
>
> - Jordan
>



More information about the macports-dev mailing list