From 6cbc1d554f7a724fcb8b8e98c6c8e41f86a640c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Fri, 3 Jan 2014 18:05:35 +0100 Subject: [PATCH 01/16] remove unused setuptools/site.nix --- .../python-modules/setuptools/site.nix | 16 ---------------- pkgs/top-level/python-packages.nix | 5 ----- 2 files changed, 21 deletions(-) delete mode 100644 pkgs/development/python-modules/setuptools/site.nix diff --git a/pkgs/development/python-modules/setuptools/site.nix b/pkgs/development/python-modules/setuptools/site.nix deleted file mode 100644 index 34e7b478595..00000000000 --- a/pkgs/development/python-modules/setuptools/site.nix +++ /dev/null @@ -1,16 +0,0 @@ -# Propagated by buildPythonPackge to process pth files - -{ stdenv, python, setuptools }: - -stdenv.mkDerivation { - name = "python-setuptools-site-${setuptools.version}"; - - buildInputs = [ python setuptools ]; - - unpackPhase = "true"; - installPhase = '' - dst="$out/lib/${python.libPrefix}/site-packages" - ensureDir $dst - ln -s ${setuptools}/lib/${python.libPrefix}/site-packages/site.* $dst/ - ''; -} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 2958120f907..fe80ab70e36 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -48,11 +48,6 @@ pythonPackages = modules // import ./python-packages-generated.nix { inherit python wrapPython; }; - setuptoolsSite = import ../development/python-modules/setuptools/site.nix { - inherit (pkgs) stdenv; - inherit python setuptools; - }; - # packages defined elsewhere blivet = callPackage ../development/python-modules/blivet { }; From 29b7f2e1824ad42e8a71df6f45d82290df463b72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Fri, 3 Jan 2014 18:06:04 +0100 Subject: [PATCH 02/16] setuptools: remove obsolete patch --- ...kip-sdist_with_utf8_encoded_filename.patch | 28 ------------------- 1 file changed, 28 deletions(-) delete mode 100644 pkgs/development/python-modules/setuptools/distribute-skip-sdist_with_utf8_encoded_filename.patch diff --git a/pkgs/development/python-modules/setuptools/distribute-skip-sdist_with_utf8_encoded_filename.patch b/pkgs/development/python-modules/setuptools/distribute-skip-sdist_with_utf8_encoded_filename.patch deleted file mode 100644 index 96a4f81ee58..00000000000 --- a/pkgs/development/python-modules/setuptools/distribute-skip-sdist_with_utf8_encoded_filename.patch +++ /dev/null @@ -1,28 +0,0 @@ -diff -r f5ac515f062a setuptools/tests/test_sdist.py ---- a/setuptools/tests/test_sdist.py Fri Jul 26 09:52:26 2013 +0200 -+++ b/setuptools/tests/test_sdist.py Sat Jul 27 20:22:17 2013 +0200 -@@ -3,12 +3,14 @@ - - - import os -+import locale - import shutil - import sys - import tempfile - import unittest - import unicodedata - -+from setuptools.tests.py26compat import skipIf - from setuptools.compat import StringIO, unicode - from setuptools.command.sdist import sdist - from setuptools.command.egg_info import manifest_maker -@@ -318,6 +320,9 @@ - filename = filename.decode('latin-1') - self.assertFalse(filename in cmd.filelist.files) - -+ -+ @skipIf(sys.version_info >= (3,) and locale.getpreferredencoding() != 'UTF-8', -+ 'Unittest fails if locale is not utf-8 but the manifests is recorded correctly') - def test_sdist_with_utf8_encoded_filename(self): - # Test for #303. - dist = Distribution(SETUP_ATTRS) From e9923c649955dfdadeb016482049a8747e5fc454 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Mon, 6 Jan 2014 22:21:15 +0000 Subject: [PATCH 03/16] pythonPackages: update a bunch of them --- pkgs/top-level/python-packages.nix | 38 +++++++++++++++--------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index fe80ab70e36..3aff5627732 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1236,11 +1236,11 @@ pythonPackages = modules // import ./python-packages-generated.nix { }; pytest = buildPythonPackage rec { - name = "pytest-2.3.5"; + name = "pytest-2.5.1"; src = fetchurl { url = "http://pypi.python.org/packages/source/p/pytest/${name}.tar.gz"; - md5 = "18f150e7be96b5fe3c388b0e817b8087"; + md5 = "4e155a0134e6757b37cc6698c20f3e9f"; }; propagatedBuildInputs = [ pythonPackages.py ] @@ -1250,7 +1250,7 @@ pythonPackages = modules // import ./python-packages-generated.nix { meta = with stdenv.lib; { maintainers = with maintainers; [ iElectric lovek323 ]; - platforms = platforms.unix; + platforms = platforms.unix; }; }; @@ -2471,11 +2471,11 @@ pythonPackages = modules // import ./python-packages-generated.nix { dulwich = buildPythonPackage rec { - name = "dulwich-0.8.1"; + name = "dulwich-0.8.7"; src = fetchurl { url = "http://samba.org/~jelmer/dulwich/${name}.tar.gz"; - sha256 = "1a1619e9c7e63fe9bdc93356ee893be1016b7ea12ad953f4e1f1f5c0c5056ee8"; + sha256 = "041qp5v2x8fbwkmws6hwwiny74lavkz723dj8gwbm40b2383d8vv"; }; buildPhase = "make build"; @@ -4613,11 +4613,11 @@ pythonPackages = modules // import ./python-packages-generated.nix { }; pip = buildPythonPackage rec { - version = "1.4.1"; + version = "1.5"; name = "pip-${version}"; src = fetchurl { url = "http://pypi.python.org/packages/source/p/pip/pip-${version}.tar.gz"; - sha256 = "0knhj3c1nqqzxgqin8l0gzy6nzsbcxinyr0cbp1j99hi8xahcyjf"; + sha256 = "0j700f70mj0brdlvs2cz4a7h4jwmzgymgp8qk1qb3lsm1qd1vy15"; }; buildInputs = [ mock scripttest virtualenv nose ]; # ValueError: Working directory tests not found, or not a directory @@ -4639,11 +4639,11 @@ pythonPackages = modules // import ./python-packages-generated.nix { pillow = buildPythonPackage rec { - name = "Pillow-2.2.1"; + name = "Pillow-2.3.0"; src = fetchurl { url = "http://pypi.python.org/packages/source/P/Pillow/${name}.zip"; - md5 = "d1d20d3db5d1ab312da0951ff061e6bf"; + md5 = "56b6614499aacb7d6b5983c4914daea7"; }; buildInputs = [ pkgs.freetype pkgs.libjpeg pkgs.unzip pkgs.zlib pkgs.libtiff pkgs.libwebp ]; @@ -5748,11 +5748,11 @@ pythonPackages = modules // import ./python-packages-generated.nix { pyyaml = buildPythonPackage (rec { - name = "PyYAML-3.09"; + name = "PyYAML-3.10"; src = fetchurl { - url = "http://pyyaml.org/download/pyyaml/PyYAML-3.09.zip"; - sha256 = "204aca8b42dbe90e460794d743dd16182011da85507bfd4f092f9f76e0688040"; + url = "http://pyyaml.org/download/pyyaml/${name}.zip"; + sha256 = "1r127fa354ppb667f4acxlzwxixap1jgzjrr790bw8mcpxv2hqaa"; }; buildInputs = [ pkgs.unzip pkgs.pyrex ]; @@ -6195,15 +6195,15 @@ pythonPackages = modules // import ./python-packages-generated.nix { scripttest = buildPythonPackage rec { - version = "1.1.1"; + version = "1.3"; name = "scripttest-${version}"; src = fetchurl { - url = "http://pypi.python.org/packages/source/S/ScriptTest/ScriptTest-${version}.tar.gz"; - md5 = "592ce890764c3f546d35b4d7c40c32ef"; + url = "http://pypi.python.org/packages/source/s/scripttest/scripttest-${version}.tar.gz"; + md5 = "1d1c5117ccfc7b5961cae6c1020c0848"; }; - buildInputs = [ nose ]; + buildInputs = [ nose pytest ]; meta = { description = "A library for testing interactive command-line applications"; @@ -6317,7 +6317,7 @@ pythonPackages = modules // import ./python-packages-generated.nix { md5 = "93c93725674c0702583a638f5a09c9e4"; }; - propagatedBuildInputs = [ jinja2 markdown pillow pilkit clint argh ]; + propagatedBuildInputs = [ jinja2 markdown pillow pilkit clint argh pytest ]; meta = with stdenv.lib; { description = "Yet another simple static gallery generator"; @@ -7201,10 +7201,10 @@ pythonPackages = modules // import ./python-packages-generated.nix { }); virtualenv = buildPythonPackage rec { - name = "virtualenv-1.10"; + name = "virtualenv-1.11"; src = fetchurl { url = "http://pypi.python.org/packages/source/v/virtualenv/${name}.tar.gz"; - md5 = "9745c28256c70c76d36adb3767a00212"; + md5 = "d1a7cf95b539a861a8215827f387c4eb"; }; inherit recursivePthLoader; From bf5d6fb9b1c12a919853f15571b5a012f87fd928 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Mon, 6 Jan 2014 22:24:05 +0000 Subject: [PATCH 04/16] Refactor buildPythonPackage to modularize building process. Before we used `easy_install` command to handle installation in one shot, now this is split into two phases: - buildPhase: python setup.py build - installPhase: python setup.py install Each of those commands have the ability to pass extra parameters through buildPythonPackage parameters as `setupPyInstallFlags` and `setupPyBuildFlags`. Phases now correctly execute post/pre hooks. In configurePhase we inject setuptools dependency before distutils is imported to apply monkeypatching by setuptools that is needed for special features to apply. We don't have to reorder default phases anymore, as test phase comes after build and that works. I rewrote offineDistutils into distutils-cfg with a bit cleaner syntax and ability to specify extraCfg to the config file. Plone packages are failing and garbas said he will adopt them to the new functions. The rest of the packages I fixed and these commits shouldn't break any package (according to my testings) and they introduce 16 new jobs and fix 38 that were broken before. --- .../python-modules/distutils-cfg/default.nix | 31 +++++ .../python-modules/generic/default.nix | 121 ++++++++++-------- .../offline-distutils/default.nix | 21 --- pkgs/top-level/python-packages.nix | 13 +- 4 files changed, 106 insertions(+), 80 deletions(-) create mode 100644 pkgs/development/python-modules/distutils-cfg/default.nix delete mode 100644 pkgs/development/python-modules/offline-distutils/default.nix diff --git a/pkgs/development/python-modules/distutils-cfg/default.nix b/pkgs/development/python-modules/distutils-cfg/default.nix new file mode 100644 index 00000000000..7b0f3628698 --- /dev/null +++ b/pkgs/development/python-modules/distutils-cfg/default.nix @@ -0,0 +1,31 @@ +# global distutils configuration, see http://docs.python.org/2/install/index.html#distutils-configuration-files + +{ stdenv, python, writeText, extraCfg ? "" }: + + +let + distutilsCfg = writeText "distutils.cfg" '' + [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 = "distutils.cfg-python${python.version}"; + + 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 + ''; +} diff --git a/pkgs/development/python-modules/generic/default.nix b/pkgs/development/python-modules/generic/default.nix index 6a7d5e5f3d5..51af437265d 100644 --- a/pkgs/development/python-modules/generic/default.nix +++ b/pkgs/development/python-modules/generic/default.nix @@ -1,84 +1,95 @@ /* This function provides a generic Python package builder. It is - intended to work with packages that use `setuptools' + intended to work with packages that use `distutils/setuptools' (http://pypi.python.org/pypi/setuptools/), which represents a large number of Python packages nowadays. */ -{ python, setuptools, wrapPython, lib, offlineDistutils, recursivePthLoader }: +{ python, setuptools, wrapPython, lib, recursivePthLoader, distutils-cfg }: -{ name, namePrefix ? python.libPrefix + "-" +{ name + +# by default prefix name with python version name, e.g. "python3.3-" +, namePrefix ? python.libPrefix + "-" , buildInputs ? [] +# TODO: document +, distutilsExtraCfg ? "" + +# TODO: say what it does , propagatedBuildInputs ? [] -, # List of packages that should be added to the PYTHONPATH - # environment variable in programs built by this function. Packages - # in the standard `propagatedBuildInputs' variable are also added. - # The difference is that `pythonPath' is not propagated to the user - # environment. This is preferrable for programs because it doesn't - # pollute the user environment. - pythonPath ? [] +# passed to "python setup.py install" +, setupPyInstallFlags ? [] -, installCommand ? - '' - easy_install --always-unzip --prefix="$out" . - '' - -, preConfigure ? "true" - -, buildPhase ? "true" +# passed to "python setup.py build" +, setupPyBuildFlags ? [] +# enable tests by default , doCheck ? true -, checkPhase ? - '' - runHook preCheck - ${python}/bin/${python.executable} setup.py test - runHook postCheck - '' +# List of packages that should be added to the PYTHONPATH +# environment variable in programs built by this function. Packages +# in the standard `propagatedBuildInputs' variable are also added. +# The difference is that `pythonPath' is not propagated to the user +# environment. This is preferrable for programs because it doesn't +# pollute the user environment. +, pythonPath ? [] -, preInstall ? "" -, postInstall ? "" - -, meta ? {} +, meta ? {} , ... } @ attrs: -# Keep extra attributes from ATTR, e.g., `patchPhase', etc. +# Keep extra attributes from `attrs`, e.g., `patchPhase', etc. python.stdenv.mkDerivation (attrs // { - inherit doCheck buildPhase checkPhase; + inherit doCheck; name = namePrefix + name; - # default to python's platforms and add maintainer(s) to every - # package - meta = { - platforms = python.meta.platforms; - } // meta // { - maintainers = (meta.maintainers or []) ++ [ lib.maintainers.chaoflow lib.maintainers.iElectric ]; - }; - - # checkPhase after installPhase to run tests on installed packages - phases = "unpackPhase patchPhase configurePhase buildPhase installPhase checkPhase fixupPhase distPhase"; - - buildInputs = [ python wrapPython setuptools ] ++ buildInputs ++ pythonPath; + buildInputs = [ python wrapPython setuptools (distutils-cfg.override { extraCfg = distutilsExtraCfg; }) ] ++ buildInputs ++ pythonPath; propagatedBuildInputs = propagatedBuildInputs ++ [ recursivePthLoader ]; pythonPath = [ setuptools ] ++ pythonPath; - preConfigure = '' + configurePhase = attrs.configurePhase or '' + runHook preConfigure + + # TODO: document export DETERMINISTIC_BUILD=1 - PYTHONPATH="${offlineDistutils}/lib/${python.libPrefix}/site-packages:$PYTHONPATH" - ${preConfigure} + + # we need to prepend following line to monkeypatch distutils commands + sed -i '0,/import distutils/s//import setuptools;import distutils/' setup.py + sed -i '0,/from distutils/s//import setuptools;from distutils/' setup.py + + + runHook postConfigure ''; - installPhase = preInstall + '' + checkPhase = attrs.checkPhase or '' + runHook preCheck + + ${python}/bin/${python.executable} setup.py test -q + + runHook postCheck + ''; + + buildPhase = attrs.buildPhase or '' + runHook preBuild + + ${python}/bin/${python.executable} setup.py build ${lib.concatStringsSep " " setupPyBuildFlags} + + runHook postBuild + ''; + + installPhase = attrs.installPhase or '' + runHook preInstall + mkdir -p "$out/lib/${python.libPrefix}/site-packages" - echo "installing \`${name}' with \`easy_install'..." export PYTHONPATH="$out/lib/${python.libPrefix}/site-packages:$PYTHONPATH" - ${installCommand} + + ${python}/bin/${python.executable} setup.py install --install-lib=$out/lib/${python.libPrefix}/site-packages \ + --prefix="$out" ${lib.concatStringsSep " " setupPyInstallFlags} # A pth file might have been generated to load the package from # within its own site-packages, rename this package not to @@ -94,17 +105,18 @@ python.stdenv.mkDerivation (attrs // { # corresponding site.py needs to be included in the PYTHONPATH. rm -f "$out/lib/${python.libPrefix}"/site-packages/site.py* - ${postInstall} + runHook postInstall ''; postFixup = '' wrapPythonPrograms - # If a user installs a Python package, she probably also wants its + # If a user installs a Python package, they probably also wants its # dependencies in the user environment (since Python modules don't # have something like an RPATH, so the only way to find the # dependencies is to have them in the PYTHONPATH variable). + # TODO: better docs if test -e $out/nix-support/propagated-build-inputs; then ln -s $out/nix-support/propagated-build-inputs $out/nix-support/propagated-user-env-packages fi @@ -116,4 +128,13 @@ python.stdenv.mkDerivation (attrs // { fi done ''; + + meta = { + # default to python's platforms + platforms = python.meta.platforms; + } // meta // { + # add extra maintainer(s) to every package + maintainers = (meta.maintainers or []) ++ [ lib.maintainers.chaoflow lib.maintainers.iElectric ]; + }; + }) diff --git a/pkgs/development/python-modules/offline-distutils/default.nix b/pkgs/development/python-modules/offline-distutils/default.nix deleted file mode 100644 index 269f67bf5cd..00000000000 --- a/pkgs/development/python-modules/offline-distutils/default.nix +++ /dev/null @@ -1,21 +0,0 @@ -# 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}/site-packages" - ensureDir $dst/distutils - ln -s ${python}/lib/${python.libPrefix}/distutils/* $dst/distutils/ - cat < $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 3aff5627732..0ccd5d5da26 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -20,10 +20,10 @@ pythonPackages = modules // import ./python-packages-generated.nix { callPackage = pkgs.lib.callPackageWith (pkgs // pythonPackages); - buildPythonPackage = import ../development/python-modules/generic { - inherit (pkgs) lib; - inherit python wrapPython setuptools recursivePthLoader offlineDistutils; - }; + # global distutils config used by buildPythonPackage + distutils-cfg = callPackage ../development/python-modules/distutils-cfg { }; + + buildPythonPackage = callPackage ../development/python-modules/generic { }; wrapPython = pkgs.makeSetupHook { deps = pkgs.makeWrapper; @@ -33,11 +33,6 @@ pythonPackages = modules // import ./python-packages-generated.nix { # specials - offlineDistutils = import ../development/python-modules/offline-distutils { - inherit (pkgs) stdenv; - inherit python; - }; - recursivePthLoader = import ../development/python-modules/recursive-pth-loader { inherit (pkgs) stdenv; inherit python; From 6adfd13dd4b28546e4ea0dfa4e28727b94c891e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Mon, 6 Jan 2014 22:34:01 +0000 Subject: [PATCH 05/16] adopt setuptools to new python infrastructure (also make sure we unzip setuptools while building) --- .../python-modules/setuptools/default.nix | 9 ++++-- .../setuptools/fix_python3_egg_fetcher.patch | 28 +++++++++++++++++++ 2 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 pkgs/development/python-modules/setuptools/fix_python3_egg_fetcher.patch diff --git a/pkgs/development/python-modules/setuptools/default.nix b/pkgs/development/python-modules/setuptools/default.nix index e0c3e7837b4..f585d758c2d 100644 --- a/pkgs/development/python-modules/setuptools/default.nix +++ b/pkgs/development/python-modules/setuptools/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, python, wrapPython }: +{ stdenv, fetchurl, python, wrapPython, distutils-cfg }: stdenv.mkDerivation rec { shortName = "setuptools-${version}"; @@ -11,9 +11,12 @@ stdenv.mkDerivation rec { sha256 = "09nv5x45y8fgc0kjmmw4gig3hr0is9xlc5rq053vnbmkxr5q5xmi"; }; - buildInputs = [ python wrapPython ]; + # see https://bitbucket.org/pypa/setuptools/commits/976b839801a3a181f2e14f305ddbe0b410fa8fc0.patch + patches = [ ./fix_python3_egg_fetcher.patch ]; - buildPhase = "${python}/bin/${python.executable} setup.py build --build-base $out"; + buildInputs = [ python wrapPython distutils-cfg ]; + + buildPhase = "${python}/bin/${python.executable} setup.py build"; installPhase = '' diff --git a/pkgs/development/python-modules/setuptools/fix_python3_egg_fetcher.patch b/pkgs/development/python-modules/setuptools/fix_python3_egg_fetcher.patch new file mode 100644 index 00000000000..17ab473a502 --- /dev/null +++ b/pkgs/development/python-modules/setuptools/fix_python3_egg_fetcher.patch @@ -0,0 +1,28 @@ +diff --git a/CHANGES.txt b/CHANGES.txt +--- a/CHANGES.txt ++++ b/CHANGES.txt +@@ -3,6 +3,12 @@ + ======= + + ----- ++2.0.3 ++----- ++ ++* Issue #131: Fix RuntimeError when constructing an egg fetcher. ++ ++----- + 2.0.2 + ----- + +diff --git a/setuptools/dist.py b/setuptools/dist.py +--- a/setuptools/dist.py ++++ b/setuptools/dist.py +@@ -295,7 +295,7 @@ + 'find_links', 'site_dirs', 'index_url', 'optimize', + 'site_dirs', 'allow_hosts' + ) +- for key in opts.keys(): ++ for key in list(opts): + if key not in keep: + del opts[key] # don't use any other settings + if self.dependency_links: From fae6079a01b604cdaaab2ecb9bf48368be31255e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Mon, 6 Jan 2014 22:35:39 +0000 Subject: [PATCH 06/16] adopt rest of the packages that were failing with the buildPythonPackage changes --- pkgs/applications/audio/lastwatch/default.nix | 2 - pkgs/applications/audio/quodlibet/default.nix | 4 +- pkgs/applications/video/miro/default.nix | 12 +- .../python-modules/pycrypto/default.nix | 12 +- .../python-modules/pygtk/default.nix | 7 +- pkgs/tools/X11/winswitch/default.nix | 10 +- pkgs/tools/X11/xpra/default.nix | 14 +- pkgs/tools/admin/gtk-vnc/default.nix | 69 +++------ pkgs/tools/networking/getmail/default.nix | 2 - pkgs/tools/security/fail2ban/default.nix | 4 - pkgs/top-level/python-packages.nix | 144 +++++++++--------- 11 files changed, 129 insertions(+), 151 deletions(-) diff --git a/pkgs/applications/audio/lastwatch/default.nix b/pkgs/applications/audio/lastwatch/default.nix index 324a0b0bebc..c09d397eefa 100644 --- a/pkgs/applications/audio/lastwatch/default.nix +++ b/pkgs/applications/audio/lastwatch/default.nix @@ -19,8 +19,6 @@ pythonPackages.buildPythonPackage rec { propagatedBuildInputs = pythonPath; - installCommand = "python setup.py install --prefix=$out"; - meta = { homepage = "https://github.com/aszlig/LastWatch"; description = "An inotify-based last.fm audio scrobbler"; diff --git a/pkgs/applications/audio/quodlibet/default.nix b/pkgs/applications/audio/quodlibet/default.nix index c865314cb17..3ab7688cde3 100644 --- a/pkgs/applications/audio/quodlibet/default.nix +++ b/pkgs/applications/audio/quodlibet/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, python, buildPythonPackage, mutagen, pygtk, pygobject +{ stdenv, fetchurl, python, buildPythonPackage, mutagen, pygtk, pygobject, intltool , pythonDBus, gst_python, withGstPlugins ? false, gst_plugins_base ? null , gst_plugins_good ? null, gst_plugins_ugly ? null, gst_plugins_bad ? null }: @@ -42,7 +42,7 @@ buildPythonPackage { ]; propagatedBuildInputs = [ - mutagen pygtk pygobject pythonDBus gst_python + mutagen pygtk pygobject pythonDBus gst_python intltool ]; postInstall = stdenv.lib.optionalString withGstPlugins '' diff --git a/pkgs/applications/video/miro/default.nix b/pkgs/applications/video/miro/default.nix index 5ca6c80dc7c..516f12f2051 100644 --- a/pkgs/applications/video/miro/default.nix +++ b/pkgs/applications/video/miro/default.nix @@ -40,10 +40,6 @@ buildPythonPackage rec { plat/resources.py ''; - installCommand = '' - python setup.py install --prefix= --root="$out" - ''; - # Disabled for now, because it requires networking and even if we skip those # tests, the whole test run takes around 10-20 minutes. doCheck = false; @@ -51,8 +47,14 @@ buildPythonPackage rec { HOME="$TEMPDIR" LANG=en_US.UTF-8 python miro.real --unittest ''; + preInstall = '' + # see https://bitbucket.org/pypa/setuptools/issue/130/install_data-doesnt-respect-prefix + ${python}/bin/${python.executable} setup.py install_data --root=$out + sed -i '/data_files=data_files/d' setup.py + ''; + postInstall = '' - mv "$out/bin/miro.real" "$out/bin/miro" + mv $out/bin/miro.real $out/bin/miro ''; buildInputs = [ diff --git a/pkgs/development/python-modules/pycrypto/default.nix b/pkgs/development/python-modules/pycrypto/default.nix index ec741ba247e..5da727a08db 100644 --- a/pkgs/development/python-modules/pycrypto/default.nix +++ b/pkgs/development/python-modules/pycrypto/default.nix @@ -9,17 +9,7 @@ buildPythonPackage rec { sha256 = "0g0ayql5b9mkjam8hym6zyg6bv77lbh66rv1fyvgqb17kfc1xkpj"; }; - buildInputs = [ python gmp ]; - - buildPhase = - '' - python ./setup.py build_ext --library-dirs=${gmp}/lib - ''; - -# installPhase = -# '' -# python ./setup.py install --prefix=$out -# ''; + buildInputs = [ gmp ]; meta = { homepage = "http://www.pycrypto.org/"; diff --git a/pkgs/development/python-modules/pygtk/default.nix b/pkgs/development/python-modules/pygtk/default.nix index e291544911c..dfe805ec9e4 100644 --- a/pkgs/development/python-modules/pygtk/default.nix +++ b/pkgs/development/python-modules/pygtk/default.nix @@ -14,7 +14,12 @@ buildPythonPackage rec { propagatedBuildInputs = [ gtk pygobject pycairo ]; - installCommand = "make install"; + configurePhase = "configurePhase"; + + buildPhase = "buildPhase"; + + installPhase = "installPhase"; + checkPhase = stdenv.lib.optionalString (libglade == null) '' sed -i -e "s/glade = importModule('gtk.glade', buildDir)//" \ diff --git a/pkgs/tools/X11/winswitch/default.nix b/pkgs/tools/X11/winswitch/default.nix index bd160940b57..2db0d172173 100644 --- a/pkgs/tools/X11/winswitch/default.nix +++ b/pkgs/tools/X11/winswitch/default.nix @@ -29,12 +29,10 @@ let }' winswitch/util/distro_packaging_util.py ''; - buildPhase = '' - python setup.py build - ''; - - installCommand = '' - PREFIX="$out" python ./setup.py install --prefix="$out" + preInstall = '' + # see https://bitbucket.org/pypa/setuptools/issue/130/install_data-doesnt-respect-prefix + python setup.py install_data --install-dir=$out --root=$out + sed -i '/data_files = data_files/d' setup.py ''; doCheck = false; diff --git a/pkgs/tools/X11/xpra/default.nix b/pkgs/tools/X11/xpra/default.nix index 35370ae2128..f96fa577323 100644 --- a/pkgs/tools/X11/xpra/default.nix +++ b/pkgs/tools/X11/xpra/default.nix @@ -13,7 +13,7 @@ buildPythonPackage rec { }; buildInputs = [ - python cython pkgconfig + cython pkgconfig xorg.libX11 xorg.renderproto xorg.libXrender xorg.libXi xorg.inputproto xorg.kbproto xorg.randrproto xorg.damageproto xorg.compositeproto xorg.xextproto xorg.recordproto @@ -33,9 +33,15 @@ buildPythonPackage rec { # they don't have automated testing out of the box? http://xpra.org/trac/ticket/177 doCheck = false; - buildPhase = '' - NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE $(pkg-config --cflags gtk+-2.0) $(pkg-config --cflags pygtk-2.0) $(pkg-config --cflags xtst)" - python ./setup.py build --enable-Xdummy + preBuild = '' + export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE $(pkg-config --cflags gtk+-2.0) $(pkg-config --cflags pygtk-2.0) $(pkg-config --cflags xtst)" + ''; + setupPyBuildFlags = ["--enable-Xdummy"]; + + preInstall = '' + # see https://bitbucket.org/pypa/setuptools/issue/130/install_data-doesnt-respect-prefix + ${python}/bin/${python.executable} setup.py install_data --install-dir=$out --root=$out + sed -i '/ = data_files/d' setup.py ''; meta = { diff --git a/pkgs/tools/admin/gtk-vnc/default.nix b/pkgs/tools/admin/gtk-vnc/default.nix index 44a421e2ba3..d4c45b7ba96 100644 --- a/pkgs/tools/admin/gtk-vnc/default.nix +++ b/pkgs/tools/admin/gtk-vnc/default.nix @@ -1,62 +1,41 @@ -x@{builderDefsPackage - , python, gtk, pygtk, gnutls, cairo, libtool, glib, pkgconfig, libtasn1 - , libffi, cyrus_sasl, intltool, perl, perlPackages, firefoxPkgs - , kbproto, libX11, libXext, xextproto, pygobject, libgcrypt - , ...}: -builderDefsPackage -(a : -let - helperArgNames = ["stdenv" "fetchurl" "builderDefsPackage"] ++ - ["perlPackages" "firefoxPkgs"]; +{ stdenv, fetchurl +, python, gtk, pygtk, gnutls, cairo, libtool, glib, pkgconfig, libtasn1 +, libffi, cyrus_sasl, intltool, perl, perlPackages, firefoxPkgs, pulseaudio +, kbproto, libX11, libXext, xextproto, pygobject, libgcrypt }: - buildInputs = (map (n: builtins.getAttr n x) - (builtins.attrNames (builtins.removeAttrs x helperArgNames))) - ++ [perlPackages.TextCSV firefoxPkgs.xulrunner ]; - sourceInfo = rec { - baseName="gtk-vnc"; - majorVersion="0.4"; - minorVersion="2"; - version="${majorVersion}.${minorVersion}"; - name="${baseName}-${version}"; - url="mirror://gnome/sources/${baseName}/${majorVersion}/${name}.tar.gz"; - hash="1fkhzwpw50rnwp51lsbny16p2ckzx5rkcaiaqvkd90vwnm2cccls"; - }; -in -rec { - src = a.fetchurl { - url = sourceInfo.url; - sha256 = sourceInfo.hash; + +stdenv.mkDerivation rec { + name = "gtk-vnc-${version}"; + version = "0.5.3"; + + src = fetchurl { + url = "mirror://gnome/sources/gtk-vnc/0.5/${name}.tar.xz"; + sha256 = "1bww2ihxb3zzvifdrcsy1lifr664pvikq17hmr1hsm8fyk4ad46l"; }; - inherit (sourceInfo) name version; - inherit buildInputs; + buildInputs = [ + python gtk pygtk gnutls cairo libtool pkgconfig glib libffi libgcrypt + intltool cyrus_sasl pulseaudio pygobject perl perlPackages.TextCSV + ]; + NIX_CFLAGS_COMPILE = "-fstack-protector-all"; configureFlags = [ "--with-python" "--with-examples" ]; - /* doConfigure should be removed if not needed */ - phaseNames = ["fixMakefiles" "doConfigure" "doMakeInstall"]; + makeFlags = "CODEGENDIR=${pygobject}/share/pygobject/2.0/codegen/ DEFSDIR=${pygtk}/share/pygtk/2.0/defs/"; - fixMakefiles = a.fullDepEntry '' - find . -name 'Makefile*' -exec sed -i '{}' -e 's@=codegendir pygtk-2.0@=codegendir pygobject-2.0@' ';' - '' ["minInit" "doUnpack"]; - - meta = { + meta = with stdenv.lib; { description = "A GTK VNC widget"; - maintainers = with a.lib.maintainers; - [ - raskin - ]; - platforms = with a.lib.platforms; - linux; - license = a.lib.licenses.lgpl21; + maintainers = with maintainers; [ raskin ]; + platforms = platforms.linux; + license = licenses.lgpl21; }; + passthru = { updateInfo = { downloadPage = "http://ftp.gnome.org/pub/GNOME/sources/gtk-vnc"; }; }; -}) x - +} diff --git a/pkgs/tools/networking/getmail/default.nix b/pkgs/tools/networking/getmail/default.nix index 80d29835da5..6d9666506b8 100644 --- a/pkgs/tools/networking/getmail/default.nix +++ b/pkgs/tools/networking/getmail/default.nix @@ -11,8 +11,6 @@ buildPythonPackage rec { doCheck = false; - installCommand = "python setup.py install --prefix=\"\$prefix\""; - meta = { description = "A program for retrieving mail"; maintainers = [ stdenv.lib.maintainers.raskin stdenv.lib.maintainers.iElectric ]; diff --git a/pkgs/tools/security/fail2ban/default.nix b/pkgs/tools/security/fail2ban/default.nix index aa387eff3e7..b28c761ec2c 100644 --- a/pkgs/tools/security/fail2ban/default.nix +++ b/pkgs/tools/security/fail2ban/default.nix @@ -39,10 +39,6 @@ pythonPackages.buildPythonPackage { doCheck = false; - installCommand = '' - python setup.py install --prefix=$out - ''; - meta = with stdenv.lib; { homepage = http://www.fail2ban.org/; description = "A program that scans log files for repeated failing login attempts and bans IP addresses"; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 0ccd5d5da26..c65eea99123 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -40,7 +40,7 @@ pythonPackages = modules // import ./python-packages-generated.nix { setuptools = import ../development/python-modules/setuptools { inherit (pkgs) stdenv fetchurl; - inherit python wrapPython; + inherit python wrapPython distutils-cfg; }; # packages defined elsewhere @@ -287,10 +287,7 @@ pythonPackages = modules // import ./python-packages-generated.nix { ]; postInstall = '' - ln -s ${pyramid}/bin/pserve $out/bin ln -s ${pkgs.bacula}/bin/bconsole $out/bin - wrapProgram "$out/bin/pserve" \ - --suffix PYTHONPATH : "$out/lib/python2.7/site-packages" ''; meta = { @@ -544,7 +541,7 @@ pythonPackages = modules // import ./python-packages-generated.nix { }; # tests depend on $HOME setting - configurePhase = "export HOME=$TMPDIR"; + preConfigure = "export HOME=$TMPDIR"; propagatedBuildInputs = [ pythonPackages.pyyaml @@ -1238,7 +1235,22 @@ pythonPackages = modules // import ./python-packages-generated.nix { md5 = "4e155a0134e6757b37cc6698c20f3e9f"; }; - propagatedBuildInputs = [ pythonPackages.py ] + preCheck = '' + # broken on python3, fixed in master, remove in next release + rm doc/en/plugins_index/test_plugins_index.py + + # see https://bitbucket.org/hpk42/pytest/issue/418/test-failures-with-python-275-and-pytest + sed -i "/test_unicode/i\ @pytest.mark.xfail" testing/test_assertion.py + + # don't test bash builtins + rm testing/test_argcomplete.py + + # yaml test are failing + rm doc/en/example/nonpython/test_simple.yml + + ''; + + propagatedBuildInputs = [ py ] ++ stdenv.lib.optional pkgs.config.pythonPackages.pytest.selenium or false pythonPackages.selenium; @@ -1687,14 +1699,23 @@ pythonPackages = modules // import ./python-packages-generated.nix { }; gtimelog = buildPythonPackage rec { - name = "gtimelog-0.8.1"; + name = "gtimelog-${version}"; + version = "0.8.1"; + src = fetchurl { - url = https://launchpad.net/gtimelog/devel/0.8.1/+download/gtimelog-0.8.1.tar.gz; - sha256 = "010sbw4rmslf5ifg9bgicn0f6mgsy76v8218xi0jndi9z6pva7y6"; + url = "https://github.com/gtimelog/gtimelog/archive/${version}.tar.gz"; + sha256 = "0nwpfv284b26q97mfpagqkqb4n2ilw46cx777qsyi3plnywk1xa0"; }; + propagatedBuildInputs = [ pygtk ]; + + checkPhase = '' + patchShebangs ./runtests + ./runtests + ''; + meta = with stdenv.lib; { - description = "A small Gtk+ app for keeping track of your time. It's main goal is to be as unintrusive as possible."; + description = "A small Gtk+ app for keeping track of your time. It's main goal is to be as unintrusive as possible"; homepage = http://mg.pov.lt/gtimelog/; license = licenses.gpl2Plus; maintainers = [ maintainers.ocharles ]; @@ -2185,6 +2206,10 @@ pythonPackages = modules // import ./python-packages-generated.nix { sha256 = "0d2if633m3kbiricd5hgn1csccd8xab6lnab1bq9prdr9ks9i8h6"; }; + preConfigure = '' + sed -i "/use_setuptools/d" setup.py + ''; + buildInputs = [ pkgs.alsaLib pkgs.jackaudio ]; meta = with stdenv.lib; { @@ -2474,9 +2499,6 @@ pythonPackages = modules // import ./python-packages-generated.nix { }; buildPhase = "make build"; - installCommand = '' - ${python}/bin/${python.executable} setup.py install --prefix="$out" --root=/ --record="$out/lib/${python.libPrefix}/site-packages/dulwich/list.txt" --single-version-externally-managed - ''; # For some reason "python setup.py test" doesn't work with Python 2.6. # pretty sure that is about import behaviour. @@ -3438,9 +3460,6 @@ pythonPackages = modules // import ./python-packages-generated.nix { buildInputs = [ pkgs.libxml2 pkgs.libxslt ]; propagatedBuildInputs = [ ]; doCheck = false; - installCommand = '' - easy_install --always-unzip --no-deps --prefix="$out" . - ''; meta = { description = "Pythonic binding for the libxml2 and libxslt libraries"; @@ -3492,21 +3511,15 @@ pythonPackages = modules // import ./python-packages-generated.nix { }; }; - magic = pkgs.stdenv.mkDerivation rec { - name = "python-${pkgs.file.name}"; + magic = buildPythonPackage rec { + name = "${pkgs.file.name}"; src = pkgs.file.src; patches = [ ../tools/misc/file/python.patch ]; buildInputs = [ python pkgs.file ]; - configurePhase = "cd python"; - - buildPhase = "${python}/bin/${python.executable} setup.py build"; - - installPhase = '' - ${python}/bin/${python.executable} setup.py install --prefix=$out - ''; + preConfigure = "cd python"; meta = { description = "A Python wrapper around libmagic"; @@ -3526,7 +3539,7 @@ pythonPackages = modules // import ./python-packages-generated.nix { buildInputs = [ pkgs.swig pkgs.openssl ]; - buildPhase = "${python}/bin/${python.executable} setup.py build_ext --openssl=${pkgs.openssl}"; + preBuild = "${python}/bin/${python.executable} setup.py build_ext --openssl=${pkgs.openssl}"; doCheck = false; # another test that depends on the network. @@ -4200,19 +4213,14 @@ pythonPackages = modules // import ./python-packages-generated.nix { }; }); - notmuch = pkgs.stdenv.mkDerivation rec { + notmuch = buildPythonPackage rec { name = "python-${pkgs.notmuch.name}"; src = pkgs.notmuch.src; + sourceRoot = "${pkgs.notmuch.name}/bindings/python"; + buildInputs = [ python pkgs.notmuch ]; - #propagatedBuildInputs = [ python pkgs.notmuch ]; - - configurePhase = "cd bindings/python"; - - buildPhase = "python setup.py build"; - - installPhase = "python setup.py install --prefix=$out"; meta = { description = "A Python wrapper around notmuch"; @@ -4233,13 +4241,12 @@ pythonPackages = modules // import ./python-packages-generated.nix { sed -i 's/-faltivec//' numpy/distutils/system_info.py ''; - # TODO: add ATLAS=${pkgs.atlas} - installCommand = '' + preBuild = '' export BLAS=${pkgs.blas} LAPACK=${pkgs.liblapack} - ${python}/bin/${python.executable} setup.py build --fcompiler="gnu95" - ${python}/bin/${python.executable} setup.py install --prefix=$out ''; + setupPyBuildFlags = ["--fcompiler='gnu95'"]; + # error: invalid command 'test' doCheck = false; @@ -4614,10 +4621,7 @@ pythonPackages = modules // import ./python-packages-generated.nix { url = "http://pypi.python.org/packages/source/p/pip/pip-${version}.tar.gz"; sha256 = "0j700f70mj0brdlvs2cz4a7h4jwmzgymgp8qk1qb3lsm1qd1vy15"; }; - buildInputs = [ mock scripttest virtualenv nose ]; - # ValueError: Working directory tests not found, or not a directory - # see https://github.com/pypa/pip/issues/92 - doCheck = false; + buildInputs = [ mock scripttest virtualenv pytest ]; }; @@ -4644,7 +4648,7 @@ pythonPackages = modules // import ./python-packages-generated.nix { buildInputs = [ pkgs.freetype pkgs.libjpeg pkgs.unzip pkgs.zlib pkgs.libtiff pkgs.libwebp ]; # NOTE: we use LCMS_ROOT as WEBP root since there is not other setting for webp. - configurePhase = '' + preConfigure = '' sed -i "setup.py" \ -e 's|^FREETYPE_ROOT =.*$|FREETYPE_ROOT = _lib_include("${pkgs.freetype}")|g ; s|^JPEG_ROOT =.*$|JPEG_ROOT = _lib_include("${pkgs.libjpeg}")|g ; @@ -4653,7 +4657,7 @@ pythonPackages = modules // import ./python-packages-generated.nix { s|^TIFF_ROOT =.*$|TIFF_ROOT = _lib_include("${pkgs.libtiff}")|g ;' ''; - doCheck = true; + meta = { homepage = http://python-imaging.github.com/Pillow; @@ -4764,10 +4768,6 @@ pythonPackages = modules // import ./python-packages-generated.nix { protobuf = buildPythonPackage rec { inherit (pkgs.protobuf) name src; - buildPhase = '' - python setup.py build - ''; - propagatedBuildInputs = [pkgs.protobuf]; sourceRoot = "${name}/python"; @@ -4838,7 +4838,7 @@ pythonPackages = modules // import ./python-packages-generated.nix { src = fetchurl { url = "https://pypi.python.org/packages/source/p/py/${name}.tar.gz"; - md5 = "3857dc8309d5f284669b81184253c2bb"; + md5 = "d2e24b4363d834bf9192247f143435bc"; }; }; @@ -5189,6 +5189,7 @@ pythonPackages = modules // import ./python-packages-generated.nix { propagatedBuildInputs = [ urlgrabber ]; checkPhase = '' + export PYTHONPATH="$PYTHONPATH:." ${python}/bin/${python.executable} tests/baseclass.py -vv ''; @@ -5267,7 +5268,8 @@ pythonPackages = modules // import ./python-packages-generated.nix { propagatedBuildInputs = [ pkgs.parted ]; checkPhase = '' - ${python}/bin/${python.executable} -m unittest discover -v + patchShebangs Makefile + make test PYTHON=${python.executable} ''; meta = { @@ -5621,7 +5623,7 @@ pythonPackages = modules // import ./python-packages-generated.nix { # There seems to be no way to pass that path to configure. NIX_CFLAGS_COMPILE="-I${pkgs.aprutil}/include/apr-1"; - configurePhase = '' + preConfigure = '' cd Source python setup.py backport python setup.py configure \ @@ -6172,16 +6174,16 @@ pythonPackages = modules // import ./python-packages-generated.nix { buildInputs = [pkgs.gfortran]; propagatedBuildInputs = [ numpy ]; + # TODO: add ATLAS=${pkgs.atlas} + preConfigure = '' + export BLAS=${pkgs.blas} LAPACK=${pkgs.liblapack} + ''; + + setupPyBuildFlags = [ "--fcompiler='gnu95'" ]; + # error: invalid command 'test' doCheck = false; - # TODO: add ATLAS=${pkgs.atlas} - installCommand = '' - export BLAS=${pkgs.blas} LAPACK=${pkgs.liblapack} - ${python}/bin/${python.executable} setup.py build --fcompiler="gnu95" - ${python}/bin/${python.executable} setup.py install --prefix=$out - ''; - meta = { description = "SciPy (pronounced 'Sigh Pie') is open-source software for mathematics, science, and engineering. "; homepage = http://www.scipy.org/; @@ -6573,7 +6575,10 @@ pythonPackages = modules // import ./python-packages-generated.nix { }; buildInputs = [ mock ]; - propagatedBuildInputs = [ meld3 ]; + propagatedBuildInputs = [ meld3 ]; + + # failing tests when building under chroot as root user doesn't exist + doCheck = false; meta = { description = "A system for controlling process state under UNIX"; @@ -6713,10 +6718,16 @@ pythonPackages = modules // import ./python-packages-generated.nix { md5 = "051dd9de0757714d33c3ecd5ab37b97d"; }; - buildInputs = [ pytest webob pkgs.imagemagick ]; + buildInputs = [ pytest webob pkgs.imagemagick nose ]; propagatedBuildInputs = [ sqlalchemy8 wand ]; - checkPhase = "cd tests && LD_LIBRARY_PATH=${pkgs.imagemagick}/lib py.test"; + checkPhase = '' + cd tests + export LD_LIBRARY_PATH=${pkgs.imagemagick}/lib + export PYTHONPATH=$PYTHONPATH:../ + py.test + cd .. + ''; meta = { homepage = https://github.com/crosspop/sqlalchemy-imageattach; @@ -7816,8 +7827,8 @@ pythonPackages = modules // import ./python-packages-generated.nix { propagatedBuildInputs = [ zope_proxy ]; # ignore circular dependency on zope_schema - installCommand = '' - easy_install --always-unzip --no-deps --prefix="$out" . + preBuild = '' + sed -i '/zope.schema/d' setup.py ''; doCheck = false; @@ -7870,12 +7881,7 @@ pythonPackages = modules // import ./python-packages-generated.nix { md5 = "e7e581af8193551831560a736a53cf58"; }; - propagatedBuildInputs = [ zope_event zope_interface zope_testing ] ++ optional isPy26 ordereddict; - - # ignore circular dependency on zope_location - installCommand = '' - easy_install --no-deps --prefix="$out" . - ''; + propagatedBuildInputs = [ zope_location zope_event zope_interface zope_testing ] ++ optional isPy26 ordereddict; meta = { maintainers = [ stdenv.lib.maintainers.goibhniu ]; From 7cdab2c02470d9a410298495a678aff9bd3afd85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Fri, 10 Jan 2014 21:50:03 +0100 Subject: [PATCH 07/16] pythonPackages.setuptools: 2.0.2 -> 2.1 --- .../python-modules/setuptools/default.nix | 7 ++--- .../setuptools/fix_python3_egg_fetcher.patch | 28 ------------------- 2 files changed, 2 insertions(+), 33 deletions(-) delete mode 100644 pkgs/development/python-modules/setuptools/fix_python3_egg_fetcher.patch diff --git a/pkgs/development/python-modules/setuptools/default.nix b/pkgs/development/python-modules/setuptools/default.nix index f585d758c2d..35630be2255 100644 --- a/pkgs/development/python-modules/setuptools/default.nix +++ b/pkgs/development/python-modules/setuptools/default.nix @@ -4,16 +4,13 @@ stdenv.mkDerivation rec { shortName = "setuptools-${version}"; name = "${python.executable}-${shortName}"; - version = "2.0.2"; + version = "2.1"; src = fetchurl { url = "http://pypi.python.org/packages/source/s/setuptools/${shortName}.tar.gz"; - sha256 = "09nv5x45y8fgc0kjmmw4gig3hr0is9xlc5rq053vnbmkxr5q5xmi"; + sha256 = "1m8qjvj5bfbphdags5s6pgmvk3xnw509lgdlq9whkq5a9mgxf8m7"; }; - # see https://bitbucket.org/pypa/setuptools/commits/976b839801a3a181f2e14f305ddbe0b410fa8fc0.patch - patches = [ ./fix_python3_egg_fetcher.patch ]; - buildInputs = [ python wrapPython distutils-cfg ]; buildPhase = "${python}/bin/${python.executable} setup.py build"; diff --git a/pkgs/development/python-modules/setuptools/fix_python3_egg_fetcher.patch b/pkgs/development/python-modules/setuptools/fix_python3_egg_fetcher.patch deleted file mode 100644 index 17ab473a502..00000000000 --- a/pkgs/development/python-modules/setuptools/fix_python3_egg_fetcher.patch +++ /dev/null @@ -1,28 +0,0 @@ -diff --git a/CHANGES.txt b/CHANGES.txt ---- a/CHANGES.txt -+++ b/CHANGES.txt -@@ -3,6 +3,12 @@ - ======= - - ----- -+2.0.3 -+----- -+ -+* Issue #131: Fix RuntimeError when constructing an egg fetcher. -+ -+----- - 2.0.2 - ----- - -diff --git a/setuptools/dist.py b/setuptools/dist.py ---- a/setuptools/dist.py -+++ b/setuptools/dist.py -@@ -295,7 +295,7 @@ - 'find_links', 'site_dirs', 'index_url', 'optimize', - 'site_dirs', 'allow_hosts' - ) -- for key in opts.keys(): -+ for key in list(opts): - if key not in keep: - del opts[key] # don't use any other settings - if self.dependency_links: From ab6865c3a486ebd5ec4e6d95572268aae4303e2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Fri, 10 Jan 2014 21:54:07 +0100 Subject: [PATCH 08/16] distutils.cfg: name as others coding conventions for python packages --- pkgs/development/python-modules/distutils-cfg/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/python-modules/distutils-cfg/default.nix b/pkgs/development/python-modules/distutils-cfg/default.nix index 7b0f3628698..190c663b471 100644 --- a/pkgs/development/python-modules/distutils-cfg/default.nix +++ b/pkgs/development/python-modules/distutils-cfg/default.nix @@ -16,7 +16,7 @@ let ${extraCfg} ''; in stdenv.mkDerivation { - name = "distutils.cfg-python${python.version}"; + name = "${python.libPrefix}-distutils.cfg"; buildInputs = [ python ]; From 21ada5b105aa863a01388275d7aaf226253f9d82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Fri, 10 Jan 2014 21:57:28 +0100 Subject: [PATCH 09/16] garden --- pkgs/development/python-modules/generic/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/python-modules/generic/default.nix b/pkgs/development/python-modules/generic/default.nix index 51af437265d..fc91fcd3d8a 100644 --- a/pkgs/development/python-modules/generic/default.nix +++ b/pkgs/development/python-modules/generic/default.nix @@ -35,7 +35,7 @@ # pollute the user environment. , pythonPath ? [] -, meta ? {} +, meta ? {} , ... } @ attrs: From c80feaf542d437d0bc6d4461ba49643dd9eac1ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Fri, 10 Jan 2014 22:04:05 +0100 Subject: [PATCH 10/16] document setuptools monkeypatching and DETERMINISTIC_BUILD=1 --- pkgs/development/python-modules/generic/default.nix | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkgs/development/python-modules/generic/default.nix b/pkgs/development/python-modules/generic/default.nix index fc91fcd3d8a..c2a389a78be 100644 --- a/pkgs/development/python-modules/generic/default.nix +++ b/pkgs/development/python-modules/generic/default.nix @@ -54,14 +54,17 @@ python.stdenv.mkDerivation (attrs // { configurePhase = attrs.configurePhase or '' runHook preConfigure - # TODO: document + # patch python interpreter to write null timestamps when compiling python files + # with following var we tell python to activate the patch so that python doesn't + # try to update them when we freeze timestamps in nix store export DETERMINISTIC_BUILD=1 - # we need to prepend following line to monkeypatch distutils commands + # prepend following line to import setuptools before distutils + # this way we make sure setuptools monkeypatches distutils commands + # this way setuptools provides extra helpers such as "python setup.py test" sed -i '0,/import distutils/s//import setuptools;import distutils/' setup.py sed -i '0,/from distutils/s//import setuptools;from distutils/' setup.py - runHook postConfigure ''; From b1ffb9ede468fec2845960e2b37b6dfeb922d3d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Sat, 11 Jan 2014 11:44:24 +0100 Subject: [PATCH 11/16] buildPythonPackage: Add --old-and-unmanageable flag to install command and add more docs. For explanation see inline comments. --- .../python-modules/generic/default.nix | 31 +++++++++++++------ 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/pkgs/development/python-modules/generic/default.nix b/pkgs/development/python-modules/generic/default.nix index c2a389a78be..5253c52df42 100644 --- a/pkgs/development/python-modules/generic/default.nix +++ b/pkgs/development/python-modules/generic/default.nix @@ -7,15 +7,16 @@ { name -# by default prefix name with python version name, e.g. "python3.3-" +# by default prefix `name` e.g. "python3.3-${name}" , namePrefix ? python.libPrefix + "-" , buildInputs ? [] -# TODO: document +# pass extra information to the distutils global configuration (think as global setup.cfg) , distutilsExtraCfg ? "" -# TODO: say what it does +# propagate build dependencies so in case we have A -> B -> C, +# C can import propagated packages by A , propagatedBuildInputs ? [] # passed to "python setup.py install" @@ -71,6 +72,7 @@ python.stdenv.mkDerivation (attrs // { checkPhase = attrs.checkPhase or '' runHook preCheck + # reduce output to only dots, if a test fails error output will include verbose info ${python}/bin/${python.executable} setup.py test -q runHook postCheck @@ -91,8 +93,17 @@ python.stdenv.mkDerivation (attrs // { export PYTHONPATH="$out/lib/${python.libPrefix}/site-packages:$PYTHONPATH" - ${python}/bin/${python.executable} setup.py install --install-lib=$out/lib/${python.libPrefix}/site-packages \ - --prefix="$out" ${lib.concatStringsSep " " setupPyInstallFlags} + ${python}/bin/${python.executable} setup.py install \ + # sometimes packages specify where files should be installed outside the usual + # python lib prefix, we override that back so all infrastructure (setup hooks) + # work as expected + --install-lib=$out/lib/${python.libPrefix}/site-packages \ + # instruct setuptools not to use eggs but fallback to plan package install + # this also reduces one .pth file in the chain, but the main reason is to + # force install process to install only scripts for the package we are + # installing (otherwise it will install scripts also for dependencies) + --old-and-unmanageable \ + --prefix="$out" ${lib.concatStringsSep " " setupPyInstallFlags} # A pth file might have been generated to load the package from # within its own site-packages, rename this package not to @@ -116,14 +127,14 @@ python.stdenv.mkDerivation (attrs // { wrapPythonPrograms # If a user installs a Python package, they probably also wants its - # dependencies in the user environment (since Python modules don't - # have something like an RPATH, so the only way to find the + # dependencies in the user environment profile (only way to find the # dependencies is to have them in the PYTHONPATH variable). - # TODO: better docs + # Allows you to do: $ PYTHONPATH=~/.nix-profile/lib/python2.7/site-packages python if test -e $out/nix-support/propagated-build-inputs; then ln -s $out/nix-support/propagated-build-inputs $out/nix-support/propagated-user-env-packages fi + # TODO: document createBuildInputsPth build-inputs "$buildInputStrings" for inputsfile in propagated-build-inputs propagated-native-build-inputs; do if test -e $out/nix-support/$inputsfile; then @@ -135,9 +146,9 @@ python.stdenv.mkDerivation (attrs // { meta = { # default to python's platforms platforms = python.meta.platforms; - } // meta // { + } // meta // with lib.maintainers; { # add extra maintainer(s) to every package - maintainers = (meta.maintainers or []) ++ [ lib.maintainers.chaoflow lib.maintainers.iElectric ]; + maintainers = (meta.maintainers or []) ++ [ chaoflow iElectric ]; }; }) From dfa8ac64ad35cb8525d441f7ae92911b4b367074 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Sat, 11 Jan 2014 20:14:58 +0100 Subject: [PATCH 12/16] miro: keep quotes --- pkgs/applications/video/miro/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/applications/video/miro/default.nix b/pkgs/applications/video/miro/default.nix index 516f12f2051..14aeca62a71 100644 --- a/pkgs/applications/video/miro/default.nix +++ b/pkgs/applications/video/miro/default.nix @@ -54,7 +54,7 @@ buildPythonPackage rec { ''; postInstall = '' - mv $out/bin/miro.real $out/bin/miro + mv "$out/bin/miro.real" "$out/bin/miro" ''; buildInputs = [ From fa98edf2b13a568735e7098a0f1156e8975eaad5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Wed, 22 Jan 2014 10:15:26 +0100 Subject: [PATCH 13/16] fix eval --- pkgs/development/python-modules/generic/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/python-modules/generic/default.nix b/pkgs/development/python-modules/generic/default.nix index 5253c52df42..f95278b5e99 100644 --- a/pkgs/development/python-modules/generic/default.nix +++ b/pkgs/development/python-modules/generic/default.nix @@ -143,10 +143,10 @@ python.stdenv.mkDerivation (attrs // { done ''; - meta = { + meta = with lib.maintainers; { # default to python's platforms platforms = python.meta.platforms; - } // meta // with lib.maintainers; { + } // meta // { # add extra maintainer(s) to every package maintainers = (meta.maintainers or []) ++ [ chaoflow iElectric ]; }; From c72d59881fa79be33f8bc2c20c5fc0dfd81c6f33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Wed, 22 Jan 2014 10:15:43 +0100 Subject: [PATCH 14/16] remove unneeded pytest test skip --- pkgs/top-level/python-packages.nix | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index c65eea99123..b05c670aab6 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1239,15 +1239,11 @@ pythonPackages = modules // import ./python-packages-generated.nix { # broken on python3, fixed in master, remove in next release rm doc/en/plugins_index/test_plugins_index.py - # see https://bitbucket.org/hpk42/pytest/issue/418/test-failures-with-python-275-and-pytest - sed -i "/test_unicode/i\ @pytest.mark.xfail" testing/test_assertion.py - # don't test bash builtins rm testing/test_argcomplete.py # yaml test are failing rm doc/en/example/nonpython/test_simple.yml - ''; propagatedBuildInputs = [ py ] From 567e67f05fb7ddcaa8d788661b81de5a678644ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Wed, 22 Jan 2014 10:17:34 +0100 Subject: [PATCH 15/16] bash doesn't allow comments between multiline statements --- .../python-modules/generic/default.nix | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/pkgs/development/python-modules/generic/default.nix b/pkgs/development/python-modules/generic/default.nix index f95278b5e99..2b901db7643 100644 --- a/pkgs/development/python-modules/generic/default.nix +++ b/pkgs/development/python-modules/generic/default.nix @@ -94,17 +94,21 @@ python.stdenv.mkDerivation (attrs // { export PYTHONPATH="$out/lib/${python.libPrefix}/site-packages:$PYTHONPATH" ${python}/bin/${python.executable} setup.py install \ - # sometimes packages specify where files should be installed outside the usual - # python lib prefix, we override that back so all infrastructure (setup hooks) - # work as expected --install-lib=$out/lib/${python.libPrefix}/site-packages \ - # instruct setuptools not to use eggs but fallback to plan package install - # this also reduces one .pth file in the chain, but the main reason is to - # force install process to install only scripts for the package we are - # installing (otherwise it will install scripts also for dependencies) --old-and-unmanageable \ --prefix="$out" ${lib.concatStringsSep " " setupPyInstallFlags} + # --install-lib: + # sometimes packages specify where files should be installed outside the usual + # python lib prefix, we override that back so all infrastructure (setup hooks) + # work as expected + + # --old-and-unmanagable: + # instruct setuptools not to use eggs but fallback to plan package install + # this also reduces one .pth file in the chain, but the main reason is to + # force install process to install only scripts for the package we are + # installing (otherwise it will install scripts also for dependencies) + # A pth file might have been generated to load the package from # within its own site-packages, rename this package not to # collide with others. From f1db57f1fe3ac9f33a7c212981293f5d864ecf69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Fri, 21 Feb 2014 14:29:32 +0100 Subject: [PATCH 16/16] buildPythonPackage: fix more borken packages --- pkgs/applications/audio/quodlibet/default.nix | 5 +++++ .../python-modules/generic/default.nix | 3 +-- pkgs/development/python-modules/pil/default.nix | 5 ++--- pkgs/os-specific/linux/iotop/default.nix | 6 ------ pkgs/top-level/python-packages.nix | 17 ++++++++++------- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/pkgs/applications/audio/quodlibet/default.nix b/pkgs/applications/audio/quodlibet/default.nix index 3ab7688cde3..fa63c9f654a 100644 --- a/pkgs/applications/audio/quodlibet/default.nix +++ b/pkgs/applications/audio/quodlibet/default.nix @@ -29,6 +29,11 @@ buildPythonPackage { }) ]; + preConfigure = '' + # TODO: for now don't a apply gdist overrides, will be needed for shipping icons, gtk, etc + sed -i /distclass/d setup.py + ''; + sourceRoot = "quodlibet-${version}"; postUnpack = '' # the patch searches for plugins in directory ../plugins diff --git a/pkgs/development/python-modules/generic/default.nix b/pkgs/development/python-modules/generic/default.nix index 2b901db7643..067a1cdf2e2 100644 --- a/pkgs/development/python-modules/generic/default.nix +++ b/pkgs/development/python-modules/generic/default.nix @@ -72,8 +72,7 @@ python.stdenv.mkDerivation (attrs // { checkPhase = attrs.checkPhase or '' runHook preCheck - # reduce output to only dots, if a test fails error output will include verbose info - ${python}/bin/${python.executable} setup.py test -q + ${python}/bin/${python.executable} setup.py test runHook postCheck ''; diff --git a/pkgs/development/python-modules/pil/default.nix b/pkgs/development/python-modules/pil/default.nix index 1dfdfee08fb..0b462cb4e52 100644 --- a/pkgs/development/python-modules/pil/default.nix +++ b/pkgs/development/python-modules/pil/default.nix @@ -14,16 +14,15 @@ buildPythonPackage { doCheck = true; - configurePhase = '' + preConfigure = '' sed -i "setup.py" \ -e 's|^FREETYPE_ROOT =.*$|FREETYPE_ROOT = libinclude("${freetype}")|g ; s|^JPEG_ROOT =.*$|JPEG_ROOT = libinclude("${libjpeg}")|g ; s|^ZLIB_ROOT =.*$|ZLIB_ROOT = libinclude("${zlib}")|g ;' ''; - buildPhase = "python setup.py build_ext -i"; checkPhase = "python selftest.py"; - #installPhase = "python setup.py install --prefix=$out"; + buildPhase = "python setup.py build_ext -i"; meta = { homepage = http://www.pythonware.com/products/pil/; diff --git a/pkgs/os-specific/linux/iotop/default.nix b/pkgs/os-specific/linux/iotop/default.nix index 8e181d3d5cf..7481edeee7b 100644 --- a/pkgs/os-specific/linux/iotop/default.nix +++ b/pkgs/os-specific/linux/iotop/default.nix @@ -11,12 +11,6 @@ buildPythonPackage rec { pythonPath = [ pythonPackages.curses ]; - postInstall = - '' - # Put the man page in the right place. - mv $out/lib/python*/site-packages/iotop-*/share $out - ''; - doCheck = false; meta = { diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index b05c670aab6..73919c330ba 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1719,6 +1719,7 @@ pythonPackages = modules // import ./python-packages-generated.nix { }; }; + # TODO: this shouldn't use a buildPythonPackage koji = buildPythonPackage (rec { name = "koji-1.8"; meta.maintainers = [ stdenv.lib.maintainers.mornfall ]; @@ -1728,8 +1729,9 @@ pythonPackages = modules // import ./python-packages-generated.nix { sha256 = "10dph209h4jgajb5jmbjhqy4z4hd22i7s2d93vm3ikdf01i8iwf1"; }; + configurePhase = ":"; buildPhase = ":"; - installCommand = "make install DESTDIR=$out/ && cp -R $out/nix/store/*/* $out/ && rm -rf $out/nix"; + installPhase = "make install DESTDIR=$out/ && cp -R $out/nix/store/*/* $out/ && rm -rf $out/nix"; doCheck = false; propagatedBuildInputs = [ pythonPackages.pycurl ]; @@ -1748,12 +1750,12 @@ pythonPackages = modules // import ./python-packages-generated.nix { paver = buildPythonPackage rec { - version = "1.2.1"; + version = "1.2.2"; name = "Paver-${version}"; src = fetchurl { url = "https://pypi.python.org/packages/source/P/Paver/Paver-${version}.tar.gz"; - sha256 = "1b1023jks1gi1rwphdy3y2zx7dh4bvwk2050kclp95j7xym1ya0y"; + sha256 = "0lix9d33ndb3yk56sm1zlj80fbmxp0w60yk0d9pr2xqxiwi88sqy"; }; buildInputs = [ cogapp mock virtualenv ]; @@ -4235,6 +4237,7 @@ pythonPackages = modules // import ./python-packages-generated.nix { preConfigure = '' sed -i 's/-faltivec//' numpy/distutils/system_info.py + sed -i '0,/from numpy.distutils.core/s//import setuptools;from numpy.distutils.core/' setup.py ''; preBuild = '' @@ -5307,14 +5310,14 @@ pythonPackages = modules // import ./python-packages-generated.nix { }); python_fedora = buildPythonPackage (rec { - name = "python-fedora-0.3.32.3"; + name = "python-fedora-0.3.33"; meta.maintainers = [ stdenv.lib.maintainers.mornfall ]; src = fetchurl { - url = "https://fedorahosted.org/releases/p/y/python-fedora/python-fedora-0.3.32.3.tar.gz"; - sha256 = "0qwmbid4pkdj6z9gwa43fzs97fr6ci2h2vj1hyk0gp0vqim4kv4l"; + url = "https://fedorahosted.org/releases/p/y/python-fedora/${name}.tar.gz"; + sha256 = "1g05bh7d5d0gzrlnhpnca7jpqbgs2rgnlzzbvzzxmdbmlkqi3mws"; }; - propagatedBuildInputs = [ kitchen requests bunch ]; + propagatedBuildInputs = [ kitchen requests bunch paver ]; doCheck = false; });