This is a minor update that makes two main changes: i) A comment header is now added to the start of a tarcel to state that it is a tarcel and what version of Tarcel it was created with. ii) Within a .tarcel file you can now add a version requirement to get packageLoadCommands.

The Comment Header

The new header at the start of a tarcel looks like the following:

#########################################################
# This file is a tarcel created by Tarcel v0.2
# To find out more about Tarcel go to the project page:
#   http://vlifesystems.com/projects/tarcel/
#########################################################

Version Requirements for get packageLoadCommands

The new usage for the get packageLoadCommands is:

get packageLoadCommands packageName [requirement] ...
Returns the commands to load the package from package ifneeded. The result is returned as a two element list, the first element contains the load commands and the second element contains the version found.

This allows you to create a .tarcel like the following to package the latest version of Tclx as a module, which is between v8.3 and v8.5:

set loadCommands [get packageLoadCommands Tclx 8.3-8.5]
lassign $loadCommands loadCommand version
set outputFilename "Tclx-$version.tm"
set baseDir "Tclx-$version.vfs"
set filesLibDir [file join $baseDir tclx$version]


if {[regexp {^load[^;]+$} $loadCommand]} {
  set libFilename [regsub {^(load\s+)(.*?) (.*?)$} $loadCommand {\2}]
  set libDirname [file dirname $libFilename]
  set tclxFilenames [glob -tails -directory $libDirname *.so *.tcl]

  foreach filename $tclxFilenames {
    fetch $filesLibDir \
          [file join $libDirname $filename]
  }
} else {
  error "Can't find package: Tclx"
}

set initScript {
  lappend auto_path [file normalize @baseDir]
  load [file join @filesLibDir @libTailFilename] Tclx
}

config set init [string map [list @baseDir $baseDir \
                                  @filesLibDir $filesLibDir \
                                  @libTailFilename [file tail $libFilename]] \
                            $initScript]

config set outputFilename $outputFilename