Portfile test if specific port exists

Joshua Root jmr at macports.org
Sun Jul 10 01:40:14 UTC 2022


On 2022-7-10 09:56 , Steven Smith wrote:
> How does one test the existence of a specific port? E.g.
> 
> if {port_exists py310-tensorflow} {
>      do this
> } else {
>      do that
> }

The answer to your actual question depends on whether by "exists" you 
mean exists in the ports tree, or is installed, or is active.

But more importantly, you should almost certainly not do this, because 
it makes the build non-reproducible. Just declare dependencies on what 
your port needs.

- Josh


More information about the macports-dev mailing list