about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorDomen Kožar <domen@dev.si>2014-03-10 12:06:26 +0100
committerDomen Kožar <domen@dev.si>2014-03-10 12:06:26 +0100
commit498c1e25fb4740afbbfb0664effbe30ffee5820d (patch)
tree4b8c6fd5b1a5311a78a5c5380b35b1323b54b506 /pkgs
parent086afe9161b0763075f8f4e4793c5490648f0ec9 (diff)
parenta33891973ada0ff948a467a9982c01074948c680 (diff)
downloadnixlib-498c1e25fb4740afbbfb0664effbe30ffee5820d.tar
nixlib-498c1e25fb4740afbbfb0664effbe30ffee5820d.tar.gz
nixlib-498c1e25fb4740afbbfb0664effbe30ffee5820d.tar.bz2
nixlib-498c1e25fb4740afbbfb0664effbe30ffee5820d.tar.lz
nixlib-498c1e25fb4740afbbfb0664effbe30ffee5820d.tar.xz
nixlib-498c1e25fb4740afbbfb0664effbe30ffee5820d.tar.zst
nixlib-498c1e25fb4740afbbfb0664effbe30ffee5820d.zip
Merge pull request #1907 from offlinehacker/pkgs/pythonPackages/improvements
Python improvements
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/python-modules/generic/default.nix24
-rw-r--r--pkgs/top-level/all-packages.nix6
-rw-r--r--pkgs/top-level/python-packages.nix191
3 files changed, 115 insertions, 106 deletions
diff --git a/pkgs/development/python-modules/generic/default.nix b/pkgs/development/python-modules/generic/default.nix
index 067a1cdf2e27..45c8653bc198 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, recursivePthLoader, distutils-cfg }:
+{ python, setuptools, unzip, wrapPython, lib, recursivePthLoader, distutils-cfg }:
 
 { name
 
@@ -38,6 +38,12 @@
 
 , meta ? {}
 
+# Execute before shell hook
+, preShellHook ? ""
+
+# Execute after shell hook
+, postShellHook ? ""
+
 , ... } @ attrs:
 
 # Keep extra attributes from `attrs`, e.g., `patchPhase', etc.
@@ -46,7 +52,11 @@ python.stdenv.mkDerivation (attrs // {
 
   name = namePrefix + name;
 
-  buildInputs = [ python wrapPython setuptools (distutils-cfg.override { extraCfg = distutilsExtraCfg; }) ] ++ buildInputs ++ pythonPath;
+  buildInputs = [
+    python wrapPython setuptools
+    (distutils-cfg.override { extraCfg = distutilsExtraCfg; })
+  ] ++ buildInputs ++ pythonPath
+    ++ (lib.optional (lib.hasSuffix "zip" attrs.src.name) unzip);
 
   propagatedBuildInputs = propagatedBuildInputs ++ [ recursivePthLoader ];
 
@@ -146,6 +156,16 @@ python.stdenv.mkDerivation (attrs // {
       done
     '';
 
+  shellHook = attrs.shellHook or ''
+    mkdir -p /tmp/$name/lib/${python.libPrefix}/site-packages
+    ${preShellHook}
+    export PATH="/tmp/$name/bin:$PATH"
+    export PYTHONPATH="/tmp/$name/lib/${python.libPrefix}/site-packages:$PYTHONPATH"
+    python setup.py develop --prefix /tmp/$name
+    ${postShellHook}
+    return
+  '';
+
   meta = with lib.maintainers; {
     # default to python's platforms
     platforms = python.meta.platforms;
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 6239c6548258..36fdd6e78bbf 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -6076,7 +6076,6 @@ let
   # regardless.
   python26Packages = import ./python-packages.nix {
     inherit pkgs;
-    inherit (lib) lowPrio;
     python = python26;
   };
 
@@ -6084,31 +6083,26 @@ let
 
   python33Packages = recurseIntoAttrs (import ./python-packages.nix {
     inherit pkgs;
-    inherit (lib) lowPrio;
     python = python33;
   });
 
   python34Packages = import ./python-packages.nix {
     inherit pkgs;
-    inherit (lib) lowPrio;
     python = python34;
   };
 
   python32Packages = import ./python-packages.nix {
     inherit pkgs;
-    inherit (lib) lowPrio;
     python = python32;
   };
 
   python27Packages = recurseIntoAttrs (import ./python-packages.nix {
     inherit pkgs;
-    inherit (lib) lowPrio;
     python = python27;
   });
 
   pypyPackages = recurseIntoAttrs (import ./python-packages.nix {
     inherit pkgs;
-    inherit (lib) lowPrio;
     python = pypy;
   });
 
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 450e2c01e44b..927c1483c432 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -1,24 +1,38 @@
-{ pkgs, python, lowPrio }:
+{ pkgs, python }:
+  with pkgs.lib;
 
 let
-isPy26 = python.majorVersion == "2.6";
-isPy27 = python.majorVersion == "2.7";
-optional = pkgs.lib.optional;
-optionals = pkgs.lib.optionals;
-modules = python.modules or { readline = null; sqlite3 = null; curses = null; curses_panel = null; ssl = null; crypt = null; };
+  isPy26 = python.majorVersion == "2.6";
+  isPy27 = python.majorVersion == "2.7";
+  isPy33 = python.majorVersion == "3.3";
+  isPy34 = python.majorVersion == "3.4";
+  isPyPy = python.executable == "pypy";
+
+  # Unique python version identifier
+  pythonName =
+    if isPy26 then "python26" else
+    if isPy27 then "python27" else
+    if isPy33 then "python33" else
+    if isPy34 then "python34" else
+    if isPyPy then "pypy" else "";
+
+  modules = python.modules or { readline = null; sqlite3 = null; curses = null; curses_panel = null; ssl = null; crypt = null; };
 
 pythonPackages = modules // import ./python-packages-generated.nix {
   inherit pkgs python;
   inherit (pkgs) stdenv fetchurl;
   self = pythonPackages;
-} // rec {
+} //
 
-  inherit python;
-  inherit (pkgs) fetchurl fetchsvn fetchgit stdenv;
+# Python packages for all python versions
+rec {
+
+  inherit python isPy26 isPy27 isPy33 isPy34 isPyPy pythonName;
+  inherit (pkgs) fetchurl fetchsvn fetchgit stdenv unzip;
 
   # helpers
 
-  callPackage = pkgs.lib.callPackageWith (pkgs // pythonPackages);
+  callPackage = callPackageWith (pkgs // pythonPackages);
 
   # global distutils config used by buildPythonPackage
   distutils-cfg = callPackage ../development/python-modules/distutils-cfg { };
@@ -256,7 +270,6 @@ pythonPackages = modules // import ./python-packages-generated.nix {
 
     buildInputs = [
       pkgs.which
-      pkgs.unzip
       pythonPackages.coverage
       pythonPackages.mock
       pythonPackages.tissue
@@ -376,7 +389,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
       sha1 = "fa4aec08e59fa5964197f59ba42408d64031675b";
     };
 
-    buildInputs = [ pkgs.unzip pkgs.sqlite ];
+    buildInputs = [ pkgs.sqlite ];
 
     # python: double free or corruption (fasttop): 0x0000000002fd4660 ***
     doCheck = false;
@@ -426,8 +439,6 @@ pythonPackages = modules // import ./python-packages-generated.nix {
       sha256 = "192174mys40m0bwk6l5jlfnzps0xi81sxm34cqms6dc3c454pbyx";
     };
 
-    buildInputs = [ pkgs.unzip ];
-
     # error: invalid command 'test'
     doCheck = false;
 
@@ -557,7 +568,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
     meta = {
       homepage = http://beets.radbox.org;
       description = "Music tagger and library organizer";
-      license = pkgs.lib.licenses.mit;
+      license = licenses.mit;
       maintainers = [ stdenv.lib.maintainers.iElectric ];
     };
   };
@@ -578,7 +589,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
     meta = {
       homepage = https://github.com/Sheeprider/BitBucket-api;
       description = "Python library to interact with BitBucket REST API";
-      license = pkgs.lib.licenses.mit;
+      license = licenses.mit;
     };
   };
 
@@ -591,8 +602,6 @@ pythonPackages = modules // import ./python-packages-generated.nix {
       sha256 = "1i1p3rkj4ad108f23xyib34r4rcy571gy65paml6fk77knh0k66p";
     };
 
-    buildInputs = [ pkgs.unzip ];
-
     # error: invalid command 'test'
     doCheck = false;
 
@@ -772,7 +781,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
    meta = {
       homepage = "http://www.buildout.org";
       description = "A software build and configuration system";
-      license = pkgs.lib.licenses.zpt21;
+      license = licenses.zpt21;
       maintainers = [ stdenv.lib.maintainers.garbas ];
     };
   };
@@ -787,7 +796,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
    meta = {
       homepage = "http://www.buildout.org";
       description = "A software build and configuration system";
-      license = pkgs.lib.licenses.zpt21;
+      license = licenses.zpt21;
       maintainers = [ stdenv.lib.maintainers.garbas ];
     };
   };
@@ -808,7 +817,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
    meta = {
       homepage = "http://www.buildout.org";
       description = "A software build and configuration system";
-      license = pkgs.lib.licenses.zpt21;
+      license = licenses.zpt21;
       maintainers = [ stdenv.lib.maintainers.garbas ];
     };
   };
@@ -986,7 +995,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
     meta = {
       description = "Simple, lightweight, and easily extensible STOMP message broker";
       homepage = http://code.google.com/p/coilmq/;
-      license = pkgs.lib.licenses.asl20;
+      license = licenses.asl20;
     };
   });
 
@@ -1028,7 +1037,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
     meta = {
       description = "Autogenerate Colander schemas based on SQLAlchemy models.";
       homepage = https://github.com/stefanofontanelli/ColanderAlchemy;
-      license = pkgs.lib.licenses.mit;
+      license = licenses.mit;
     };
   };
 
@@ -1047,7 +1056,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
     meta = {
       description = "Config file reading, writing and validation.";
       homepage = http://pypi.python.org/pypi/configobj;
-      license = pkgs.lib.licenses.bsd3;
+      license = licenses.bsd3;
       maintainers = [ stdenv.lib.maintainers.garbas ];
     };
   });
@@ -1107,7 +1116,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
     meta = {
       description = "Code coverage measurement for python";
       homepage = http://nedbatchelder.com/code/coverage/;
-      license = pkgs.lib.licenses.bsd3;
+      license = licenses.bsd3;
     };
   };
 
@@ -1284,7 +1293,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
       md5 = "9c0b8efe9d43b460f8cf049fa46ce14d";
     };
 
-    buildInputs = [ pkgs.unzip pytest ];
+    buildInputs = [ pytest ];
     propagatedBuildInputs = [ execnet ];
 
     meta = {
@@ -1311,7 +1320,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
       sha256 = "139yfm9yz9k33kgqw4khsljs10rkhhxyywbq9i82bh2r31cil1pp";
     };
 
-    buildInputs = [ pkgs.unzip pythonPackages.mock ];
+    buildInputs = [ pythonPackages.mock ];
 
     # couple of failing tests
     doCheck = false;
@@ -1564,8 +1573,6 @@ pythonPackages = modules // import ./python-packages-generated.nix {
       md5 = "be885ccd9612966bb81839670d2da099";
     };
 
-    buildInputs = [ pkgs.unzip ];
-
     meta = {
       description = "rapid multi-Python deployment";
       license = stdenv.lib.licenses.gpl2;
@@ -1933,7 +1940,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
       md5 = "a6728117cad24749ddb39d2827cd9033";
     };
 
-    buildInputs = [ pkgs.unzip webtest ];
+    buildInputs = [ webtest ];
     propagatedBuildInputs = [ jinja2 pyramid ];
 
     meta = {
@@ -2068,7 +2075,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
       md5 = "36aa2c96dec4cfeea57f54da2b733eb9";
     };
 
-    buildInputs = [ pkgs.unzip zope_interface zope_location zope_schema ];
+    buildInputs = [ zope_interface zope_location zope_schema ];
 
     meta = {
       maintainers = [ stdenv.lib.maintainers.iElectric ];
@@ -2745,7 +2752,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
     meta = {
       description = "code checking using pep8 and pyflakes.";
       homepage = http://pypi.python.org/pypi/flake8;
-      license = pkgs.lib.licenses.mit;
+      license = licenses.mit;
       maintainers = [ stdenv.lib.maintainers.garbas ];
     };
   });
@@ -3223,7 +3230,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
     meta = {
       homepage = http://code.google.com/p/httplib2;
       description = "A comprehensive HTTP client library";
-      license = pkgs.lib.licenses.mit;
+      license = licenses.mit;
       maintainers = [ stdenv.lib.maintainers.garbas ];
     };
   };
@@ -3285,7 +3292,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
     meta = {
       description = "Google's IP address manipulation library";
       homepage = http://code.google.com/p/ipaddr-py/;
-      license = pkgs.lib.licenses.asl20;
+      license = licenses.asl20;
     };
   };
 
@@ -3319,7 +3326,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
     meta = {
       homepage = "https://github.com/davidhalter/jedi";
       description = "An autocompletion tool for Python that can be used for text editors.";
-      license = pkgs.lib.licenses.lgpl3Plus;
+      license = licenses.lgpl3Plus;
       maintainers = [ stdenv.lib.maintainers.garbas ];
     };
   });
@@ -3381,7 +3388,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
     };
 
     buildInputs =
-      [ pkgs.unzip fs gdata python_keyczar mock pyasn1 pycrypto pytest ];
+      [ fs gdata python_keyczar mock pyasn1 pycrypto pytest ];
   };
 
   kitchen = buildPythonPackage (rec {
@@ -3409,7 +3416,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
     meta = {
       homepage = http://code.google.com/p/pylast/;
       description = "A python interface to last.fm (and compatibles)";
-      license = pkgs.lib.licenses.asl20;
+      license = licenses.asl20;
     };
   };
 
@@ -3694,7 +3701,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
     meta = {
       description = "McCabe checker, plugin for flake8";
       homepage = "https://github.com/flintwork/mccabe";
-      license = pkgs.lib.licenses.mit;
+      license = licenses.mit;
       maintainers = [ stdenv.lib.maintainers.garbas ];
     };
   });
@@ -3797,7 +3804,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
       version = "0.9";
       description = ''Man-in-the-middle proxy'';
       homepage = "http://mitmproxy.org/";
-      license = pkgs.lib.licenses.mit;
+      license = licenses.mit;
     };
   };
 
@@ -3875,8 +3882,6 @@ pythonPackages = modules // import ./python-packages-generated.nix {
       export LC_ALL="en_US.UTF-8"
     '';
 
-    buildInputs = [ pkgs.unzip ];
-
     propagatedBuildInputs = [ argparse jinja2 six modules.readline ] ++
                             (optionals isPy26 [ importlib ordereddict ]);
 
@@ -3901,7 +3906,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
     meta = {
       homepage = http://bmc.github.com/munkres/;
       description = "Munkres algorithm for the Assignment Problem";
-      license = pkgs.lib.licenses.bsd3;
+      license = licenses.bsd3;
       maintainers = [ stdenv.lib.maintainers.iElectric ];
     };
   };
@@ -3918,7 +3923,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
     meta = {
       homepage = http://alastair/python-musicbrainz-ngs;
       description = "Python bindings for musicbrainz NGS webservice";
-      license = pkgs.lib.licenses.bsd2;
+      license = licenses.bsd2;
       maintainers = [ stdenv.lib.maintainers.iElectric ];
     };
   };
@@ -4087,7 +4092,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
       version = "0.9";
       description = ''Man-in-the-middle proxy'';
       homepage = "https://github.com/cortesi/netlib";
-      license = pkgs.lib.licenses.mit;
+      license = licenses.mit;
     };
   };
 
@@ -4165,7 +4170,6 @@ pythonPackages = modules // import ./python-packages-generated.nix {
       sha256 = "0lgrfgp3sq8xi8d9grrg0z8jsyk0wl8a3rxw31hb7vdncin5b7n5";
     };
 
-    buildInputs = [ pkgs.unzip ];
     propagatedBuildInputs = [ nose ];
 
     meta = {
@@ -4233,7 +4237,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
       sha256 = "1kh4spwgqxm534qlzzf2ijchckvs0pwjxl1irhicjmlg7mybnfvx";
     };
 
-    patches = pkgs.lib.singleton (fetchurl {
+    patches = singleton (fetchurl {
       name = "libnotify07.patch";
       url = "http://pkgs.fedoraproject.org/cgit/notify-python.git/plain/"
           + "libnotify07.patch?id2=289573d50ae4838a1658d573d2c9f4c75e86db0c";
@@ -4346,7 +4350,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
     meta = {
       homepage = "https://github.com/simplegeo/python-oauth2";
       description = "library for OAuth version 1.0";
-      license = pkgs.lib.licenses.mit;
+      license = licenses.mit;
       maintainers = [ stdenv.lib.maintainers.garbas ];
       platforms = stdenv.lib.platforms.linux;
     };
@@ -4611,7 +4615,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
     meta = {
       homepage = "http://pep8.readthedocs.org/";
       description = "Python style guide checker";
-      license = pkgs.lib.licenses.mit;
+      license = licenses.mit;
       maintainers = [ stdenv.lib.maintainers.garbas ];
     };
   };
@@ -4660,8 +4664,6 @@ pythonPackages = modules // import ./python-packages-generated.nix {
       sha256 = "0kdc4rg47k1qkq22inghd50xlxjdkfcilym8mxff8wy4h091xykw";
     };
 
-    buildInputs = [ pkgs.unzip ];
-
     propagatedBuildInputs = [ pytz ];
 
     meta = {
@@ -4704,7 +4706,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
       md5 = "56b6614499aacb7d6b5983c4914daea7";
     };
 
-    buildInputs = [ pkgs.freetype pkgs.libjpeg pkgs.unzip pkgs.zlib pkgs.libtiff pkgs.libwebp ];
+    buildInputs = [ pkgs.freetype pkgs.libjpeg pkgs.zlib pkgs.libtiff pkgs.libwebp ];
 
     # NOTE: we use LCMS_ROOT as WEBP root since there is not other setting for webp.
     preConfigure = ''
@@ -4763,7 +4765,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
     meta = {
       description = "A library to manipulate gettext files (po and mo files)";
       homepage = "http://bitbucket.org/izi/polib/";
-      license = pkgs.lib.licenses.mit;
+      license = licenses.mit;
     };
   };
 
@@ -4887,7 +4889,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
     meta = {
       description = "Allows to get the public suffix of a domain name";
       homepage = "http://pypi.python.org/pypi/publicsuffix/";
-      license = pkgs.lib.licenses.mit;
+      license = licenses.mit;
     };
   };
 
@@ -5140,7 +5142,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
     meta = {
       homepage = "https://launchpad.net/pyflakes";
       description = "A simple program which checks Python source files for errors.";
-      license = pkgs.lib.licenses.mit;
+      license = licenses.mit;
       maintainers = [ stdenv.lib.maintainers.garbas ];
     };
   };
@@ -5155,7 +5157,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
 
     patchPhase = let
       libs = [ pkgs.mesa pkgs.xlibs.libX11 pkgs.freetype pkgs.fontconfig ];
-      paths = pkgs.lib.concatStringsSep "," (map (l: "\"${l}/lib\"") libs);
+      paths = concatStringsSep "," (map (l: "\"${l}/lib\"") libs);
     in "sed -i -e 's|directories\.extend.*lib[^]]*|&,${paths}|' pyglet/lib.py";
 
     doCheck = false;
@@ -5200,7 +5202,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
     meta = {
       homepage = "https://launchpad.net/pygpgme";
       description = "A Python wrapper for the GPGME library.";
-      license = pkgs.lib.licenses.lgpl21;
+      license = licenses.lgpl21;
       maintainers = [ stdenv.lib.maintainers.garbas ];
     };
   };
@@ -5225,7 +5227,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
     meta = {
       homepage = https://github.com/seb-m/pyinotify/wiki;
       description = "Monitor filesystems events on Linux platforms with inotify";
-      license = pkgs.lib.licenses.mit;
+      license = licenses.mit;
     };
   };
 
@@ -5255,7 +5257,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
     meta = {
       homepage = "http://fedoraproject.org/wiki/Pykickstart";
       description = "Read and write Fedora kickstart files";
-      license = pkgs.lib.licenses.gpl2Plus;
+      license = licenses.gpl2Plus;
     };
   };
 
@@ -5268,7 +5270,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
       sha256 = "0ldkm8xws91j7zbvpqb413hvdz8r66bslr451q3qc0xi8cnmydfq";
     };
 
-    buildInputs = [ pkgs.unzip pkgs.libiodbc ];
+    buildInputs = [ pkgs.libiodbc ];
 
     meta = with stdenv.lib; {
       description = "Python ODBC module to connect to almost any database";
@@ -5312,7 +5314,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
       sed -i -e '
         s|e\.path\.startswith("/tmp/temp-device-")|"temp-device-" in e.path|
       ' tests/test__ped_ped.py
-    '' + pkgs.lib.optionalString stdenv.isi686 ''
+    '' + optionalString stdenv.isi686 ''
       # remove some integers in this test case which overflow on 32bit systems
       sed -i -r -e '/class *UnitGetSizeTestCase/,/^$/{/[0-9]{11}/d}' \
         tests/test__ped_ped.py
@@ -5606,7 +5608,6 @@ pythonPackages = modules // import ./python-packages-generated.nix {
       md5 = "c57cba33626ac4b1e3d1974923d59232";
     };
 
-    buildInputs = [ pkgs.unzip ];
     meta = {
       homepage    = "https://code.google.com/p/pysphere/";
       license     = "BSD";
@@ -5811,7 +5812,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
       sha256 = "1r127fa354ppb667f4acxlzwxixap1jgzjrr790bw8mcpxv2hqaa";
     };
 
-    buildInputs = [ pkgs.unzip pkgs.pyrex ];
+    buildInputs = [ pkgs.pyrex ];
     propagatedBuildInputs = [ pkgs.libyaml ];
 
     meta = {
@@ -5838,7 +5839,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
 
 
   reportlab =
-   let freetype = pkgs.lib.overrideDerivation pkgs.freetype (args: { configureFlags = "--enable-static --enable-shared"; });
+   let freetype = overrideDerivation pkgs.freetype (args: { configureFlags = "--enable-static --enable-shared"; });
    in buildPythonPackage rec {
     name = "reportlab-2.5";
 
@@ -6044,7 +6045,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
     # error: invalid command 'test'
     #doCheck = false;
 
-    buildInputs = [ unittest2 pkgs.unzip ];
+    buildInputs = [ unittest2 ];
     propagatedBuildInputs = [ robotframework lxml ];
 
     meta = with stdenv.lib; {
@@ -6636,7 +6637,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
     meta = {
       description = "Joyent SmartDataCenter CloudAPI connector using http-signature authentication via Requests";
       homepage = https://github.com/atl/py-smartdc;
-      license = pkgs.lib.licenses.mit;
+      license = licenses.mit;
     };
   };
 
@@ -6822,7 +6823,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
     meta = {
       homepage = https://github.com/crosspop/sqlalchemy-imageattach;
       description = "SQLAlchemy extension for attaching images to entity objects";
-      license = pkgs.lib.licenses.mit;
+      license = licenses.mit;
     };
   };
 
@@ -6868,7 +6869,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
     meta = {
       description = "A client for Etsy's node-js statsd server";
       homepage = https://github.com/WoLpH/python-statsd;
-      license = pkgs.lib.licenses.bsd3;
+      license = licenses.bsd3;
     };
   };
 
@@ -6888,7 +6889,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
     meta = {
       description = "Lightweight and extensible STOMP messaging client";
       homepage = http://bitbucket.org/hozn/stompclient;
-      license = pkgs.lib.licenses.asl20;
+      license = licenses.asl20;
     };
   });
 
@@ -6907,7 +6908,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
     meta = {
       description = "A streaming protocol for test results";
       homepage = https://launchpad.net/subunit;
-      license = pkgs.lib.licenses.asl20;
+      license = licenses.asl20;
     };
   };
 
@@ -7025,7 +7026,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
     meta = {
       description = "A set of extensions to the Python standard library's unit testing framework";
       homepage = http://pypi.python.org/pypi/testtools;
-      license = pkgs.lib.licenses.mit;
+      license = licenses.mit;
     };
   };
 
@@ -7045,7 +7046,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
     meta = {
       description = "A module provides basic functions for parsing mime-type names and matching them against a list of media-ranges.";
       homepage = https://code.google.com/p/mimeparse/;
-      license = pkgs.lib.licenses.mit;
+      license = licenses.mit;
     };
   };
 
@@ -7065,7 +7066,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
     meta = {
       description = "A module provides basic functions for parsing mime-type names and matching them against a list of media-ranges.";
       homepage = https://code.google.com/p/mimeparse/;
-      license = pkgs.lib.licenses.mit;
+      license = licenses.mit;
     };
   };
 
@@ -7176,7 +7177,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
     meta = {
       homepage = "https://github.com/alejandrogomez/turses";
       description = "A Twitter client for the console.";
-      license = pkgs.lib.licenses.gpl3;
+      license = licenses.gpl3;
       maintainers = [ stdenv.lib.maintainers.garbas ];
       platforms = stdenv.lib.platforms.linux;
     };
@@ -7193,7 +7194,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
     meta = {
       homepage = "https://github.com/tweepy/tweepy";
       description = "Twitter library for python";
-      license = pkgs.lib.licenses.mit;
+      license = licenses.mit;
       maintainers = [ stdenv.lib.maintainers.garbas ];
       platforms = stdenv.lib.platforms.linux;
     };
@@ -7227,7 +7228,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
         and licensed under the MIT license.
       '';
 
-      license = pkgs.lib.licenses.mit;
+      license = licenses.mit;
 
       maintainers = [ ];
     };
@@ -7296,7 +7297,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
       description = "A full-featured console (xterm et al.) user interface library";
       homepage = http://excess.org/urwid;
       repositories.git = git://github.com/wardi/urwid.git;
-      license = pkgs.lib.licenses.lgpl21;
+      license = licenses.lgpl21;
       maintainers = [ stdenv.lib.maintainers.garbas ];
     };
   });
@@ -7455,7 +7456,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
     # XXX: skipping two tests fails in python2.6
     doCheck = ! isPy26;
 
-    buildInputs = [ pkgs.unzip ] ++ optionals isPy26 [ pythonPackages.ordereddict unittest2 ];
+    buildInputs = optionals isPy26 [ pythonPackages.ordereddict unittest2 ];
 
     propagatedBuildInputs = [
       nose
@@ -7496,7 +7497,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
 
   wokkel = buildPythonPackage (rec {
     url = "http://wokkel.ik.nu/releases/0.7.0/wokkel-0.7.0.tar.gz";
-    name = pkgs.lib.nameFromURL url ".tar";
+    name = nameFromURL url ".tar";
     src = fetchurl {
       inherit url;
       sha256 = "0rnshrzw8605x05mpd8ndrx3ri8h6cx713mp8sl4f04f4gcrz8ml";
@@ -7719,7 +7720,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
       md5 = "eff24d7918099a3e899ee63a9c31bee6";
     };
 
-    buildInputs = [ pkgs.unzip zope_interface ];
+    buildInputs = [ zope_interface ];
 
     meta = {
         maintainers = [ stdenv.lib.maintainers.goibhniu ];
@@ -7735,8 +7736,6 @@ pythonPackages = modules // import ./python-packages-generated.nix {
       md5 = "4ff0ddbf64c45bfcc3189e35f4214ded";
     };
 
-    buildInputs = [ pkgs.unzip ];
-
     propagatedBuildInputs = [ zope_interface ];
 
     meta = {
@@ -7811,8 +7810,6 @@ pythonPackages = modules // import ./python-packages-generated.nix {
       md5 = "c6ac80e6887de4108a383f349fbdf332";
     };
 
-    buildInputs = [ pkgs.unzip ];
-
     meta = {
         maintainers = [ stdenv.lib.maintainers.goibhniu ];
     };
@@ -8048,7 +8045,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
       md5 = "8b317b41244fc2e67f2f286890ba59a0";
     };
 
-    buildInputs = [ pkgs.unzip sqlalchemy zope_testing zope_interface setuptools ];
+    buildInputs = [ sqlalchemy zope_testing zope_interface setuptools ];
     propagatedBuildInputs = [ sqlalchemy transaction ];
 
     meta = {
@@ -8070,7 +8067,6 @@ pythonPackages = modules // import ./python-packages-generated.nix {
       md5 = "01c30c342c6a18002a762bd5d320a6e9";
     };
 
-    buildInputs = [ pkgs.unzip ];
     propagatedBuildInputs = [ zope_interface zope_exceptions zope_location ];
 
     meta = {
@@ -8091,8 +8087,6 @@ pythonPackages = modules // import ./python-packages-generated.nix {
       md5 = "1d689abad000419891494b30dd7d8190";
     };
 
-    buildInputs = [ pkgs.unzip ];
-
     propagatedBuildInputs = [ zope_interface zope_exceptions zope_testing six ] ++ optional (!python.is_py3k or false) subunit;
 
     # a test is failing
@@ -8115,8 +8109,6 @@ pythonPackages = modules // import ./python-packages-generated.nix {
       md5 = "eaad8fc7bbef126f9f8616b074ec00aa";
     };
 
-    buildInputs = [ pkgs.unzip ];
-
     propagatedBuildInputs = [ zope_location zope_security zope_publisher ];
 
     meta = {
@@ -8205,7 +8197,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
       sha256 = "0ri6gj883k042xaxa2d5ymmhbw2bfcxdzhh4bz7700ibxwxxj62h";
     };
 
-    buildInputs = [ pkgs.unzip unittest2 nose mock ];
+    buildInputs = [ unittest2 nose mock ];
     propagatedBuildInputs = [ modules.curses libarchive ];
 
     # tests are still failing
@@ -8232,7 +8224,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
       url = "http://pypi.python.org/packages/source/p/pyzmq/pyzmq-13.0.0.zip";
       md5 = "fa2199022e54a393052d380c6e1a0934";
     };
-    buildInputs = [ pkgs.unzip pkgs.zeromq3 ];
+    buildInputs = [ pkgs.zeromq3 ];
     propagatedBuildInputs = [  ];
     doCheck = false;
   };
@@ -8415,7 +8407,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
     meta = {
       homepage = http://pypi.python.org/pypi/Unidecode/;
       description = "ASCII transliterations of Unicode text";
-      license = pkgs.lib.licenses.gpl2;
+      license = licenses.gpl2;
       maintainers = [ stdenv.lib.maintainers.iElectric ];
     };
   };
@@ -8577,7 +8569,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
     meta = {
       homepage = https://code.google.com/p/gdata-python-client/;
       description = "Python client library for Google data APIs";
-      license = pkgs.lib.licenses.asl20;
+      license = licenses.asl20;
     };
   };
 
@@ -8597,7 +8589,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
     meta = {
       homepage = http://imapclient.freshfoo.com/;
       description = "Easy-to-use, Pythonic and complete IMAP client library";
-      license = pkgs.lib.licenses.bsd3;
+      license = licenses.bsd3;
     };
   };
 
@@ -8614,7 +8606,7 @@ pythonPackages = modules // import ./python-packages-generated.nix {
     meta = {
       homepage = http://pythonhosted.org/Logbook/;
       description = "A logging replacement for Python";
-      license = pkgs.lib.licenses.bsd3;
+      license = licenses.bsd3;
     };
   };
 
@@ -8711,8 +8703,11 @@ pythonPackages = modules // import ./python-packages-generated.nix {
     };
   };
 
-# python2.7 specific eggs
-} // pkgs.lib.optionalAttrs (python.majorVersion == "2.7") {
+# python2.7 specific packages
+} // optionalAttrs isPy27 (
+  with pythonPackages;
+
+{
 
   pypi2nix = pythonPackages.buildPythonPackage rec {
     rev = "04a68d8577acbceb88bdf51b1231a9dbdead7003";
@@ -8733,4 +8728,4 @@ pythonPackages = modules // import ./python-packages-generated.nix {
     };
   };
 
-}; in pythonPackages
+}); in pythonPackages