summary refs log tree commit diff
path: root/pkgs/development/python-modules/distutils-cfg/default.nix
blob: 204f4de5456a73a96ce25103c27c8d7f8dccd67e (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
# global distutils configuration, see http://docs.python.org/2/install/index.html#distutils-configuration-files

{ stdenv, python, writeText, extraCfg ? "", overrideCfg ? "" }:


let
  distutilsCfg = writeText "distutils.cfg" (
  if overrideCfg != "" then overrideCfg else ''
    [easy_install]

    # don't allow network connections during build to ensure purity
    allow-hosts = None

    # make sure we always unzip installed packages otherwise setup hooks won't work
    zip_ok = 0

    ${extraCfg}
  '');
in stdenv.mkDerivation {
  name = "${python.libPrefix}-distutils.cfg";

  buildInputs = [ python ];

  unpackPhase = "true";

  installPhase = ''
    dest="$out/lib/${python.libPrefix}/site-packages/distutils"
    mkdir -p $dest
    ln -s ${python}/lib/${python.libPrefix}/distutils/* $dest
    ln -s ${distutilsCfg} $dest/distutils.cfg
  '';
}