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

Jason Liu jasonliu at umich.edu
Sun Dec 12 00:42:29 UTC 2021


On Sat, Dec 11, 2021 at 5:46 PM Ryan Schmidt <ryandesign at macports.org>
wrote:

> On Dec 11, 2021, at 16:41, Jason Liu wrote:
>
>>
>> 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.


Actually, I find myself needing to use them more and more. For example, I
now often have to check for macOS < 10.12, due to the large overhaul that
happened in AppKit between 10.11 and 10.12. My workarounds for older
versions of macOS are contained inside those `if {${os.major} <= 15}`
conditionals.

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.
>

Does this mean that we can start removing `platforms darwin` from our
portfiles? Or is it one of those "despite the fact that it's a default, you
have to put it in the file anyway"?

-- 
Jason Liu


On Sat, Dec 11, 2021 at 5:46 PM Ryan Schmidt <ryandesign at macports.org>
wrote:

> 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.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-dev/attachments/20211211/4f7b3c05/attachment-0001.htm>


More information about the macports-dev mailing list