Question about `platforms` and `${os.platform}`

Jason Liu jasonliu at umich.edu
Fri Dec 10 21:07:19 UTC 2021


Hi everyone,

A conversation in one of my PRs has brought up an interesting question that
I've been wondering about for a long time. In Portfiles, whenever I've had
a test for `${os.major} <= xx`, I've typically always added an additional
check for darwin in the front, i.e.:

if {${os.platform} eq "darwin" && ${os.major} <= xx} {

I've done it that way because I basically copied what I saw from other
Portfiles, and because I get gently admonished by the committers when I
forget to. But I've also always wondered why it's necessary. I was under
the impression that the `platforms darwin` line means that the entire
Portfile is supposed to be valid only for `${os.platform} eq "darwin"`, no?
(In other words, my understanding is that a line such as `platforms darwin
freebsd openbsd` is meant to signify that "this Portfile is supposed to be
valid for the listed platforms".) If that's not the case, then what is the
purpose of `platforms darwin`?

-- 
Jason Liu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-dev/attachments/20211210/a8cc5795/attachment.htm>


More information about the macports-dev mailing list