path depends with wildcard?

Lawrence Velázquez larryv at
Tue Jan 20 11:17:31 PST 2015

On Jan 20, 2015, at 12:25 PM, Michael Dickens <michaelld at> wrote:

> I've been working on getting a "swig-devel" port up and running, and it
> works locally for me. But in order to use it (e.g.,
> "swig-python-devel"), I need to specify dependencies using a wildcard
> because we don't know the SWIG version. For example, something like:
> {{{
> depends-build-append path:share/swig/*/python:swig-python
> }}}
> where the "*" is actually the SWIG version string (e.g., "3.0.4"). I
> could just have SWIG install into "${prefix}/share/swig/" without a
> version, but that would take work on my end. I tried using "*" and doing
> a "glob" but that didn't work. I can hack around it using:
> {{{
>    set swig_python_dir [glob ${prefix}/share/swig/*/python]
>    if {${swig_python_dir} ne ""} {
>        set swig_python_depends [strsed ${swig_python_dir}
>        {s@${prefix}@@}]
>        depends_build-append path:${swig_python_depends}:swig-python
>    } else {
>        depends_build-append port:swig-python
>    }
> }}}
> but that's ugly & cumbersome. There has got to be a better way. Any
> advice on a robust yet concise way to do this? Thanks! - MLD

The depspec is interpreted as a regular expression (with some caveats), not a glob. For instance, my HandBrake WIP portfile contains this:

    depends_build       port:autoconf \
                        port:automake \
                        port:libtool \
                       {bin:python(2(\.(4|5|6|7))?)?:python27} \

You'll probably have to experiment a bit to find something that works.


More information about the macports-dev mailing list