How to enforce a particular Python version during port build

Fred Wright fw at fwright.net
Sun Sep 1 02:02:45 UTC 2019


On Sat, 31 Aug 2019, Blair Zajac wrote:

> The problem could be scons. It looks like
>
> https://github.com/mongodb/mongo/blob/r4.2.0/SConstruct
>
> requires Python 3.5 but Scons runs against Python 2.7:
>
> $ head /opt/local/bin/scons
> #!/opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7

Well-designed build procedures allow the Python version to be specified 
distinctly from the SCons Python version.  See if this build procedure has 
some sort of "target python" option.

> So try changing python.default_version in scons’ portfile and rebuilding it.

Even if it's necessary to run SCons with the target Python to get around a 
dumb build procedure, there's no reason to alter the SCons installation. 
Just invoke SCons with the desired Python.  I.e., instead of:

 	scons <args>

use:

 	$<prefix>/bin/pythonX.Y scons <args>

Fred Wright


More information about the macports-dev mailing list