Skip to content
Tcl Source Code History Of Ticket 218337ffffffffff
Login

History Of Ticket 218337ffffffffff

Artifacts Associated With Ticket 218337ffffffffff

  1. Ticket change [a9c1b47b85] (rid 99207) by nobody on 2000-10-26 00:56:24:

    1. assignee initialized to: "nobody"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      OriginalBugID: 3974 Bug
      Version: 8.3b2
      SubmitDate: '2000-01-04'
      LastModified: '2000-02-07'
      Severity: LOW
      Status: Closed
      Submitter: shawn
      ChangedBy: hobbs
      OS: Windows NT
      FixedDate: '2000-10-25'
      ClosedDate: '2000-02-07'
      
      
      Package present produces an error and breaks out of loop -  return from script is an error - package is not present - it would be nice if it told something about the state of the interpretor - so it could be used as a test - I'd like it to return zero if it's not in an interactive interpretor  - and it would be nicer still - if it were called without any arguments - if it could tell you all the packages currently loaded.  much in the same way info loaded - works.  
      
      What would really be nice is if it were an info packages comnmand - returning a list if no options are used and a version number if a package is specified.  
      
      script ------------------
      
      # This probably doesn't need to produce an error either 
      
      catch { package require {} }
      
      foreach a " [package names] " {
           puts $a 
           set c "100.0"
           set d '''
         if ![ package present  $a ] { 
      # to match the extra if a bove 
      
      #     catch { package present $a } msg 
      #     if [regsub -- not $msg  nothing msg ] { 
                 foreach b " [package versions $a] " {  
                       lappend l  " $a $b "      
                       puts $l 
                       puts " I could load $a here" 
                       if  { [package vcompare $b $c] == -1 } { 
                            if [string equal $a $d ] { 
                                 package forget $a 
                            } 
                      }
                      set c $b 
                      set d $a
      
                      package require -exact $a $b 
      
                }  
           }
          }
      }
      
      
      
      Below is an example of how getting all the packages is done,
      and whether they have been loaded or not.
      
      proc tkConPkgMenu {m app type} {
          global TKCON
      
          # just in case stuff has been added to the auto_path
          # we have to make sure that the errorInfo doesn't get screwed up
          tkConEvalAttached {
      set __tkcon_error $errorInfo
      catch {package require bogus-package-name}
      set errorInfo ${__tkcon_error}
      unset __tkcon_error
          }
          $m delete 0 end
          foreach pkg [tkConEvalAttached [list info loaded {}]] {
      set loaded([lindex $pkg 1]) [package provide $pkg]
          }
          foreach pkg [lremove [tkConEvalAttached {package names}] Tcl] {
      set version [tkConEvalAttached [list package provide $pkg]]
      if {[string compare {} $version]} {
          set loaded($pkg) $version
      } elseif {![info exists loaded($pkg)]} {
          set loadable($pkg) [list package require $pkg]
      }
          }
          foreach pkg [tkConEvalAttached {info loaded}] {
      set pkg [lindex $pkg 1]
      if {![info exists loaded($pkg)] && ![info exists loadable($pkg)]} {
          set loadable($pkg) [list load {} $pkg]
      }
          }
          set npkg 0
          foreach pkg [lsort -dictionary [array names loadable]] {
      foreach v [tkConEvalAttached [list package version $pkg]] {
          set brkcol [expr {([incr npkg]%16)==0}]
          $m add command -label "Load $pkg ($v)" -command  "tkConEvalOther [list $app] $type $loadable($pkg) $v"  -columnbreak $brkcol
      }
          }
          if {[info exists loaded] && [info exists loadable]} {
      $m add separator
          }
          foreach pkg [lsort -dictionary [array names loaded]] {
      $m add command -label "${pkg}$loaded($pkg) Loaded" -state disabled
          }
      } 
      -- 02/07/2000 hobbs
      
      
      
    4. foundin initialized to: "obsolete: 8.3b2"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "nobody"
    9. subsystem initialized to: "56. LibTomMath"
    10. title initialized to:
      Package present produces an error and breaks out of loop
      
    11. type initialized to: "RFE"
  2. Ticket change [6a2fc82c55] (rid 128101) by welch on 2000-10-26 08:20:07:

    1. closedate changed to: "2000-10-26T01:20:07"
    2. closer changed to: "welch"
    3. priority changed to: "2"
    4. resolution changed to: "Fixed"
    5. status changed to: "Closed"
  3. Ticket change [f575b5d563] (rid 130112) by dgp on 2001-04-06 02:13:43:

    1. foundin changed to: "None"
    2. status changed to: "Open"
    3. subsystem changed to: "None"
  4. Ticket change [5947cf5a1b] (rid 117952) by dgp on 2001-04-06 02:14:08:

    1. closedate changed to: "2001-04-05T19:14:08"
    2. closer changed to: "dgp"
    3. status changed to: "Closed"
    4. subsystem changed to: "39. Package Manager"