<pre style='margin:0'>
Joshua Root (jmroot) pushed a commit to branch master
in repository macports-base.
</pre>
<p><a href="https://github.com/macports/macports-base/commit/b5438f4ae408e33be577634c52eadd319c26c922">https://github.com/macports/macports-base/commit/b5438f4ae408e33be577634c52eadd319c26c922</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit b5438f4ae408e33be577634c52eadd319c26c922
</span>Author: Joshua Root <jmr@macports.org>
AuthorDate: Mon Apr 8 18:07:03 2024 +1000
<span style='display:block; white-space:pre;color:#404040;'> Use dict for option_defaults
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Also put it in the options namespace.
</span>---
src/port1.0/portconfigure.tcl | 6 +++---
src/port1.0/portutil.tcl | 15 ++++++++-------
2 files changed, 11 insertions(+), 10 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/port1.0/portconfigure.tcl b/src/port1.0/portconfigure.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index 0af48e9c5..0cafac268 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/port1.0/portconfigure.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/port1.0/portconfigure.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -195,11 +195,11 @@ option_proc xmkmf.cmd portconfigure::set_configure_type
</span> ##
# Local helper proc
proc portconfigure::add_build_dep { type dep } {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- global ${type}.cmd option_defaults
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ global ${type}.cmd options::option_defaults
</span>
if {![info exists ${type}.cmd] || (
<span style='display:block; white-space:pre;background:#ffe0e0;'>- ([info exists option_defaults(${type}.cmd)] && [set ${type}.cmd] eq $option_defaults(${type}.cmd)) ||
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- (![info exists option_defaults(${type}.cmd)] && [set ${type}.cmd] eq ${type})
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ([dict exists $option_defaults ${type}.cmd] && [set ${type}.cmd] eq [dict get $option_defaults ${type}.cmd]) ||
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ (![dict exists $option_defaults ${type}.cmd] && [set ${type}.cmd] eq ${type})
</span> )} {
# Add dependencies if they are not already in the list
depends_build-delete {*}$dep
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/port1.0/portutil.tcl b/src/port1.0/portutil.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index ded6537b7..712f0df3d 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/port1.0/portutil.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/port1.0/portutil.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -46,6 +46,7 @@ set all_variants [list]
</span> ########### External High Level Procedures ###########
namespace eval options {
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ variable option_defaults [dict create]
</span> }
# option
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -481,8 +482,8 @@ proc command_exec {args} {
</span> # and adds a variable trace. The variable traces allows for delayed
# variable and command expansion in the variable's default value.
proc default {option val} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- global option_defaults $option
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[info exists option_defaults($option)]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ global options::option_defaults $option
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[dict exists $option_defaults $option]} {
</span> ui_debug "Re-registering default for $option"
# remove the old trace
trace remove variable $option [list read write unset] default_check
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -491,7 +492,7 @@ proc default {option val} {
</span> # do not reset the value
return
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set option_defaults($option) $val
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ dict set option_defaults $option $val
</span> set $option $val
trace add variable $option [list read write unset] default_check
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -501,19 +502,19 @@ proc default {option val} {
</span> # for default variable values
proc default_check {varName index op} {
set optionName [namespace tail $varName]
<span style='display:block; white-space:pre;background:#ffe0e0;'>- global option_defaults $optionName
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ global options::option_defaults $optionName
</span> switch $op {
write {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- unset option_defaults($optionName)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ dict unset option_defaults $optionName
</span> trace remove variable $optionName [list read write unset] default_check
return
}
read {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- uplevel #0 [list set $optionName] [subst -nocommands {[subst {$option_defaults($optionName)}]}]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ uplevel #0 [list set $optionName [uplevel #0 [list subst [dict get $option_defaults $optionName]]]]
</span> return
}
unset {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- unset option_defaults($optionName)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ dict unset option_defaults $optionName
</span> trace remove variable $optionName [list read write unset] default_check
return
}
</pre><pre style='margin:0'>
</pre>