summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2021-02-08 16:01:46 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2021-02-08 16:01:46 (GMT)
commit39521a21f6d5517fb075b9e9a468cf4f8e723c99 (patch)
treedf83aa09bbb42a67f5c2537b86c501f0d61f4b91 /library
parent9b504b01c346b7be6616c57005b1209274c19404 (diff)
parent8395974e1b9e2ab626f5fe69e2ae5e77481d0753 (diff)
downloadtcl-39521a21f6d5517fb075b9e9a468cf4f8e723c99.zip
tcl-39521a21f6d5517fb075b9e9a468cf4f8e723c99.tar.gz
tcl-39521a21f6d5517fb075b9e9a468cf4f8e723c99.tar.bz2
Merge 8.7
Diffstat (limited to 'library')
-rw-r--r--library/auto.tcl197
1 files changed, 99 insertions, 98 deletions
diff --git a/library/auto.tcl b/library/auto.tcl
index 5f86c93..51d4ef1 100644
--- a/library/auto.tcl
+++ b/library/auto.tcl
@@ -70,60 +70,61 @@ proc tcl_findLibrary {basename version patch initScript enVarName varName} {
# gives the end-user ultimate control to work-around any bugs, or
# to customize.
- if {[info exists env($enVarName)]} {
- lappend dirs $env($enVarName)
- }
+ if {[info exists env($enVarName)]} {
+ lappend dirs $env($enVarName)
+ }
catch {
- set found 0
+ set found 0
set root [zipfs root]
- set mountpoint [file join $root lib [string tolower $basename]]
- lappend dirs [file join $root app ${basename}_library]
- lappend dirs [file join $root lib $mountpoint ${basename}_library]
- lappend dirs [file join $root lib $mountpoint]
+ set mountpoint [file join $root lib $basename]
+ lappend dirs [file join $root app ${basename}_library]
+ lappend dirs [file join $root lib $mountpoint ${basename}_library]
+ lappend dirs [file join $root lib $mountpoint]
if {![zipfs exists [file join $root app ${basename}_library]] \
- && ![zipfs exists $mountpoint]} {
- set found 0
- foreach pkgdat [info loaded] {
- lassign $pkgdat dllfile dllpkg
- if {[string tolower $dllpkg] ne [string tolower $basename]} continue
- if {$dllfile eq {}} {
- # Loaded statically
- break
- }
- set found 1
- zipfs mount $mountpoint $dllfile
- break
- }
- if {!$found} {
- set paths {}
- lappend paths [file join $root app]
- lappend paths [::${basename}::pkgconfig get libdir,runtime]
- lappend paths [::${basename}::pkgconfig get bindir,runtime]
- if {[catch {::${basename}::pkgconfig get zipfile,runtime} zipfile]} {
- set zipfile [string tolower \
- "lib${basename}_[join [list {*}[split $version .] {*}$patch] _].zip"]
- }
- lappend paths [file dirname [file join [pwd] [info nameofexecutable]]]
- foreach path $paths {
- set archive [file join $path $zipfile]
- if {![file exists $archive]} continue
- zipfs mount $mountpoint $archive
- if {[zipfs exists [file join $mountpoint ${basename}_library $initScript]]} {
- lappend dirs [file join $mountpoint ${basename}_library]
- set found 1
- break
- } elseif {[zipfs exists [file join $mountpoint $initScript]]} {
- lappend dirs [file join $mountpoint $initScript]
- set found 1
- break
- } else {
- catch {zipfs unmount $archive}
- }
- }
- }
- }
- }
+ && ![zipfs exists $mountpoint]} {
+ set found 0
+ foreach pkgdat [info loaded] {
+ lassign $pkgdat dllfile dllpkg
+ if {$dllpkg ne $basename} continue
+ if {$dllfile eq {}} {
+ # Loaded statically
+ break
+ }
+ set found 1
+ zipfs mount $mountpoint $dllfile
+ break
+ }
+ if {!$found} {
+ set paths {}
+ lappend paths [file join $root app]
+ lappend paths [::${basename}::pkgconfig get libdir,runtime]
+ lappend paths [::${basename}::pkgconfig get bindir,runtime]
+ if {[catch {::${basename}::pkgconfig get zipfile,runtime} zipfile]} {
+ set zipfile "lib${basename}[join [split $patch .] _].zip"
+ }
+ lappend paths [file dirname [file join [pwd] [info nameofexecutable]]]
+ foreach path $paths {
+ set archive [file join $path $zipfile]
+ if {![file exists $archive]} {
+ continue
+ }
+ zipfs mount $mountpoint $archive
+ if {[zipfs exists [file join $mountpoint ${basename}_library $initScript]]} {
+ lappend dirs [file join $mountpoint ${basename}_library]
+ set found 1
+ break
+ } elseif {[zipfs exists [file join $mountpoint $initScript]]} {
+ lappend dirs [file join $mountpoint $initScript]
+ set found 1
+ break
+ } else {
+ catch {zipfs unmount $archive}
+ }
+ }
+ }
+ }
+ }
# 2. In the package script directory registered within the
# configuration of the package itself.
@@ -158,11 +159,11 @@ proc tcl_findLibrary {basename version patch initScript enVarName varName} {
# ../../../foo1.0.1/library
# (From unix/arch directory in parallel build hierarchy)
- set parentDir [file dirname [file dirname [info nameofexecutable]]]
- set grandParentDir [file dirname $parentDir]
- lappend dirs [file join $parentDir lib $basename$version]
- lappend dirs [file join $grandParentDir lib $basename$version]
- lappend dirs [file join $parentDir library]
+ set parentDir [file dirname [file dirname [info nameofexecutable]]]
+ set grandParentDir [file dirname $parentDir]
+ lappend dirs [file join $parentDir lib $basename$version]
+ lappend dirs [file join $grandParentDir lib $basename$version]
+ lappend dirs [file join $parentDir library]
if {0} {
lappend dirs [file join $grandParentDir library]
lappend dirs [file join $grandParentDir $basename$patch library]
@@ -185,19 +186,19 @@ proc tcl_findLibrary {basename version patch initScript enVarName varName} {
}
set seen($norm) {}
- set the_library $i
- set file [file join $i $initScript]
+ set the_library $i
+ set file [file join $i $initScript]
# source everything when in a safe interpreter because we have a
# source command, but no file exists command
- if {[interp issafe] || [file exists $file]} {
- if {![catch {uplevel #0 [list source $file]} msg opts]} {
- return
- }
+ if {[interp issafe] || [file exists $file]} {
+ if {![catch {uplevel #0 [list source $file]} msg opts]} {
+ return
+ }
append errors "$file: $msg\n"
append errors [dict get $opts -errorinfo]\n
- }
+ }
}
unset -nocomplain the_library
set msg "Can't find a usable $initScript in the following directories: \n"
@@ -236,7 +237,7 @@ if {[interp issafe]} {
proc auto_mkindex {dir args} {
if {[interp issafe]} {
- error "can't generate index within safe interpreter"
+ error "can't generate index within safe interpreter"
}
set oldDir [pwd]
@@ -424,7 +425,7 @@ proc auto_mkindex_parser::mkindex {file} {
$parser eval $contents
foreach name $imports {
- catch {$parser eval [list _%@namespace forget $name]}
+ catch {$parser eval [list _%@namespace forget $name]}
}
return $index
}
@@ -494,9 +495,9 @@ proc auto_mkindex_parser::commandInit {name arglist body} {
set ns [namespace qualifiers $name]
set tail [namespace tail $name]
if {$ns eq ""} {
- set fakeName [namespace current]::_%@fake_$tail
+ set fakeName [namespace current]::_%@fake_$tail
} else {
- set fakeName [namespace current]::[string map {:: _} _%@fake_$name]
+ set fakeName [namespace current]::[string map {:: _} _%@fake_$name]
}
proc $fakeName $arglist $body
@@ -505,8 +506,8 @@ proc auto_mkindex_parser::commandInit {name arglist body} {
# the fully qualified names, and have the procs point to the aliases.
if {[string match *::* $name]} {
- set exportCmd [list _%@namespace export [namespace tail $name]]
- $parser eval [list _%@namespace eval $ns $exportCmd]
+ set exportCmd [list _%@namespace export [namespace tail $name]]
+ $parser eval [list _%@namespace eval $ns $exportCmd]
# The following proc definition does not work if you want to tolerate
# space or something else diabolical in the procedure name, (i.e.,
@@ -518,11 +519,11 @@ proc auto_mkindex_parser::commandInit {name arglist body} {
# A gold star to someone that can make test autoMkindex-3.3 work
# properly
- set alias [namespace tail $fakeName]
- $parser invokehidden proc $name {args} "_%@eval {$alias} \$args"
- $parser alias $alias $fakeName
+ set alias [namespace tail $fakeName]
+ $parser invokehidden proc $name {args} "_%@eval {$alias} \$args"
+ $parser alias $alias $fakeName
} else {
- $parser alias $name $fakeName
+ $parser alias $name $fakeName
}
return
}
@@ -544,18 +545,18 @@ proc auto_mkindex_parser::fullname {name} {
variable contextStack
if {![string match ::* $name]} {
- foreach ns $contextStack {
- set name "${ns}::$name"
- if {[string match ::* $name]} {
- break
- }
- }
+ foreach ns $contextStack {
+ set name "${ns}::$name"
+ if {[string match ::* $name]} {
+ break
+ }
+ }
}
if {[namespace qualifiers $name] eq ""} {
- set name [namespace tail $name]
+ set name [namespace tail $name]
} elseif {![string match ::* $name]} {
- set name "::$name"
+ set name "::$name"
}
# Earlier, mkindex replaced all $'s with \0. Now, we have to reverse that
@@ -645,27 +646,27 @@ auto_mkindex_parser::hook {
auto_mkindex_parser::command namespace {op args} {
switch -- $op {
- eval {
- variable parser
- variable contextStack
+ eval {
+ variable parser
+ variable contextStack
- set name [lindex $args 0]
- set args [lrange $args 1 end]
+ set name [lindex $args 0]
+ set args [lrange $args 1 end]
- set contextStack [linsert $contextStack 0 $name]
+ set contextStack [linsert $contextStack 0 $name]
$parser eval [list _%@namespace eval $name] $args
- set contextStack [lrange $contextStack 1 end]
- }
- import {
- variable parser
- variable imports
- foreach pattern $args {
- if {$pattern ne "-force"} {
- lappend imports $pattern
- }
- }
- catch {$parser eval "_%@namespace import $args"}
- }
+ set contextStack [lrange $contextStack 1 end]
+ }
+ import {
+ variable parser
+ variable imports
+ foreach pattern $args {
+ if {$pattern ne "-force"} {
+ lappend imports $pattern
+ }
+ }
+ catch {$parser eval "_%@namespace import $args"}
+ }
ensemble {
variable parser
variable contextStack