blob: fd4c0d9c6038e7cdaef18e008e809ccb39dbd4a8 (
plain) (
blame)
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
|
{ stdenv, python, sqlite, tcl, tk, x11, openssl, readline }:
with stdenv.lib;
let
buildInternalPythonModule =
{ moduleName
, internalName ? "_" + moduleName
, deps
}:
stdenv.mkDerivation rec {
name = "python-${moduleName}-${python.version}";
src = python.src;
patches = python.patches;
buildInputs = [ python ] ++ deps;
C_INCLUDE_PATH = concatStringsSep ":" (map (p: "${p}/include") buildInputs);
LIBRARY_PATH = concatStringsSep ":" (map (p: "${p}/lib") buildInputs);
configurePhase = "true";
buildPhase =
''
# Fake the build environment that setup.py expects.
ln -s ${python}/include/python*/pyconfig.h .
ln -s ${python}/lib/python*/config/Setup Modules/
ln -s ${python}/lib/python*/config/Setup.local Modules/
substituteInPlace setup.py --replace 'self.extensions = extensions' \
'self.extensions = [ext for ext in self.extensions if ext.name in ["${internalName}"]]'
python ./setup.py build_ext
'';
installPhase =
''
dest=$out/lib/${python.libPrefix}/site-packages
mkdir -p $dest
cp -p $(find . -name "*.so") $dest/
'';
};
in {
sqlite3 = buildInternalPythonModule {
moduleName = "sqlite3";
deps = [ sqlite ];
};
tkinter = buildInternalPythonModule {
moduleName = "tkinter";
deps = [ tcl tk x11 ];
};
ssl = buildInternalPythonModule {
moduleName = "ssl";
deps = [ openssl ];
};
readline = buildInternalPythonModule {
moduleName = "readline";
internalName = "readline";
deps = [ readline ];
};
}
|