path dependency

David Strubbe dstrubbe at gmail.com
Wed Jun 12 23:29:03 PDT 2013


Hi all,

I wonder if there is a way in a Portfile to see if a particular port is
active or not, or alternately, to see if a path dependency was fulfilled by
the file or the port.

To be concrete, the arpack port, with +mpich, has

depends_lib-append     path:bin/mpif77:mpich

I want to write an error message if the variant +mpich is selected, the
mpich port is active (which should be equivalent to saying the path
dependency was fulfilled by the port), and mpich was not built with Fortran
wrappers (+gccXX). I tried the code below, in pre-fetch, using
active_variants with a blank requirement, after looking at documentation on
the active_variants port group. However the if-condition with 'catch' does
not work as I wanted. The error message is never written.

   if {[variant_isset mpich]} {
      # mpich has a path dependency on mpif77, which could be satisfied by
mpich-devel instead
      # Fortunately, if mpif77 is present, this check is not needed.
      if { ! [catch { [active_variants mpich ""] } ] } { # be sure mpich
port is present
         if { ![active_variants mpich gcc43] && ![active_variants mpich
gcc44] && \
           ![active_variants mpich gcc45] && ![active_variants mpich gcc46]
&& \
           ![active_variants mpich gcc47] && ![active_variants mpich gcc48]
} {
  ui_error "${name} with +mpich requires that mpich was built with a
Fortran variant"
  return -code error "mpich needs Fortran variant"
        }
      }
    }

Thanks,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-dev/attachments/20130613/e8830677/attachment.html>


More information about the macports-dev mailing list