1# global distutils configuration, see http://docs.python.org/2/install/index.html#distutils-configuration-files
2
3{
4 stdenv,
5 python,
6 writeText,
7 extraCfg ? "",
8 overrideCfg ? "",
9}:
10
11let
12 distutilsCfg = writeText "distutils.cfg" (
13 if overrideCfg != "" then
14 overrideCfg
15 else
16 ''
17 [easy_install]
18
19 # don't allow network connections during build to ensure purity
20 allow-hosts = None
21
22 # make sure we always unzip installed packages otherwise setup hooks won't work
23 zip_ok = 0
24
25 ${extraCfg}
26 ''
27 );
28in
29stdenv.mkDerivation {
30 name = "${python.libPrefix}-distutils.cfg";
31
32 buildInputs = [ python ];
33
34 dontUnpack = true;
35
36 installPhase = ''
37 dest="$out/${python.sitePackages}/distutils"
38 mkdir -p $dest
39 ln -s ${python}/lib/${python.libPrefix}/distutils/* $dest
40 ln -s ${distutilsCfg} $dest/distutils.cfg
41 '';
42}