forked from mdtraj/mdtraj
-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.nix
123 lines (112 loc) · 2.27 KB
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
{ lib
, buildPythonPackage
, fetchPypi
, setuptools
, cython
, numpy
, zlib
, pyparsing
, astunparse
, scipy
, networkx
, matplotlib
, scikitlearn
, pandas
, tables
, psutil
, gsd
, numpydoc
, nbformat
, nbconvert
, sphinx_rtd_theme
, sphinx
, pytestCheckHook
, buildDocs
, enableNativeVectorIntrinsics ? true
}:
let
msmb-theme = buildPythonPackage rec {
pname = "msmb_theme";
version = "1.2.0";
src = fetchPypi {
inherit pname version;
sha256 = "0b77yjk5q8kdp7bdlqlwi33hjirzp7bbblpqi4a2gy1an3ijzp4v";
};
propagatedBuildInputs = [
numpydoc
sphinx
sphinx_rtd_theme
];
# no tests
doCheck = false;
};
filterSrcByPrefix = src: prefixList:
lib.cleanSourceWith {
filter = (path: type:
let relPath = lib.removePrefix (toString ./. + "/") (toString path);
in lib.any (prefix: lib.hasPrefix prefix relPath) prefixList);
inherit src;
};
in
buildPythonPackage {
pname = "mdtraj";
version = "1.9.8.dev0";
src = filterSrcByPrefix ./. [
"docs"
"examples"
"mdtraj"
"tests"
"pytest.ini"
"setup.py"
"basesetup.py"
];
preBuild = lib.optionalString (!enableNativeVectorIntrinsics) ''
export MDTRAJ_BUILD_DISABLE_INTRINSICS=1
'';
buildInputs = [
setuptools
cython
numpy
zlib
];
propagatedBuildInputs = [
pyparsing
astunparse
scipy
networkx
];
checkInputs = [
pytestCheckHook
matplotlib
scikitlearn
pandas
tables
psutil
gsd
] ++ lib.optionals buildDocs [
# for docs
nbformat
nbconvert
sphinx
msmb-theme
];
disabledTests = [
# These tests require network access
"test_pdb_from_url"
"test_1vii_url_and_gz"
];
# 1. Ensure mdconvert is on the PATH and don't let us import from the src directory
# 2. If compiling without native intrisics, which is a rare configuration mostly for ppc64le,
# don't run some tests that are slow.
preCheck = ''
export PATH=$out/bin:$PATH
rm -rf mdtraj/
if [ "$MDTRAJ_BUILD_DISABLE_INTRINSICS" = "1" ]; then
rm tests/test_mdconvert.py tests/test_trajectory.py
fi
'';
postInstall = lib.optionalString buildDocs ''
mkdir -p $out/share/docs/root
(cd docs && make html && cp -r _build/html $out/share/docs)
'';
}