1{ stdenv
2, buildPythonPackage
3, pythonOlder
4, isPy27
5, fetchFromGitHub
6, nose
7, noise
8, numpy
9, pyplatec
10, protobuf
11, purepng
12, h5py
13, gdal
14}:
15
16buildPythonPackage rec {
17 pname = "worldengine";
18 version = "0.19.0";
19
20 src = fetchFromGitHub {
21 owner = "Mindwerks";
22 repo = "worldengine";
23 rev = "v${version}";
24 sha256 = "1xrckb0dn2841gvp32n18gib14bpi77hmjw3r9jiyhg402iip7ry";
25 };
26
27 src-data = fetchFromGitHub {
28 owner = "Mindwerks";
29 repo = "worldengine-data";
30 rev = "029051e";
31 sha256 = "06xbf8gj3ljgr11v1n8jbs2q8pdf9wz53xdgkhpm8hdnjahgdxdm";
32 };
33
34 postUnpack = ''
35 ln -s ${src-data} worldengine-data
36 '';
37
38 propagatedBuildInputs = [ noise numpy pyplatec protobuf purepng h5py gdal ];
39
40 prePatch = ''
41 substituteInPlace setup.py \
42 --replace pypng>=0.0.18 purepng \
43 --replace 'numpy>=1.9.2, <= 1.10.0.post2' 'numpy' \
44 --replace 'argparse==1.2.1' "" \
45 --replace 'protobuf==3.0.0a3' 'protobuf' \
46 --replace 'noise==1.2.2' 'noise' \
47 --replace 'PyPlatec==1.4.0' 'PyPlatec' \
48 '';
49
50 # with python<3.5, unittest fails to discover tests because of their filenames
51 # so nose is used instead.
52 doCheck = !isPy27; # google namespace clash
53 checkInputs = stdenv.lib.optional (pythonOlder "3.5") [ nose ];
54 postCheck = stdenv.lib.optionalString (pythonOlder "3.5") ''
55 nosetests tests
56 '';
57
58 meta = with stdenv.lib; {
59 homepage = "http://world-engine.org";
60 description = "World generator using simulation of plates, rain shadow, erosion, etc";
61 license = licenses.mit;
62 maintainers = with maintainers; [ rardiol ];
63 };
64
65}