1{ stdenv
2, buildPythonPackage
3, fetchPypi
4, fetchFromBitbucket
5, isPy3k
6, fetchurl
7, pkgs
8, python
9}:
10
11buildPythonPackage rec {
12 pname = "pyhepmc";
13 version = "1.0.1";
14 disabled = isPy3k;
15
16 src = fetchPypi {
17 inherit pname version;
18 sha256 = "1210fd7e20d4abc1d9166147a9f7645a2a58b655fe030ad54ab3ea0d0c6e0834";
19 };
20
21 srcMissing = fetchFromBitbucket {
22 owner = "andybuckley";
23 repo = "pyhepmc";
24 rev = "pyhepmc-1.0.0";
25 sha256 = "0vxad143pz45q94w5p0dycpk24insdsv1m5k867y56xy24bi0d4w";
26 };
27
28 prePatch = ''
29 cp -r $srcMissing/hepmc .
30 chmod +w hepmc
31 '';
32
33 patches = [
34 # merge PR https://bitbucket.org/andybuckley/pyhepmc/pull-requests/1/add-incoming-outgoing-generators-for/diff
35 ./pyhepmc_export_edges.patch
36 # add bindings to Flow class
37 ./pyhepmc_export_flow.patch
38 ];
39
40 # regenerate python wrapper
41 preConfigure = ''
42 swig -c++ -I${pkgs.hepmc}/include -python hepmc/hepmcwrap.i
43 '';
44
45 nativeBuildInputs = [ pkgs.swig ];
46 buildInputs = [ pkgs.hepmc ];
47
48 HEPMCPATH = pkgs.hepmc;
49
50 checkPhase = ''
51 ${python.interpreter} test/test1.py
52 '';
53
54 meta = with stdenv.lib; {
55 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";
56 license = licenses.gpl2;
57 maintainers = with maintainers; [ veprbl ];
58 };
59
60}