diff options
-rw-r--r-- | pkgs/development/python-modules/generic/builder.sh | 10 | ||||
-rw-r--r-- | pkgs/development/python-modules/generic/default.nix | 4 | ||||
-rw-r--r-- | pkgs/development/python-modules/offline-distutils/default.nix | 21 | ||||
-rw-r--r-- | pkgs/top-level/python-packages.nix | 6 |
4 files changed, 39 insertions, 2 deletions
diff --git a/pkgs/development/python-modules/generic/builder.sh b/pkgs/development/python-modules/generic/builder.sh new file mode 100644 index 00000000000..52b66aaf6a6 --- /dev/null +++ b/pkgs/development/python-modules/generic/builder.sh @@ -0,0 +1,10 @@ +source $stdenv/setup + +# do not allow distutils to make downloads, whatever install command is used +export PYTHONPATH="${setuptools}/lib/${python.libPrefix}:$PYTHONPATH" +export PYTHONPATH="${offlineDistutils}/lib/${python.libPrefix}:$PYTHONPATH" + +# enable pth files for dependencies +export PYTHONPATH="${site}/lib/${python.libPrefix}/site-packages:$PYTHONPATH" + +genericBuild diff --git a/pkgs/development/python-modules/generic/default.nix b/pkgs/development/python-modules/generic/default.nix index 865f7ca9be1..8502e91b650 100644 --- a/pkgs/development/python-modules/generic/default.nix +++ b/pkgs/development/python-modules/generic/default.nix @@ -3,7 +3,7 @@ (http://pypi.python.org/pypi/setuptools/), which represents a large number of Python packages nowadays. */ -{ python, setuptools, wrapPython, lib }: +{ python, setuptools, wrapPython, lib, offlineDistutils }: { name, namePrefix ? "python-" @@ -47,6 +47,8 @@ python.stdenv.mkDerivation (attrs // { buildInputStrings = map toString buildInputs; + builder = ./builder.sh + pythonPath = [ setuptools] ++ pythonPath; installPhase = '' diff --git a/pkgs/development/python-modules/offline-distutils/default.nix b/pkgs/development/python-modules/offline-distutils/default.nix new file mode 100644 index 00000000000..2ed41b08bb7 --- /dev/null +++ b/pkgs/development/python-modules/offline-distutils/default.nix @@ -0,0 +1,21 @@ +# Used during module installation to prevent easy_install and python +# setup.py install/test from downloading + +{ stdenv, python }: + +stdenv.mkDerivation { + name = "python-offline-distutils-${python.version}"; + + buildInputs = [ python ]; + + unpackPhase = "true"; + installPhase = '' + dst="$out/lib/${python.libPrefix}" + ensureDir $dst/distutils + ln -s ${python}/lib/${python.libPrefix}/distutils/* $dst/distutils/ + cat <<EOF > $dst/distutils/distutils.cfg +[easy_install] +allow-hosts = None +EOF + ''; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index db5643427f8..32f050fec12 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -9,7 +9,7 @@ let pythonPackages = python.modules // rec { buildPythonPackage = import ../development/python-modules/generic { inherit (pkgs) lib; - inherit python wrapPython setuptools; + inherit python wrapPython setuptools offlineDistutils; }; @@ -24,6 +24,10 @@ let pythonPackages = python.modules // rec { inherit python wrapPython; }; + offlineDistutils = import ../development/python-modules/offline-distutils { + inherit (pkgs) stdenv; + inherit python; + }; ipython = import ../shells/ipython { inherit (pkgs) stdenv fetchurl; |