Question about `platforms` and `${os.platform}`
Ryan Schmidt
ryandesign at macports.org
Sat Dec 11 22:46:28 UTC 2021
On Dec 11, 2021, at 16:41, Jason Liu wrote:
> Then would it be easier (or even kosher) to simply wrap the majority of the Portfile inside of a single
>
> if {${os.platform} eq "darwin"} {
The shorthand way to do that is:
platform darwin {
> and be done with it, instead of needing to add one each and every time I have a conditional involving `${os.major}`?
I wouldn't expect you to need to write more than a couple such conditionals in a portfile so I wouldn't expect it to be that inconvenient.
We use platform darwin blocks to isolate things that are obviously Mac-specific. It would be odd to see such a block enclosing most of a portfile, even bits which are obviously not Mac-specific.
>> The platforms line is not used by MacPorts in any way at this time, other than to display it in the output of "port info". There is a ticket about possibly using it in the future as a way to indicate which OS versions the port is compatible with, but I don't think that got beyond the idea phase.
>
> That seems like a pity, and a bit of a waste, considering that platforms is being included in each and every Portfile.
Well, it's as much a pity as any unimplemented feature in MacPorts.
Josh did recently commit "darwin" as a default for platforms, so it is no longer mandatory to explicitly put a platforms line in each portfile.
More information about the macports-dev
mailing list