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