Author: chaoflow
Date: Sun Feb 26 17:23:09 2012
New Revision: 32583
URL: https://nixos.org/websvn/nix/?rev=32583&sc=1
Log:
prevent distutils during module install from downloading and load pth files
based on a patch by Cillian de RĂ³iste
Added:
nixpkgs/branches/stdenv-updates/pkgs/development/python-modules/offline-distutils/
nixpkgs/branches/stdenv-updates/pkgs/development/python-modules/offline-distutils/default.nix
Modified:
nixpkgs/branches/stdenv-updates/pkgs/development/python-modules/generic/default.nix
nixpkgs/branches/stdenv-updates/pkgs/top-level/python-packages.nix
Modified:
nixpkgs/branches/stdenv-updates/pkgs/development/python-modules/generic/default.nix
==============================================================================
---
nixpkgs/branches/stdenv-updates/pkgs/development/python-modules/generic/default.nix
Sun Feb 26 17:23:05 2012 (r32582)
+++
nixpkgs/branches/stdenv-updates/pkgs/development/python-modules/generic/default.nix
Sun Feb 26 17:23:09 2012 (r32583)
@@ -3,7 +3,7 @@
(http://pypi.python.org/pypi/setuptools/), which represents a large
number of Python packages nowadays. */
-{ python, setuptools, wrapPython, lib, site }:
+{ python, setuptools, wrapPython, lib, site, offlineDistutils }:
{ name, namePrefix ? "python-"
@@ -69,6 +69,15 @@
buildInputs = [ python wrapPython setuptools ] ++ buildInputs ++ pythonPath;
+ configurePhase = ''
+ # 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"
+ '';
+
# XXX: I think setuptools is not needed here
pythonPath = [ setuptools site ] ++ pythonPath;
Added:
nixpkgs/branches/stdenv-updates/pkgs/development/python-modules/offline-distutils/default.nix
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++
nixpkgs/branches/stdenv-updates/pkgs/development/python-modules/offline-distutils/default.nix
Sun Feb 26 17:23:09 2012 (r32583)
@@ -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
+ '';
+}
Modified: nixpkgs/branches/stdenv-updates/pkgs/top-level/python-packages.nix
==============================================================================
--- nixpkgs/branches/stdenv-updates/pkgs/top-level/python-packages.nix Sun Feb
26 17:23:05 2012 (r32582)
+++ nixpkgs/branches/stdenv-updates/pkgs/top-level/python-packages.nix Sun Feb
26 17:23:09 2012 (r32583)
@@ -9,7 +9,7 @@
buildPythonPackage = import ../development/python-modules/generic {
inherit (pkgs) lib;
- inherit python wrapPython setuptools site;
+ inherit python wrapPython setuptools site offlineDistutils;
};
@@ -24,6 +24,10 @@
inherit python;
};
+ offlineDistutils = import ../development/python-modules/offline-distutils {
+ inherit (pkgs) stdenv;
+ inherit python;
+ };
ipython = import ../shells/ipython {
inherit (pkgs) stdenv fetchurl;
_______________________________________________
nix-commits mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-commits