[Starkit] filleting tcllib

Andreas Kupries andreask at ActiveState.com
Wed May 4 10:11:49 CEST 2005


>
> Below is simple tcl package that I use to find a package and it's
> dependancies and collect them all as one big hunk of code. For
> example, if you needed package foo, you could do the following to
> collect foo and everything else it needs
>
> cd $myVfsLibDir
> set c [open myfoo.tcl w]
> puts $c [flatpkg::script foo]
> close $c
> pkg_mkIndex . myfoo.tcl
>
>
> One thing to note, I don't think my "flatpkg" thing will work if
> the package if the package source files try to read variables in
> the global scope. It's implemented using slave interps with one
> command, "unknown". But, a proper package shouldn't be doing
> things in the global namespace anyhow, and from what I can tell,
> it works just fine with tcllib.

The sak tool I mentioned in previous answers does things similarly, but also
aliases the 'package' command, a bit of 'namespace', ensures that uses of
'if' are no problem, etc. Some of the tcllib packages have conditions at the
global level.

It also tries to extract the data first without executing the code, i.e. by
scanning the code on a textual basis. It only tries to execute the code only
if the text scan was unsucessful. The uncomplicated cases simply do not
require execution.

--
	Andreas Kupries <andreask at ActiveState.com>
	Developer @ http://www.ActiveState.com, a division of Sophos
	Tel: +1 604 484 6491



More information about the Starkit mailing list