• Problem using tkcon when procs are defined in pkgIndex.tcl from tkpath

    From clt.to.davebr@clt.to.davebr@dfgh.net to comp.lang.tcl on Sun Apr 7 14:52:33 2024
    From Newsgroup: comp.lang.tcl

    Installing tkpath from chiselapp.com into a Slackware Linux system with
    the usual ./configure --with-tcl... make, make install seemed to work.
    However executing

    package require tkpath

    in tkcon (version 2.7) gives proc not found errors. The package require worked fine in tclsh or wish.

    The original pkgIndex.tcl is:

    #pkgIndex.tcl. Generated from pkgIndex.tcl.in by configure.
    #
    namespace eval ::tkpath {
    proc load_package {dir} {
    load [file join $dir libtkpath0.3.3.so]
    # Allow optional redirect of library components.
    # Only necessary for testing, but could be used elsewhere.
    if {[info exists ::env(TKPATH_LIBRARY)]} {
    set dir $::env(TKPATH_LIBRARY)
    }
    source $dir/tkpath.tcl
    };# load_package
    }

    package ifneeded tkpath 0.3.3 [list ::tkpath::load_package $dir]

    #*EOF*


    When the load_package proc was implemented as an annonymous procedure in the package ifneeded command tkcon, tclsh and wish can all load the package.


    package ifneeded tkpath 0.3.3 [list apply {{dir} {
    load [file join $dir libtkpath0.3.3.so]
    # Allow optional redirect of library components.
    # Only necessary for testing, but could be used elsewhere.
    if {[info exists ::env(TKPATH_LIBRARY)]} {
    set dir $::env(TKPATH_LIBRARY)
    }
    source $dir/tkpath.tcl
    }} $dir]


    Is this a known problem in tkcon, something unique to the tkpath package, or just something wrong in my system configuration?

    Dave B

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From greg@gregor.ebbing@gmx.de to comp.lang.tcl on Sun Apr 7 18:34:35 2024
    From Newsgroup: comp.lang.tcl

    Am 07.04.24 um 16:52 schrieb clt.to.davebr@dfgh.net:
    Installing tkpath from chiselapp.com into a Slackware Linux system with
    the usual ./configure --with-tcl... make, make install seemed to work. However executing

    package require tkpath

    in tkcon (version 2.7) gives proc not found errors. The package require worked fine in tclsh or wish.

    The original pkgIndex.tcl is:

    #pkgIndex.tcl. Generated from pkgIndex.tcl.in by configure.
    #
    namespace eval ::tkpath {
    proc load_package {dir} {
    load [file join $dir libtkpath0.3.3.so]
    # Allow optional redirect of library components.
    # Only necessary for testing, but could be used elsewhere.
    if {[info exists ::env(TKPATH_LIBRARY)]} {
    set dir $::env(TKPATH_LIBRARY)
    }
    source $dir/tkpath.tcl
    };# load_package
    }

    package ifneeded tkpath 0.3.3 [list ::tkpath::load_package $dir]

    #*EOF*


    When the load_package proc was implemented as an annonymous procedure in the package ifneeded command tkcon, tclsh and wish can all load the package.


    package ifneeded tkpath 0.3.3 [list apply {{dir} {
    load [file join $dir libtkpath0.3.3.so]
    # Allow optional redirect of library components.
    # Only necessary for testing, but could be used elsewhere.
    if {[info exists ::env(TKPATH_LIBRARY)]} {
    set dir $::env(TKPATH_LIBRARY)
    }
    source $dir/tkpath.tcl
    }} $dir]


    Is this a known problem in tkcon, something unique to the tkpath package, or just something wrong in my system configuration?

    Dave B

    #The original pkgIndex.tcl see the same. Works with tclsh and tkcon
    #Is it perhaps not included in the auto_path of tkcon?
    #Compare the output in tclsh and tkcon.


    #! /usr/bin/env tclsh

    # https://wiki.tcl-lang.org/page/The+RC+File
    proc lspackages {{pattern *}} {
    # Force the package loader to do its thing:
    # NOTE: this depends on a side effect of the
    # built-in [package unknown]. Other [package unknown]
    # handlers might not meet our expectations.
    eval [package unknown] Tcl [package provide Tcl]
    set rlist [list ]
    foreach package [lsort [package names]] {
    if {![string match $pattern $package]} { continue }
    foreach version [package versions $package] {
    set present [expr {[string compare $version [package
    provide $package]] ? " " : "+" }]
    set ifneeded [string replace [string trim [string map
    {"\n" " " "\t" " "} [package ifneeded $package $version]]] 50 end "..."]
    #puts [format "%1s%-35s %6s %-75s" $present $package
    $version $ifneeded]
    lappend rlist [list $present $package $version $ifneeded]
    }
    }
    return $rlist
    }

    puts [lspackages tkpath]
    puts [join $auto_path "\n"]

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From greg@gregor.ebbing@gmx.de to comp.lang.tcl on Mon Apr 8 05:58:04 2024
    From Newsgroup: comp.lang.tcl

    Am 07.04.24 um 18:34 schrieb greg:

    #Is it perhaps not included in the auto_path of tkcon?
    #Compare the output in tclsh and tkcon.
    ..


    My suggestion doesn't help.
    It can't be a problem with auto_path, since package ifneeded ... works.
    --- Synchronet 3.20a-Linux NewsLink 1.114