From 11b67ccee5a2f3c1b12430c7e1f892ac6bccd1c1 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 29 Mar 2011 15:02:15 +0000 Subject: [PATCH] * Move buildPythonPackage and setuptools into python-packages.nix. This ensures that they're built with the same "python" argument. svn path=/nixpkgs/branches/modular-python/; revision=26593 --- .../python-modules/setuptools/default.nix | 49 ++++++------------- pkgs/top-level/all-packages.nix | 13 +---- pkgs/top-level/python-packages.nix | 17 ++++++- 3 files changed, 33 insertions(+), 46 deletions(-) diff --git a/pkgs/development/python-modules/setuptools/default.nix b/pkgs/development/python-modules/setuptools/default.nix index 1cdbb2e26245..50b73aaf8f60 100644 --- a/pkgs/development/python-modules/setuptools/default.nix +++ b/pkgs/development/python-modules/setuptools/default.nix @@ -1,48 +1,29 @@ -a : -let - fetchurl = a.fetchurl; +{ stdenv, fetchurl, python, wrapPython }: - version = a.lib.attrByPath ["version"] "0.6c11" a; - buildInputs = with a; [ - python makeWrapper - ]; -in -rec { - name = "setuptools-" + version; +stdenv.mkDerivation rec { + name = "setuptools-0.6c11"; src = fetchurl { url = "http://pypi.python.org/packages/source/s/setuptools/${name}.tar.gz"; sha256 = "1lx1hwxkhipyh206bgl90ddnfcnb68bzcvyawczbf833fadyl3v3"; }; - inherit buildInputs; - configureFlags = []; + buildInputs = [ python wrapPython ]; - doCheck = true; + buildPhase = "python setup.py build --build-base $out"; - doMakeCheck = a.fullDepEntry ('' - python setup.py test - '') ["minInit" "doUnpack" "addInputs" "doBuild"]; + installPhase = + '' + dst=$out/lib/${python.libPrefix}/site-packages + mkdir -p $dst + PYTHONPATH=$dst:$PYTHONPATH + python setup.py install --prefix=$out + wrapPythonPrograms + ''; - doBuild = a.fullDepEntry('' - python setup.py build --build-base $out - '') ["addInputs" "doUnpack"]; + doCheck = false; # doesn't work with Python 2.7 - doInstall = a.fullDepEntry('' - ensureDir "$out/lib/${a.python.libPrefix}/site-packages" - - PYTHONPATH="$out/lib/${a.python.libPrefix}/site-packages:$PYTHONPATH" \ - python setup.py install --prefix="$out" - - for i in "$out/bin/"* - do - wrapProgram "$i" \ - --prefix PYTHONPATH ":" \ - "$out/lib/${a.python.libPrefix}/site-packages" - done - '') ["doBuild"]; - - phaseNames = ["doBuild" "doInstall"]; + checkPhase = "python setup.py test"; meta = { description = "Utilities to facilitate the installation of Python packages"; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 4cdd80835569..b0d77d6e066d 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -4299,20 +4299,13 @@ let ### DEVELOPMENT / PYTHON MODULES - buildPythonPackage = buildPython27Package; - - buildPython27Package = import ../development/python-modules/generic { - inherit wrapPython lib; - python = python27; - setuptools = setuptools.override { python = python27; doCheck = false; }; - }; + buildPythonPackage = pythonPackages.buildPythonPackage; pythonPackages = python27Packages; python27Packages = recurseIntoAttrs (import ./python-packages.nix { inherit pkgs; python = python27; - buildPythonPackage = buildPython27Package; }); foursuite = callPackage ../development/python-modules/4suite { }; @@ -4355,9 +4348,7 @@ let pyxml = callPackage ../development/python-modules/pyxml { }; - setuptools = builderDefsPackage (import ../development/python-modules/setuptools) { - inherit python makeWrapper; - }; + setuptools = pythonPackages.setuptools; wxPython = wxPython26; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index f49beee5f183..dcbe03e615c4 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1,11 +1,26 @@ -{ pkgs, python, buildPythonPackage }: +{ pkgs, python }: python.modules // rec { + inherit python; + inherit (pkgs) fetchurl fetchsvn stdenv; inherit (python.modules) ssl; + + + buildPythonPackage = import ../development/python-modules/generic { + inherit (pkgs) wrapPython lib; + inherit python setuptools; + }; + + setuptools = import ../development/python-modules/setuptools { + inherit (pkgs) stdenv fetchurl wrapPython; + inherit python; + }; + + argparse = buildPythonPackage (rec { name = "argparse-1.1";