Index: mkIndex.tcl
===================================================================
RCS file: /cvsroot/tcllib/tcllib/mkIndex.tcl,v
retrieving revision 1.4
diff -u -r1.4 mkIndex.tcl
--- mkIndex.tcl	2000/05/30 23:59:59	1.4
+++ mkIndex.tcl	2001/08/02 03:30:16
@@ -21,12 +21,21 @@
 puts "Making pkgIndex.tcl in [pwd]"
 
 set index [open pkgIndex.tcl w]
-puts $index "if { \[lsearch \$auto_path \[file dirname \[info script\]\]\] == -1 } {"
-puts $index "\tlappend auto_path \[file dirname \[info script\]\]"
+puts $index "if { \[lsearch \$auto_path \$dir\] == -1 } {"
+puts $index "\tlappend auto_path \$dir"
+puts $index "\tif {!\[catch {package vcompare \[info patchlevel\] \[info patchlevel\]}\]} {"
+puts $index "\t\tif {!\[package vsatisfies \[info patchlevel\] 8.3.1\]} {"
+puts $index "\t\t\tforeach tlf \[glob -nocomplain \[file join \$dir * pkgIndex.tcl\]\] {"
+puts $index "\t\t\t\tset dir \[file dirname \$tlf\]"
+puts $index "\t\t\t\tsource \$tlf"
+puts $index "\t\t\t}"
+puts $index "\t\t\tcatch {unset tlf}"
+puts $index "\t\t}"
+puts $index "\t}"
 puts $index "}"
 puts $index "package ifneeded $package $version {"
 foreach module $modules {
-    puts $index "\tpackage require $module"
+    puts $index "\tcatch {package require $module}"
 }
 puts $index "\tpackage provide $package $version"
 puts $index "}"
