[116346] trunk/dports/_resources/port1.0/group/mpi-1.0.tcl

sean at macports.org sean at macports.org
Thu Jan 23 12:12:43 PST 2014


Revision: 116346
          https://trac.macports.org/changeset/116346
Author:   sean at macports.org
Date:     2014-01-23 12:12:43 -0800 (Thu, 23 Jan 2014)
Log Message:
-----------
mpi-1.0: add mpi.enforce_variant proc

Modified Paths:
--------------
    trunk/dports/_resources/port1.0/group/mpi-1.0.tcl

Modified: trunk/dports/_resources/port1.0/group/mpi-1.0.tcl
===================================================================
--- trunk/dports/_resources/port1.0/group/mpi-1.0.tcl	2014-01-23 20:12:38 UTC (rev 116345)
+++ trunk/dports/_resources/port1.0/group/mpi-1.0.tcl	2014-01-23 20:12:43 UTC (rev 116346)
@@ -150,6 +150,37 @@
     return ""
 }
 
+proc mpi.enforce_variant {args} {
+    foreach portname $args {
+        if {![catch {set result [active_variants $portname "" ""]}]} {
+            set otmpi  [mpi_active_variant_name $portname]
+            set mympi  [mpi_variant_name]
+
+            if {$otmpi ne "" && $mympi eq ""} {
+                default_variants +$otmpi
+            } elseif {$otmpi ne $mympi} {
+                ui_error "Install $portname +$mympi"
+                return -code error "$portname +$mympi not installed"
+            }
+
+            compilers.enforce_c $portname
+        }
+    }
+}
+
+# only run this if mpi is chosen
+pre-fetch {
+    if {${compilers.require_fortran} && [mpi_variant_isset]} {
+        set mpif [fortran_active_variant_name ${mpi.name}]
+        set myf  [fortran_variant_name]
+
+        if {$myf eq "g95" && $myf ne $mpif} {
+            ui_error "${mpi.name} has a different fortran variant ($mpif) than the selected $myf"
+            return -code error "${mpi.name} needs the $myf variant"
+        }
+    }
+}
+
 proc mpi_variant_isset {} {
     return [expr {[mpi_variant_name] ne ""}]
 }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20140123/e6719965/attachment.html>


More information about the macports-changes mailing list