From acfa2e172b2ce52b07927a4078bce65253ba8d4e Mon Sep 17 00:00:00 2001 From: Chris Ostrouchov Date: Mon, 15 Oct 2018 14:58:31 -0400 Subject: [PATCH] pythonPackages.pyhepmc: refactor move to python-modules added tests --- .../python-modules/pyhepmc/default.nix | 47 +++++++++++++++++++ .../{ => pyhepmc}/pyhepmc_export_edges.patch | 0 .../{ => pyhepmc}/pyhepmc_export_flow.patch | 0 pkgs/top-level/python-packages.nix | 35 +------------- 4 files changed, 48 insertions(+), 34 deletions(-) create mode 100644 pkgs/development/python-modules/pyhepmc/default.nix rename pkgs/development/python-modules/{ => pyhepmc}/pyhepmc_export_edges.patch (100%) rename pkgs/development/python-modules/{ => pyhepmc}/pyhepmc_export_flow.patch (100%) diff --git a/pkgs/development/python-modules/pyhepmc/default.nix b/pkgs/development/python-modules/pyhepmc/default.nix new file mode 100644 index 000000000000..e776749dd7ef --- /dev/null +++ b/pkgs/development/python-modules/pyhepmc/default.nix @@ -0,0 +1,47 @@ +{ stdenv +, buildPythonPackage +, fetchPypi +, isPy3k +, fetchurl +, pkgs +, python +}: + +buildPythonPackage rec { + pname = "pyhepmc"; + version = "0.5.0"; + disabled = isPy3k; + + src = fetchPypi { + inherit pname version; + sha256 = "1rbi8gqgclfvaibv9kzhfis11gw101x8amc93qf9y08ny4jfyr1d"; + }; + + patches = [ + # merge PR https://bitbucket.org/andybuckley/pyhepmc/pull-requests/1/add-incoming-outgoing-generators-for/diff + ./pyhepmc_export_edges.patch + # add bindings to Flow class + ./pyhepmc_export_flow.patch + ]; + + # regenerate python wrapper + preConfigure = '' + rm hepmc/hepmcwrap.py + swig -c++ -I${pkgs.hepmc}/include -python hepmc/hepmcwrap.i + ''; + + buildInputs = [ pkgs.swig pkgs.hepmc ]; + + HEPMCPATH = pkgs.hepmc; + + checkPhase = '' + ${python.interpreter} test/test1.py + ''; + + meta = with stdenv.lib; { + description = "A simple wrapper on the main classes of the HepMC event simulation representation, making it possible to create, read and manipulate HepMC events from Python code"; + license = licenses.gpl2; + maintainers = with maintainers; [ veprbl ]; + }; + +} diff --git a/pkgs/development/python-modules/pyhepmc_export_edges.patch b/pkgs/development/python-modules/pyhepmc/pyhepmc_export_edges.patch similarity index 100% rename from pkgs/development/python-modules/pyhepmc_export_edges.patch rename to pkgs/development/python-modules/pyhepmc/pyhepmc_export_edges.patch diff --git a/pkgs/development/python-modules/pyhepmc_export_flow.patch b/pkgs/development/python-modules/pyhepmc/pyhepmc_export_flow.patch similarity index 100% rename from pkgs/development/python-modules/pyhepmc_export_flow.patch rename to pkgs/development/python-modules/pyhepmc/pyhepmc_export_flow.patch diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 05c8f96894bd..e98589422fc8 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1500,40 +1500,7 @@ in { python-ly = callPackage ../development/python-modules/python-ly {}; - pyhepmc = buildPythonPackage rec { - name = "pyhepmc-${version}"; - version = "0.5.0"; - disabled = isPy3k; - - src = pkgs.fetchurl { - url = "mirror://pypi/p/pyhepmc/${name}.tar.gz"; - sha256 = "1rbi8gqgclfvaibv9kzhfis11gw101x8amc93qf9y08ny4jfyr1d"; - }; - - patches = [ - # merge PR https://bitbucket.org/andybuckley/pyhepmc/pull-requests/1/add-incoming-outgoing-generators-for/diff - ../development/python-modules/pyhepmc_export_edges.patch - # add bindings to Flow class - ../development/python-modules/pyhepmc_export_flow.patch - ]; - - # regenerate python wrapper - preConfigure = '' - rm hepmc/hepmcwrap.py - swig -c++ -I${pkgs.hepmc}/include -python hepmc/hepmcwrap.i - ''; - - buildInputs = with pkgs; [ swig hepmc ]; - - HEPMCPATH = pkgs.hepmc; - - meta = { - description = "A simple wrapper on the main classes of the HepMC event simulation representation, making it possible to create, read and manipulate HepMC events from Python code"; - license = licenses.gpl2; - maintainers = with maintainers; [ veprbl ]; - platforms = platforms.all; - }; - }; + pyhepmc = callPackage ../development/python-modules/pyhepmc { }; pytest = self.pytest_37;