[48222] trunk/base/src/port1.0/portutil.tcl
raimue at macports.org
raimue at macports.org
Mon Mar 16 20:15:59 PDT 2009
Revision: 48222
http://trac.macports.org/changeset/48222
Author: raimue at macports.org
Date: 2009-03-16 20:15:59 -0700 (Mon, 16 Mar 2009)
Log Message:
-----------
port1.0/portutil.tcl:
Revive option_deprecate and make it actually work
Modified Paths:
--------------
trunk/base/src/port1.0/portutil.tcl
Modified: trunk/base/src/port1.0/portutil.tcl
===================================================================
--- trunk/base/src/port1.0/portutil.tcl 2009-03-17 02:54:08 UTC (rev 48221)
+++ trunk/base/src/port1.0/portutil.tcl 2009-03-17 03:15:59 UTC (rev 48222)
@@ -173,6 +173,42 @@
}
##
+# Print a warning for deprecated options
+#
+# @param option deprecated option
+# @param action read/set
+# @param value ignored
+proc warn_deprecated_option {option action {value ""}} {
+ global portname $option deprecated_options
+ set newoption $deprecated_options($option)
+
+ if {$newoption == ""} {
+ ui_warn "Port $portname using deprecated option \"$option\"."
+ return
+ }
+
+ ui_warn "Port $portname using deprecated option \"$option\", superseded by \"$newoption\"."
+ if {$action != "read"} {
+ $newoption [set $option]
+ } else {
+ $option [set $newoption]
+ }
+}
+
+##
+# Causes a warning to be printed when an option is set or accessed
+#
+# @param option name of the option
+# @param newoption name of a superseding option
+proc option_deprecate {option {newoption ""} } {
+ global deprecated_options
+ # If a new option is specified, default the option to $newoption
+ set deprecated_options($option) $newoption
+ # Register a proc for printing a warning
+ option_proc $option warn_deprecated_option
+}
+
+##
# Registers a proc to be called when an option is changed
#
# @param option the name of the option
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090316/cb882f9d/attachment.html>
More information about the macports-changes
mailing list