How to enforce a particular Python version during port build

Blair Zajac blair at orcaware.com
Sun Sep 1 00:39:59 UTC 2019



> On Aug 31, 2019, at 5:30 PM, Ralph Seichter <abbot at monksofcool.net> wrote:
> 
> * Blair Zajac:
> 
>> You’ll want to avoid the PATH approach as it requires that
>> ${prefix}/bin/python be symlinked to a Python 3.x, which isn’t always
>> the case.
> 
> Not always, but it is for me:
> 
>  $ ls -dl /opt/local/bin/python
>  lrwxr-xr-x  1 root  admin    24B 11 Jul 16:50 /opt/local/bin/python@ -> /opt/local/bin/python3.7
> 
> Does this not mean it should work on my machine unless something is
> screwing with the PATH variable?

I’m not convinced that build.env is honored all the time.

You could try running ‘/usr/bin/env | sort’ in your build step and seeing if it’s there.

Is this port only for you and you’ll not commit it to the Git repo? Then you can do whatever you want :) If it’ll end up in the Git repo, then it cannot count on any particular select setting.

> 
>> Instead tell it to use ${prefix}/bin/python3.7. You’ll have to poke
>> into the project to see how to tell it specifically which Python
>> binary to use.
> 
> Are you saying that I cannot enforce/extend PATH in the Portfile? I'd
> rather not patch the sources if I can avoid it.

I’m guessing a single reinplace would do the trick.

Which package is this?

Blair



More information about the macports-dev mailing list