[25204] trunk/base/src/port/port.tcl

source_changes at macosforge.org source_changes at macosforge.org
Tue May 15 16:49:34 PDT 2007


Revision: 25204
          http://trac.macosforge.org/projects/macports/changeset/25204
Author:   jberry at macports.org
Date:     2007-05-15 16:49:34 -0700 (Tue, 15 May 2007)

Log Message:
-----------

>From the department of code code obfuscation. Why use 1 line of code when 7 will do?

And lastly, one more time for dluke: premature code optimization suspected in Falwell's death

Modified Paths:
--------------
    trunk/base/src/port/port.tcl

Modified: trunk/base/src/port/port.tcl
===================================================================
--- trunk/base/src/port/port.tcl	2007-05-15 23:33:02 UTC (rev 25203)
+++ trunk/base/src/port/port.tcl	2007-05-15 23:49:34 UTC (rev 25204)
@@ -1241,12 +1241,7 @@
 				}
 				puts -nonewline ", $portinfo(portdir)" 
 				if {[info exists portinfo(variants)]} {
-					puts -nonewline " (Variants: "
-					for {set i 0} {$i < [llength $portinfo(variants)]} {incr i} {
-						if {$i > 0} { puts -nonewline ", " }
-						puts -nonewline "[lindex $portinfo(variants) $i]"
-					}
-					puts -nonewline ")"
+					puts -nonewline " (Variants: [join $portinfo(variants) ", "])"
 				}
 				puts ""
 				if {[info exists portinfo(homepage)]} { 
@@ -1258,37 +1253,23 @@
 				}
 	
 				# find build dependencies
-				if {[info exists portinfo(depends_build)]} {
-					puts -nonewline "Build Dependencies: "
-					for {set i 0} {$i < [llength $portinfo(depends_build)]} {incr i} {
-						if {$i > 0} { puts -nonewline ", " }
-						puts -nonewline "[lindex [split [lindex $portinfo(depends_build) $i] :] end]"
+				foreach {key title} {
+					depends_build "Build Dependencies"
+					depends_lib "Library Dependencies"
+					depends_run "Runtime Dependencies"
+				} {
+					if {[info exists portinfo($key)]} {
+						puts -nonewline "$title: "
+						set joiner ""
+						foreach d $portinfo($key) {
+							puts -nonewline $joiner; set joiner ", "
+							puts -nonewline "[lindex [split $d :] end]"
+						}
+						set nodeps false
+						puts ""
 					}
-					set nodeps false
-					puts ""
 				}
-		
-				# find library dependencies
-				if {[info exists portinfo(depends_lib)]} {
-					puts -nonewline "Library Dependencies: "
-					for {set i 0} {$i < [llength $portinfo(depends_lib)]} {incr i} {
-						if {$i > 0} { puts -nonewline ", " }
-						puts -nonewline "[lindex [split [lindex $portinfo(depends_lib) $i] :] end]"
-					}
-					set nodeps false
-					puts ""
-				}
-		
-				# find runtime dependencies
-				if {[info exists portinfo(depends_run)]} {
-					puts -nonewline "Runtime Dependencies: "
-					for {set i 0} {$i < [llength $portinfo(depends_run)]} {incr i} {
-						if {$i > 0} { puts -nonewline ", " }
-						puts -nonewline "[lindex [split [lindex $portinfo(depends_run) $i] :] end]"
-					}
-					set nodeps false
-					puts ""
-				}
+					
 				if {[info exists portinfo(platforms)]} { puts "Platforms: $portinfo(platforms)"}
 				if {[info exists portinfo(maintainers)]} { puts "Maintainers: $portinfo(maintainers)"}
 			}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20070515/f1310845/attachment.html


More information about the macports-changes mailing list