[25447] branches/dp2mp-move/base/src/port/port.tcl

source_changes at macosforge.org source_changes at macosforge.org
Mon May 21 23:18:35 PDT 2007


Revision: 25447
          http://trac.macosforge.org/projects/macports/changeset/25447
Author:   jmpp at macports.org
Date:     2007-05-21 23:18:35 -0700 (Mon, 21 May 2007)

Log Message:
-----------
Merging jberry's r25203, r25204, r25205 & r25206: Improvements to variants descriptions.

Modified Paths:
--------------
    branches/dp2mp-move/base/src/port/port.tcl

Modified: branches/dp2mp-move/base/src/port/port.tcl
===================================================================
--- branches/dp2mp-move/base/src/port/port.tcl	2007-05-22 06:13:18 UTC (rev 25446)
+++ branches/dp2mp-move/base/src/port/port.tcl	2007-05-22 06:18:35 UTC (rev 25447)
@@ -1239,26 +1239,11 @@
 				if {[info exists portinfo(revision)] && $portinfo(revision) > 0} { 
 					puts -nonewline ", Revision $portinfo(revision)" 
 				}
-				puts ", $portinfo(portdir)" 
-				
+				puts -nonewline ", $portinfo(portdir)" 
 				if {[info exists portinfo(variants)]} {
-					if {[info exists portinfo(variant_desc)]} {
-						array set descs $portinfo(variant_desc)
-					} else {
-						array set descs ""
-					}
-					puts "Variants:"
-					for {set i 0} {$i < [llength $portinfo(variants)]} {incr i} {
-						set v [lindex $portinfo(variants) $i]
-						if {[info exists descs($v)]} {
-							puts " - $v: $descs($v)"
-						} else {
-							puts " - $v"
-						}
-					}
+					puts -nonewline " (Variants: [join $portinfo(variants) ", "])"
 				}
 				puts ""
-				
 				if {[info exists portinfo(homepage)]} { 
 					puts "$portinfo(homepage)"
 				}
@@ -1267,38 +1252,24 @@
 					puts "\n[join $portinfo(long_description)]\n"
 				}
 	
-				# 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]"
+				# Emit build, library, and runtime dependencies
+				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 [lindex [split $d :] end]"
+							set joiner ","
+						}
+						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)"}
 			}
@@ -1768,10 +1739,21 @@
 		if {![info exists portinfo(variants)]} {
 			puts "$portname has no variants"
 		} else {
+			# Get the variant descriptions
+			if {[info exists portinfo(variant_desc)]} {
+				array set descs $portinfo(variant_desc)
+			} else {
+				array set descs ""
+			}
+
 			# print out all the variants
 			puts "$portname has the variants:"
-			for {set i 0} {$i < [llength $portinfo(variants)]} {incr i} {
-				puts "\t[lindex $portinfo(variants) $i]"
+			foreach v $portinfo(variants) {
+				if {[info exists descs($v)]} {
+					puts "\t$v: $descs($v)"
+				} else {
+					puts "\t$v"
+				}
 			}
 		}
 	}

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


More information about the macports-changes mailing list