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.
This commit is contained in:
Andreas Rammhold 2021-08-14 13:27:15 +02:00
parent 4cdf725049
commit 218df5159c
No known key found for this signature in database
GPG key ID: E432E410B5E48C86
2 changed files with 14 additions and 6 deletions

View file

@ -1,8 +1,8 @@
{ version, sha256 }:
{ fetchurl, python3Packages, lib }:
{ fetchurl, python, lib }:
python3Packages.buildPythonApplication rec {
python.pkgs.buildPythonApplication rec {
pname = "scons";
inherit version;
@ -29,6 +29,12 @@ python3Packages.buildPythonApplication rec {
mv "$out/"*.1 "$out/share/man/man1/"
'';
passthru = {
# expose the used python version so tools using this (and extensing scos with other python modules)
# can use the exact same python version.
inherit python;
};
meta = with lib; {
description = "An improved, cross-platform substitute for Make";
longDescription = ''

View file

@ -1,16 +1,18 @@
{ callPackage, python2Packages }:
{ callPackage, python2, python3 }:
let
mkScons = args: callPackage (import ./common.nix args) { };
mkScons = args: callPackage (import ./common.nix args) {
python = python3;
};
in {
scons_3_0_1 = (mkScons {
version = "3.0.1";
sha256 = "0wzid419mlwqw9llrg8gsx4nkzhqy16m4m40r0xnh6cwscw5wir4";
}).override { python3Packages = python2Packages; };
}).override { python = python3; };
scons_3_1_2 = (mkScons {
version = "3.1.2";
sha256 = "1yzq2gg9zwz9rvfn42v5jzl3g4qf1khhny6zfbi2hib55zvg60bq";
}).override { python3Packages = python2Packages; };
}).override { python = python2; };
scons_latest = mkScons {
version = "4.1.0";
sha256 = "11axk03142ziax6i3wwy9qpqp7r3i7h5jg9y2xzph9i15rv8vlkj";