[25979] trunk/base/src
source_changes at macosforge.org
source_changes at macosforge.org
Thu Jun 7 22:27:14 PDT 2007
Revision: 25979
http://trac.macosforge.org/projects/macports/changeset/25979
Author: eridius at macports.org
Date: 2007-06-07 22:27:14 -0700 (Thu, 07 Jun 2007)
Log Message:
-----------
Promote try {} finally {} to a global "language-level" feature provided by a new package darwinports_util.
darwinports_util is a package intended for global utilities, like try-finally, which should be available to the entire macports infrastructure. It's required by the darwinports and portutil packages so it's available to base code as well as the Portfile infrastructure
Modified Paths:
--------------
trunk/base/src/darwinports1.0/Makefile
trunk/base/src/darwinports1.0/darwinports.tcl
trunk/base/src/port1.0/portutil.tcl
trunk/base/src/port1.0/tests/portutil.tcl
Added Paths:
-----------
trunk/base/src/darwinports1.0/darwinports_util.tcl
Modified: trunk/base/src/darwinports1.0/Makefile
===================================================================
--- trunk/base/src/darwinports1.0/Makefile 2007-06-08 05:00:38 UTC (rev 25978)
+++ trunk/base/src/darwinports1.0/Makefile 2007-06-08 05:27:14 UTC (rev 25979)
@@ -1,5 +1,5 @@
-SRCS= darwinports.tcl darwinports_dlist.tcl darwinports_autoconf.tcl \
- darwinports_index.tcl darwinports_fastload.tcl
+SRCS= darwinports.tcl darwinports_dlist.tcl darwinports_util.tcl \
+ darwinports_autoconf.tcl darwinports_index.tcl darwinports_fastload.tcl
OBJS= darwinports.o portconf.o session.o util.o
SHLIB_NAME= Darwinports${SHLIB_SUFFIX}
Modified: trunk/base/src/darwinports1.0/darwinports.tcl
===================================================================
--- trunk/base/src/darwinports1.0/darwinports.tcl 2007-06-08 05:00:38 UTC (rev 25978)
+++ trunk/base/src/darwinports1.0/darwinports.tcl 2007-06-08 05:27:14 UTC (rev 25979)
@@ -34,6 +34,7 @@
package provide darwinports 1.0
package require darwinports_dlist 1.0
package require darwinports_index 1.0
+package require darwinports_util 1.0
namespace eval darwinports {
namespace export bootstrap_options user_options portinterp_options open_dports ui_priorities
Added: trunk/base/src/darwinports1.0/darwinports_util.tcl
===================================================================
--- trunk/base/src/darwinports1.0/darwinports_util.tcl (rev 0)
+++ trunk/base/src/darwinports1.0/darwinports_util.tcl 2007-06-08 05:27:14 UTC (rev 25979)
@@ -0,0 +1,50 @@
+# darwinports.tcl
+# $Id$
+#
+# Copyright (c) 2007 Kevin Ballard <eridius at macports.org>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. Neither the name of Apple Computer, Inc. nor the names of its contributors
+# may be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+package provide darwinports_util 1.0
+
+# Provide some global utilities
+
+# try-finally block
+# Usage: try { script1 } finally { script2 }
+proc try {script1 finally script2} {
+ if {$finally ne "finally"} {
+ error "Usage: try { script1 } finally { script2 }"
+ }
+ if {[set fail [catch {uplevel $script1} result]]} {
+ set savedInfo $::errorInfo
+ set savedCode $::errorCode
+ }
+ uplevel $script2
+ if {$fail} {
+ return -code $fail -errorinfo $savedInfo -errorcode $savedCode $result
+ }
+}
Property changes on: trunk/base/src/darwinports1.0/darwinports_util.tcl
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Modified: trunk/base/src/port1.0/portutil.tcl
===================================================================
--- trunk/base/src/port1.0/portutil.tcl 2007-06-08 05:00:38 UTC (rev 25978)
+++ trunk/base/src/port1.0/portutil.tcl 2007-06-08 05:27:14 UTC (rev 25979)
@@ -35,6 +35,7 @@
package provide portutil 1.0
package require Pextlib 1.0
package require darwinports_dlist 1.0
+package require darwinports_util 1.0
package require msgcat
package require porttrace 1.0
Modified: trunk/base/src/port1.0/tests/portutil.tcl
===================================================================
--- trunk/base/src/port1.0/tests/portutil.tcl 2007-06-08 05:00:38 UTC (rev 25978)
+++ trunk/base/src/port1.0/tests/portutil.tcl 2007-06-08 05:27:14 UTC (rev 25979)
@@ -206,22 +206,6 @@
}
}
-# try-finally block
-# Usage: try { script1 } finally { script2 }
-proc try {script1 finally script2} {
- if {$finally ne "finally"} {
- error "Usage: try { script1 } finally { script2 }"
- }
- if {[set fail [catch {uplevel $script1} result]]} {
- set savedInfo $::errorInfo
- set savedCode $::errorCode
- }
- uplevel $script2
- if {$fail} {
- return -code $fail -errorinfo $savedInfo -errorcode $savedCode $result
- }
-}
-
# run all tests
foreach proc [info procs test_*] {
$proc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20070607/edcb4f1a/attachment.html
More information about the macports-changes
mailing list