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