|
|
|
@ -8,7 +8,7 @@ |
|
|
|
# (C) 2024 |
|
|
|
# (C) 2024 |
|
|
|
# |
|
|
|
# |
|
|
|
# @@ Meta Begin |
|
|
|
# @@ Meta Begin |
|
|
|
# Application punk::lib 0.3.1 |
|
|
|
# Application punk::lib 0.4.0 |
|
|
|
# Meta platform tcl |
|
|
|
# Meta platform tcl |
|
|
|
# Meta license BSD |
|
|
|
# Meta license BSD |
|
|
|
# @@ Meta End |
|
|
|
# @@ Meta End |
|
|
|
@ -18,7 +18,7 @@ |
|
|
|
# doctools header |
|
|
|
# doctools header |
|
|
|
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++ |
|
|
|
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++ |
|
|
|
#*** !doctools |
|
|
|
#*** !doctools |
|
|
|
#[manpage_begin punkshell_module_punk::lib 0 0.3.1] |
|
|
|
#[manpage_begin punkshell_module_punk::lib 0 0.4.0] |
|
|
|
#[copyright "2024"] |
|
|
|
#[copyright "2024"] |
|
|
|
#[titledesc {punk general utility functions}] [comment {-- Name section and table of contents description --}] |
|
|
|
#[titledesc {punk general utility functions}] [comment {-- Name section and table of contents description --}] |
|
|
|
#[moddesc {punk library}] [comment {-- Description at end of page heading --}] |
|
|
|
#[moddesc {punk library}] [comment {-- Description at end of page heading --}] |
|
|
|
@ -8197,6 +8197,12 @@ namespace eval punk::lib { |
|
|
|
is used, in which case punk::libunknown is sourced from the tm paths that were |
|
|
|
is used, in which case punk::libunknown is sourced from the tm paths that were |
|
|
|
already set up by the earlier part of the script. |
|
|
|
already set up by the earlier part of the script. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
When the kit boot captured runtime static/builtin packages |
|
|
|
|
|
|
|
(::punkboot::static_packages - see punk_main.tcl), the script also copies |
|
|
|
|
|
|
|
that baseline and seeds 'package ifneeded <name> <ver> {load {} <prefix>}' |
|
|
|
|
|
|
|
entries so statically-linked packages (e.g Thread/twapi on a tcl-sfe |
|
|
|
|
|
|
|
runtime) resolve in the target. |
|
|
|
|
|
|
|
|
|
|
|
See also: punk::lib::interp_sync_package_paths" |
|
|
|
See also: punk::lib::interp_sync_package_paths" |
|
|
|
@opts |
|
|
|
@opts |
|
|
|
-libunknown -type boolean -default 0 -help\ |
|
|
|
-libunknown -type boolean -default 0 -help\ |
|
|
|
@ -8235,6 +8241,18 @@ namespace eval punk::lib { |
|
|
|
append script "tcl::tm::add \{*\}\[list [lreverse $tmlist]\]\n" |
|
|
|
append script "tcl::tm::add \{*\}\[list [lreverse $tmlist]\]\n" |
|
|
|
append script "set ::auto_path \[list $ap\]\n" |
|
|
|
append script "set ::auto_path \[list $ap\]\n" |
|
|
|
append script "package prefer $prefer\n" |
|
|
|
append script "package prefer $prefer\n" |
|
|
|
|
|
|
|
#G-058: propagate runtime static/builtin package mappings captured at kit boot |
|
|
|
|
|
|
|
#(see punk_main.tcl) so 'package require' of a statically-linked package (e.g |
|
|
|
|
|
|
|
#Thread/twapi on a tcl-sfe runtime) resolves in the new thread/interp even though |
|
|
|
|
|
|
|
#no pkgIndex for it exists on the (replaced) package search paths. |
|
|
|
|
|
|
|
if {[info exists ::punkboot::static_packages] && [dict size $::punkboot::static_packages]} { |
|
|
|
|
|
|
|
append script "namespace eval ::punkboot {}\n" |
|
|
|
|
|
|
|
append script [list set ::punkboot::static_prefixes $::punkboot::static_prefixes] \n |
|
|
|
|
|
|
|
append script [list set ::punkboot::static_packages $::punkboot::static_packages] \n |
|
|
|
|
|
|
|
dict for {pkgname pinfo} $::punkboot::static_packages { |
|
|
|
|
|
|
|
append script "if \{\[package provide [list $pkgname]\] eq \"\"\} \{[list package ifneeded $pkgname [dict get $pinfo version] [list load {} [dict get $pinfo prefix]]]\}\n" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
if {$do_libunknown} { |
|
|
|
if {$do_libunknown} { |
|
|
|
if {[info exists ::punk::libunknown::epoch]} { |
|
|
|
if {[info exists ::punk::libunknown::epoch]} { |
|
|
|
append script "namespace eval ::punk::libunknown {}\n" |
|
|
|
append script "namespace eval ::punk::libunknown {}\n" |
|
|
|
@ -8299,6 +8317,12 @@ namespace eval punk::lib { |
|
|
|
package unknown handler and scan cache as the parent. This is recommended |
|
|
|
package unknown handler and scan cache as the parent. This is recommended |
|
|
|
when the child will do significant package loading. |
|
|
|
when the child will do significant package loading. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
When the kit boot captured runtime static/builtin packages |
|
|
|
|
|
|
|
(::punkboot::static_packages - see punk_main.tcl), the child also receives |
|
|
|
|
|
|
|
that baseline plus 'package ifneeded <name> <ver> {load {} <prefix>}' |
|
|
|
|
|
|
|
seeding so statically-linked packages (e.g Thread/twapi on a tcl-sfe |
|
|
|
|
|
|
|
runtime) resolve in the child. |
|
|
|
|
|
|
|
|
|
|
|
This is an opt-in helper — call sites that don't use it keep their current |
|
|
|
This is an opt-in helper — call sites that don't use it keep their current |
|
|
|
behavior. It does not load packages, install punk::packagepreference, share |
|
|
|
behavior. It does not load packages, install punk::packagepreference, share |
|
|
|
channels, or configure safe-interp restrictions — those remain caller |
|
|
|
channels, or configure safe-interp restrictions — those remain caller |
|
|
|
@ -8340,6 +8364,20 @@ namespace eval punk::lib { |
|
|
|
interp eval $interp {tcl::tm::remove {*}[tcl::tm::list]} |
|
|
|
interp eval $interp {tcl::tm::remove {*}[tcl::tm::list]} |
|
|
|
interp eval $interp [list tcl::tm::add {*}[lreverse [tcl::tm::list]]] |
|
|
|
interp eval $interp [list tcl::tm::add {*}[lreverse [tcl::tm::list]]] |
|
|
|
interp eval $interp [list package prefer [package prefer]] |
|
|
|
interp eval $interp [list package prefer [package prefer]] |
|
|
|
|
|
|
|
#G-058: propagate runtime static/builtin package mappings captured at kit boot |
|
|
|
|
|
|
|
#(see punk_main.tcl) so 'package require' of a statically-linked package (e.g |
|
|
|
|
|
|
|
#Thread/twapi on a tcl-sfe runtime) resolves in the child interp even though no |
|
|
|
|
|
|
|
#pkgIndex for it exists on the (replaced) package search paths. |
|
|
|
|
|
|
|
if {[info exists ::punkboot::static_packages] && [dict size $::punkboot::static_packages]} { |
|
|
|
|
|
|
|
interp eval $interp [list namespace eval ::punkboot {}] |
|
|
|
|
|
|
|
interp eval $interp [list set ::punkboot::static_prefixes $::punkboot::static_prefixes] |
|
|
|
|
|
|
|
interp eval $interp [list set ::punkboot::static_packages $::punkboot::static_packages] |
|
|
|
|
|
|
|
dict for {pkgname pinfo} $::punkboot::static_packages { |
|
|
|
|
|
|
|
if {[interp eval $interp [list package provide $pkgname]] eq ""} { |
|
|
|
|
|
|
|
interp eval $interp [list package ifneeded $pkgname [dict get $pinfo version] [list load {} [dict get $pinfo prefix]]] |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
#extended: copy epoch + source libunknown + call init |
|
|
|
#extended: copy epoch + source libunknown + call init |
|
|
|
if {$do_libunknown} { |
|
|
|
if {$do_libunknown} { |
|
|
|
if {[info exists ::punk::libunknown::epoch]} { |
|
|
|
if {[info exists ::punk::libunknown::epoch]} { |
|
|
|
@ -9135,7 +9173,7 @@ namespace eval ::punk::args::register { |
|
|
|
package provide punk::lib [tcl::namespace::eval punk::lib { |
|
|
|
package provide punk::lib [tcl::namespace::eval punk::lib { |
|
|
|
variable pkg punk::lib |
|
|
|
variable pkg punk::lib |
|
|
|
variable version |
|
|
|
variable version |
|
|
|
set version 0.3.1 |
|
|
|
set version 0.4.0 |
|
|
|
}] |
|
|
|
}] |
|
|
|
return |
|
|
|
return |
|
|
|
|
|
|
|
|