From 218df5159cd2c0888afbc2cf6cefd280d007b22b Mon Sep 17 00:00:00 2001 From: Andreas Rammhold Date: Sat, 14 Aug 2021 13:27:15 +0200 Subject: [PATCH] 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. --- pkgs/development/tools/build-managers/scons/common.nix | 10 ++++++++-- .../development/tools/build-managers/scons/default.nix | 10 ++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/pkgs/development/tools/build-managers/scons/common.nix b/pkgs/development/tools/build-managers/scons/common.nix index 6af302851234..da276be7287c 100644 --- a/pkgs/development/tools/build-managers/scons/common.nix +++ b/pkgs/development/tools/build-managers/scons/common.nix @@ -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 = '' diff --git a/pkgs/development/tools/build-managers/scons/default.nix b/pkgs/development/tools/build-managers/scons/default.nix index 4b07eb0501d8..884d7482faf5 100644 --- a/pkgs/development/tools/build-managers/scons/default.nix +++ b/pkgs/development/tools/build-managers/scons/default.nix @@ -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";