Programmatically finding dependencies for a Portfile

Rainer Müller raimue at
Thu May 28 06:45:32 PDT 2015

On 2015-05-28 14:44, Artur Szostak wrote:
> package require macports
> mportinit
> set mport [mportopen "file:///tmp/testport" [list] [list]]

If you want a specific subport, you would need to give its name in the
list of options here. This list of options consists of pairs of key and
value as list items.

set mport [mportopen "file:///tmp/testport" [list subport "testsubport"] [list]]

> array unset portinfo
> array set portinfo [mportinfo $mport]
> mportclose $mport
> array set depsdict {depends_build build depends_lib lib depends_run run}
> foreach deptype [array names depsdict] {
>     if {[info exists portinfo($deptype)] && \
>         [string length $portinfo($deptype)] > 0} \
>     {
>         foreach dependency $portinfo($deptype) {
>             puts "$depsdict($deptype) $dependency"
>         }
>     }
> }
> _______________________________________________________
> How can I access the dependencies for the subports?
> Is there any developers manual that I could refer to?
> Is the API and structures documented anywhere?

Unfortunately, the internal API is very sparsely documented if at all...

There is a section dedicated to it in the the guide, but as you already
got this far, you seem to know most of its content already.

Hope that helps,

More information about the macports-dev mailing list