sconsPackages: expose the python version used with scons

This allows users of scons to pick the correct version of python.
Previously we had issues with some build systems not picking the right
python3 version when adding additional python modules to the build
environment. A famous example of this is mongodb where additional python
modules are required to run the scons build.

This is change doesn't introduce rebuilds (to the best of my knowledge)
as it only adds a passthru argument and changes how we pass the python
version around.

+14 -6
+8 -2
pkgs/development/tools/build-managers/scons/common.nix
··· 1 1 { version, sha256 }: 2 2 3 - { fetchurl, python3Packages, lib }: 3 + { fetchurl, python, lib }: 4 4 5 - python3Packages.buildPythonApplication rec { 5 + python.pkgs.buildPythonApplication rec { 6 6 pname = "scons"; 7 7 inherit version; 8 8 ··· 28 28 mkdir -p "$out/share/man/man1" 29 29 mv "$out/"*.1 "$out/share/man/man1/" 30 30 ''; 31 + 32 + passthru = { 33 + # expose the used python version so tools using this (and extensing scos with other python modules) 34 + # can use the exact same python version. 35 + inherit python; 36 + }; 31 37 32 38 meta = with lib; { 33 39 description = "An improved, cross-platform substitute for Make";
+6 -4
pkgs/development/tools/build-managers/scons/default.nix
··· 1 - { callPackage, python2Packages }: 1 + { callPackage, python2, python3 }: 2 2 3 3 let 4 - mkScons = args: callPackage (import ./common.nix args) { }; 4 + mkScons = args: callPackage (import ./common.nix args) { 5 + python = python3; 6 + }; 5 7 in { 6 8 scons_3_0_1 = (mkScons { 7 9 version = "3.0.1"; 8 10 sha256 = "0wzid419mlwqw9llrg8gsx4nkzhqy16m4m40r0xnh6cwscw5wir4"; 9 - }).override { python3Packages = python2Packages; }; 11 + }).override { python = python3; }; 10 12 scons_3_1_2 = (mkScons { 11 13 version = "3.1.2"; 12 14 sha256 = "1yzq2gg9zwz9rvfn42v5jzl3g4qf1khhny6zfbi2hib55zvg60bq"; 13 - }).override { python3Packages = python2Packages; }; 15 + }).override { python = python2; }; 14 16 scons_latest = mkScons { 15 17 version = "4.1.0"; 16 18 sha256 = "11axk03142ziax6i3wwy9qpqp7r3i7h5jg9y2xzph9i15rv8vlkj";