From 61bc9e12a4e09307aa986369baa66cc739791e6f Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Mon, 9 Mar 2020 14:37:20 -0400 Subject: [PATCH] hepmc3: add python support --- .../libraries/physics/hepmc3/default.nix | 15 ++++++++++++--- pkgs/top-level/all-packages.nix | 4 +++- pkgs/top-level/python-packages.nix | 4 ++++ 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/pkgs/development/libraries/physics/hepmc3/default.nix b/pkgs/development/libraries/physics/hepmc3/default.nix index ceb0669d855b..a07c3c19a1bb 100644 --- a/pkgs/development/libraries/physics/hepmc3/default.nix +++ b/pkgs/development/libraries/physics/hepmc3/default.nix @@ -1,4 +1,9 @@ -{ stdenv, fetchurl, cmake, coreutils, root }: +{ stdenv, fetchurl, cmake, coreutils, python, root }: + +let + pythonVersion = with stdenv.lib.versions; "${major python.version}${minor python.version}"; + withPython = python != null; +in stdenv.mkDerivation rec { pname = "hepmc3"; @@ -10,10 +15,14 @@ stdenv.mkDerivation rec { }; nativeBuildInputs = [ cmake ]; - buildInputs = [ root ]; + buildInputs = [ root ] + ++ stdenv.lib.optional withPython python; cmakeFlags = [ - "-DHEPMC3_ENABLE_PYTHON=OFF" + "-DHEPMC3_ENABLE_PYTHON=${if withPython then "ON" else "OFF"}" + ] ++ stdenv.lib.optionals withPython [ + "-DHEPMC3_PYTHON_VERSIONS=${if python.isPy3k then "3.X" else "2.X"}" + "-DHEPMC3_Python_SITEARCH${pythonVersion}=${placeholder "out"}/${python.sitePackages}" ]; postInstall = '' diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 3e678efb3048..8ad14f8dfb97 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -25153,7 +25153,9 @@ in hepmc2 = callPackage ../development/libraries/physics/hepmc2 { }; - hepmc3 = callPackage ../development/libraries/physics/hepmc3 { }; + hepmc3 = callPackage ../development/libraries/physics/hepmc3 { + python = null; + }; herwig = callPackage ../development/libraries/physics/herwig { }; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index a76566fb228e..46a2f803d25a 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -2256,6 +2256,10 @@ in { jsonrpc-websocket = callPackage ../development/python-modules/jsonrpc-websocket { }; + hepmc3 = toPythonModule (pkgs.hepmc3.override { + inherit python; + }); + onkyo-eiscp = callPackage ../development/python-modules/onkyo-eiscp { }; tablib = callPackage ../development/python-modules/tablib { };