Skip to content

Commit

Permalink
* pkgIndex.tcl.in: Fixed procedure collisions for Thread package
Browse files Browse the repository at this point in the history
	by inlining the load command into the ifneeded script, as is
	standard for most binary packages. Tweaked the procedure for
	Ttrace a bit, as the result of [info commands] is a list, and
	using ::apply when possible. A named procedure is only a fallback.
  • Loading branch information
andreas_kupries committed May 31, 2010
1 parent 43ab068 commit cb41c52
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 20 deletions.
8 changes: 8 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
2010-05-31 Andreas Kupries <[email protected]>

* pkgIndex.tcl.in: Fixed procedure collisions for Thread package
by inlining the load command into the ifneeded script, as is
standard for most binary packages. Tweaked the procedure for
Ttrace a bit, as the result of [info commands] is a list, and
using ::apply when possible. A named procedure is only a fallback.

2010-05-27 Andreas Kupries <[email protected]>

* lib/ttrace.tcl: Resynchronized version number with Thread.
Expand Down
61 changes: 41 additions & 20 deletions pkgIndex.tcl.in
Original file line number Diff line number Diff line change
@@ -1,25 +1,46 @@
#
# -*- tcl -*-
# Tcl package index file, version 1.1
#
if {[package vsatisfies [package provide Tcl] 8.4]} {
package ifneeded Thread @PACKAGE_VERSION@ [list @PACKAGE_NAME@_load $dir]
package ifneeded Ttrace @PACKAGE_VERSION@ [list @PACKAGE_NAME@_source $dir]
proc @PACKAGE_NAME@_load {dir} {
load [file join $dir @PKG_LIB_FILE@]
rename @PACKAGE_NAME@_load {}
}
proc @PACKAGE_NAME@_source {dir} {
if {[info exists ::env(TCL_THREAD_LIBRARY)] &&
[file readable $::env(TCL_THREAD_LIBRARY)/ttrace.tcl]} {
source $::env(TCL_THREAD_LIBRARY)/ttrace.tcl
} elseif {[file readable [file join $dir .. lib ttrace.tcl]]} {
source [file join $dir .. lib ttrace.tcl]
} elseif {[file readable [file join $dir ttrace.tcl]]} {
source [file join $dir ttrace.tcl]
}
if {[info commands ttrace::update] ne ""} {
ttrace::update
}
rename @PACKAGE_NAME@_source {}

package ifneeded Thread @PACKAGE_VERSION@ [list load [file join $dir @PKG_LIB_FILE@]]

if {[llength [info commands apply]]} {
# We can use a lambda (anon function).

package ifneeded Ttrace @PACKAGE_VERSION@ [list ::apply {{dir} {
if {[info exists ::env(TCL_THREAD_LIBRARY)] &&
[file readable $::env(TCL_THREAD_LIBRARY)/ttrace.tcl]} {
source $::env(TCL_THREAD_LIBRARY)/ttrace.tcl
} elseif {[file readable [file join $dir .. lib ttrace.tcl]]} {
source [file join $dir .. lib ttrace.tcl]
} elseif {[file readable [file join $dir ttrace.tcl]]} {
source [file join $dir ttrace.tcl]
}
if {[llength [info commands ttrace::update]]} {
ttrace::update
}
}} $dir]
} else {
# No anon functions available, go with the necessary evil of a
# named procedure, but use package specific prefix and no
# hardwired data changing between package versions.

package ifneeded Ttrace @PACKAGE_VERSION@ [list @PACKAGE_NAME@_source $dir]

proc @PACKAGE_NAME@_source {dir} {
if {[info exists ::env(TCL_THREAD_LIBRARY)] &&
[file readable $::env(TCL_THREAD_LIBRARY)/ttrace.tcl]} {
source $::env(TCL_THREAD_LIBRARY)/ttrace.tcl
} elseif {[file readable [file join $dir .. lib ttrace.tcl]]} {
source [file join $dir .. lib ttrace.tcl]
} elseif {[file readable [file join $dir ttrace.tcl]]} {
source [file join $dir ttrace.tcl]
}
if {[llength [info commands ttrace::update]]} {
ttrace::update
}
rename @PACKAGE_NAME@_source {}
}
}
}

0 comments on commit cb41c52

Please sign in to comment.