diff options
Diffstat (limited to 'library/package.tcl')
-rw-r--r-- | library/package.tcl | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/library/package.tcl b/library/package.tcl index 9eb155e..a5b1407 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.28 2004/03/17 18:14:14 das Exp $ +# RCS: @(#) $Id: package.tcl,v 1.29 2004/07/28 18:00:10 dgp Exp $ # # Copyright (c) 1991-1993 The Regents of the University of California. # Copyright (c) 1994-1998 Sun Microsystems, Inc. @@ -12,11 +12,9 @@ # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# Create the package namespace -namespace eval ::pkg { -} +namespace eval tcl::Pkg {} -# pkg_compareExtension -- +# ::tcl::Pkg::CompareExtension -- # # Used internally by pkg_mkIndex to compare the extension of a file to # a given extension. On Windows, it uses a case-insensitive comparison @@ -31,7 +29,7 @@ namespace eval ::pkg { # Results: # Returns 1 if the extension matches, 0 otherwise -proc pkg_compareExtension { fileName {ext {}} } { +proc tcl::Pkg::CompareExtension { fileName {ext {}} } { global tcl_platform if {![string length $ext]} {set ext [info sharedlibextension]} if {[string equal $tcl_platform(platform) "windows"]} { @@ -246,7 +244,8 @@ proc pkg_mkIndex {args} { # just deleted the unknown procedure. This doesn't handle # procedures with default arguments. - foreach p {pkg_compareExtension} { + foreach p {::tcl::Pkg::CompareExtension} { + $c eval [list namespace eval [namespace qualifiers $p] {}] $c eval [list proc $p [info args $p] [info body $p]] } @@ -284,7 +283,7 @@ proc pkg_mkIndex {args} { # on some systems (like SunOS) the loader will abort the # whole application when it gets an error. - if {[pkg_compareExtension $::tcl::file [info sharedlibextension]]} { + if {[::tcl::Pkg::CompareExtension $::tcl::file [info sharedlibextension]]} { # The "file join ." command below is necessary. # Without it, if the file name has no \'s and we're # on UNIX, the load command will invoke the @@ -403,7 +402,7 @@ proc pkg_mkIndex {args} { foreach {name version} $pkg { break } - lappend cmd ::pkg::create -name $name -version $version + lappend cmd ::tcl::Pkg::Create -name $name -version $version foreach spec $files($pkg) { foreach {file type procs} $spec { if { $direct } { @@ -635,13 +634,13 @@ proc tcl::MacOSXPkgUnknown {original name version {exact {}}} { } } -# ::pkg::create -- +# ::tcl::Pkg::Create -- # # Given a package specification generate a "package ifneeded" statement # for the package, suitable for inclusion in a pkgIndex.tcl file. # # Arguments: -# args arguments used by the create function: +# args arguments used by the Create function: # -name packageName # -version packageVersion # -load {filename ?{procs}?} @@ -661,7 +660,7 @@ proc tcl::MacOSXPkgUnknown {original name version {exact {}}} { # Results: # An appropriate "package ifneeded" statement for the package. -proc ::pkg::create {args} { +proc ::tcl::Pkg::Create {args} { append err(usage) "[lindex [info level 0] 0] " append err(usage) "-name packageName -version packageVersion" append err(usage) "?-load {filename ?{procs}?}? ... " @@ -754,3 +753,11 @@ proc ::pkg::create {args} { return $cmdline } +# Change this to +# interp alias {} ::pkg::create {} ::tcl::Pkg::Create +# as soon as safe-2.1 accepts it. +namespace eval pkg { + proc create args { + uplevel 1 ::tcl::Pkg::Create $args + } +} |