diff options
author | andreas_kupries <akupries@shaw.ca> | 2006-09-22 01:26:21 (GMT) |
---|---|---|
committer | andreas_kupries <akupries@shaw.ca> | 2006-09-22 01:26:21 (GMT) |
commit | 2448707dca1d9dffdab99e6db36d47f4ac849c0a (patch) | |
tree | 32acbff94cb87475dcf718f476fd8fb8e668cff2 /library/package.tcl | |
parent | 46eeaabac457ed5157a0e04fe91ffb12314230a4 (diff) | |
download | tcl-2448707dca1d9dffdab99e6db36d47f4ac849c0a.zip tcl-2448707dca1d9dffdab99e6db36d47f4ac849c0a.tar.gz tcl-2448707dca1d9dffdab99e6db36d47f4ac849c0a.tar.bz2 |
* generic/tcl.decls: Implemented TIP #268, conditionally.
* generic/tclBasic.c: Define TCL_TIP268 to activate the new
* generic/tclDecls.h: features.
* generic/tclInt.h:
* generic/tclPkg.c:
* generic/tclStubInit.c:
* generic/tclTest.c:
* library/init.tcl
* library/package.tcl:
* tests/pkg.test:
* tests/platform.test:
* tests/safe.test:
* doc/PkgRequire.3:
Diffstat (limited to 'library/package.tcl')
-rw-r--r-- | library/package.tcl | 108 |
1 files changed, 78 insertions, 30 deletions
diff --git a/library/package.tcl b/library/package.tcl index fa6b01c..04145dd 100644 --- a/library/package.tcl +++ b/library/package.tcl @@ -3,7 +3,7 @@ # utility procs formerly in init.tcl which can be loaded on demand # for package management. # -# RCS: @(#) $Id: package.tcl,v 1.23.2.3 2005/07/22 21:59:41 dgp Exp $ +# RCS: @(#) $Id: package.tcl,v 1.23.2.4 2006/09/22 01:26:24 andreas_kupries Exp $ # # Copyright (c) 1991-1993 The Regents of the University of California. # Copyright (c) 1994-1998 Sun Microsystems, Inc. @@ -471,7 +471,12 @@ proc tclPkgSetup {dir pkg version files} { # version - Version of desired package. Not used. # exact - Either "-exact" or omitted. Not used. -proc tclPkgUnknown {name version {exact {}}} { + +proc tclPkgUnknown [expr { + [info exists tcl_platform(tip,268)] + ? "name args" + : "name version {exact {}}" + }] { global auto_path env if {![info exists auto_path]} { @@ -564,43 +569,86 @@ proc tclPkgUnknown {name version {exact {}}} { # Arguments: # original - original [package unknown] procedure # name - Name of desired package. Not used. +#ifndef TCL_TIP268 # version - Version of desired package. Not used. # exact - Either "-exact" or omitted. Not used. +#else +# args - List of requirements. Not used. +#endif -proc tcl::MacOSXPkgUnknown {original name version {exact {}}} { - - # First do the cross-platform default search - uplevel 1 $original [list $name $version $exact] +if {[info exists tcl_platform(tip,268)]} { + proc tcl::MacOSXPkgUnknown {original name args} { + # First do the cross-platform default search + uplevel 1 $original [linsert $args 0 $name] - # Now do MacOSX specific searching - global auto_path + # Now do MacOSX specific searching + global auto_path - if {![info exists auto_path]} { - return - } - # Cache the auto_path, because it may change while we run through - # the first set of pkgIndex.tcl files - set old_path [set use_path $auto_path] - while {[llength $use_path]} { - set dir [lindex $use_path end] - # get the pkgIndex files out of the subdirectories - foreach file [glob -directory $dir -join -nocomplain \ - * Resources Scripts pkgIndex.tcl] { - set dir [file dirname $file] - if {[file readable $file] && ![info exists procdDirs($dir)]} { - if {[catch {source $file} msg]} { - tclLog "error reading package index file $file: $msg" - } else { - set procdDirs($dir) 1 + if {![info exists auto_path]} { + return + } + # Cache the auto_path, because it may change while we run through + # the first set of pkgIndex.tcl files + set old_path [set use_path $auto_path] + while {[llength $use_path]} { + set dir [lindex $use_path end] + # get the pkgIndex files out of the subdirectories + foreach file [glob -directory $dir -join -nocomplain \ + * Resources Scripts pkgIndex.tcl] { + set dir [file dirname $file] + if {[file readable $file] && ![info exists procdDirs($dir)]} { + if {[catch {source $file} msg]} { + tclLog "error reading package index file $file: $msg" + } else { + set procdDirs($dir) 1 + } } } + set use_path [lrange $use_path 0 end-1] + if {$old_path ne $auto_path} { + foreach dir $auto_path { + lappend use_path $dir + } + set old_path $auto_path + } } - set use_path [lrange $use_path 0 end-1] - if {$old_path ne $auto_path} { - foreach dir $auto_path { - lappend use_path $dir + } +} else { + proc tcl::MacOSXPkgUnknown {original name version {exact {}}} { + + # First do the cross-platform default search + uplevel 1 $original [list $name $version $exact] + + # Now do MacOSX specific searching + global auto_path + + if {![info exists auto_path]} { + return + } + # Cache the auto_path, because it may change while we run through + # the first set of pkgIndex.tcl files + set old_path [set use_path $auto_path] + while {[llength $use_path]} { + set dir [lindex $use_path end] + # get the pkgIndex files out of the subdirectories + foreach file [glob -directory $dir -join -nocomplain \ + * Resources Scripts pkgIndex.tcl] { + set dir [file dirname $file] + if {[file readable $file] && ![info exists procdDirs($dir)]} { + if {[catch {source $file} msg]} { + tclLog "error reading package index file $file: $msg" + } else { + set procdDirs($dir) 1 + } + } + } + set use_path [lrange $use_path 0 end-1] + if {$old_path ne $auto_path} { + foreach dir $auto_path { + lappend use_path $dir + } + set old_path $auto_path } - set old_path $auto_path } } } |