From a4473b8205a3f3c980c06e3c7210c2764f4577b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= Date: Thu, 7 Jan 2010 22:47:30 +0000 Subject: [PATCH] Adding calibre. This involved also: - Adding podofo - Adding some new python packages - Making new pkgs attributes for python packages to build with python 2.6 - Updating some python packages expressions to allow python 2.6, and not only 2.5. svn path=/nixpkgs/trunk/; revision=19303 --- pkgs/applications/misc/calibre/default.nix | 44 ++++++++++++++++ pkgs/development/libraries/podofo/default.nix | 12 +++++ .../python-modules/pyqt/default.nix | 2 +- .../python-modules/python-sip/default.nix | 2 +- .../python-modules/setuptools/default.nix | 6 +-- pkgs/top-level/all-packages.nix | 52 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 38 +++++++++++++- 7 files changed, 149 insertions(+), 7 deletions(-) create mode 100644 pkgs/applications/misc/calibre/default.nix create mode 100644 pkgs/development/libraries/podofo/default.nix diff --git a/pkgs/applications/misc/calibre/default.nix b/pkgs/applications/misc/calibre/default.nix new file mode 100644 index 000000000000..4091bccd5e34 --- /dev/null +++ b/pkgs/applications/misc/calibre/default.nix @@ -0,0 +1,44 @@ +{stdenv, fetchurl, python, pyqt4, sip, popplerQt4, pkgconfig, libpng, +imagemagick, libjpeg, fontconfig, podofo, qt4, mechanize, lxml, dateutil, +pil, makeWrapper, unrar}: + +stdenv.mkDerivation rec { + name = "calibre-0.6.29"; + + src = fetchurl { + url = "mirror://sourceforge/calibre/${name}.tar.gz"; + sha256 = "1k3ady2ichig6x3k6w0fhvpbklk6jfzpmqn2wv8d8dqkkpm5vrvm"; + }; + + inherit python; + + buildInputs = [ python pyqt4 sip popplerQt4 pkgconfig libpng imagemagick + libjpeg fontconfig podofo qt4 mechanize lxml dateutil pil makeWrapper ]; + + installPhase = '' + export POPPLER_INC_DIR=${popplerQt4}/include/poppler + export POPPLER_LIB_DIR=${popplerQt4}/lib + export MAGICK_INC=${imagemagick}/include/ImageMagick + export MAGICK_LIB=${imagemagick}/lib + export FC_INC_DIR=${fontconfig}/include/fontconfig + export FC_LIB_DIR=${fontconfig}/lib + export PODOFO_INC_DIR=${podofo}/include/podofo + export PODOFO_LIB_DIR=${podofo}/lib + python setup.py install --prefix=$out + + PYFILES="$out/bin/* $out/lib/calibre/calibre/web/feeds/*.py + $out/lib/calibre/calibre/ebooks/metadata/*.py + $out/lib/calibre/calibre/ebooks/rtf2xml/*.py" + + sed -i "s/env python/python/" $PYFILES + for a in $out/bin/*; do + wrapProgram $a --prefix PYTHONPATH : $PYTHONPATH --prefix LD_LIBRARY_PATH : ${unrar}/lib + done + ''; + + meta = { + description = "Comprehensive e-book software"; + homepage = http://calibre-ebook.com; + license = "GPLv3"; + }; +} diff --git a/pkgs/development/libraries/podofo/default.nix b/pkgs/development/libraries/podofo/default.nix new file mode 100644 index 000000000000..270d4da23deb --- /dev/null +++ b/pkgs/development/libraries/podofo/default.nix @@ -0,0 +1,12 @@ +{stdenv, fetchurl, cmake, zlib, freetype, libjpeg, libtiff, fontconfig, +openssl}: + +stdenv.mkDerivation rec { + name = "podofo-0.7.0"; + src = fetchurl { + url = "mirror://sourceforge/podofo/${name}.tar.gz"; + sha256 = "1hpd5ldjv013041rmcfrkbk8v6wdpxcg60i3aklik583q2rf0mqy"; + }; + buildInputs = [ cmake zlib freetype libjpeg libtiff fontconfig openssl ]; + cmakeFlags = "-DPODOFO_BUILD_SHARED=ON -DPODOFO_BUILD_STATIC=OFF"; +} diff --git a/pkgs/development/python-modules/pyqt/default.nix b/pkgs/development/python-modules/pyqt/default.nix index 207e727b4370..f2c72f0ff277 100644 --- a/pkgs/development/python-modules/pyqt/default.nix +++ b/pkgs/development/python-modules/pyqt/default.nix @@ -6,7 +6,7 @@ stdenv.mkDerivation { url = http://pyqwt.sourceforge.net/support/PyQt-x11-gpl-4.5.4.tar.gz; # Not downloading from riverbank, since they remove older releases sha256 = "1a55zng6yhnbk5swc02bkbyccdgf0f0v94yxk9v5a43hv9xnrl5k"; }; - configurePhase = "python ./configure.py --confirm-license -b $out/bin -d $out/lib/python2.5/site-packages -v $out/share/sip -p $out/plugins"; + configurePhase = "python ./configure.py --confirm-license -b $out/bin -d $out/lib/${python.libPrefix}/site-packages -v $out/share/sip -p $out/plugins"; buildInputs = [ python sip qt4 ]; meta = { description = "Python bindings for Qt"; diff --git a/pkgs/development/python-modules/python-sip/default.nix b/pkgs/development/python-modules/python-sip/default.nix index 47398e2a2841..bd08b7e6a248 100644 --- a/pkgs/development/python-modules/python-sip/default.nix +++ b/pkgs/development/python-modules/python-sip/default.nix @@ -6,7 +6,7 @@ stdenv.mkDerivation { url = http://pyqwt.sourceforge.net/support/sip-4.8.2.tar.gz; # Not downloading from riverbank, since they remove older releases sha256 = "1afr2qaibzgf8fq4fmc31jz9hvbwxbg5jvl68ygvkkdvnbg2kfrf"; }; - configurePhase = "python ./configure.py -d $out/lib/python2.5/site-packages -b $out/bin -e $out/include"; + configurePhase = "python ./configure.py -d $out/lib/${python.libPrefix}/site-packages -b $out/bin -e $out/include"; buildInputs = [ python ]; meta = { description = "Creates C++ bindings for Python modules"; diff --git a/pkgs/development/python-modules/setuptools/default.nix b/pkgs/development/python-modules/setuptools/default.nix index df6d466b138d..1cdbb2e26245 100644 --- a/pkgs/development/python-modules/setuptools/default.nix +++ b/pkgs/development/python-modules/setuptools/default.nix @@ -29,16 +29,16 @@ rec { '') ["addInputs" "doUnpack"]; doInstall = a.fullDepEntry('' - ensureDir "$out/lib/python2.5/site-packages" + ensureDir "$out/lib/${a.python.libPrefix}/site-packages" - PYTHONPATH="$out/lib/python2.5/site-packages:$PYTHONPATH" \ + PYTHONPATH="$out/lib/${a.python.libPrefix}/site-packages:$PYTHONPATH" \ python setup.py install --prefix="$out" for i in "$out/bin/"* do wrapProgram "$i" \ --prefix PYTHONPATH ":" \ - "$out/lib/python2.5/site-packages" + "$out/lib/${a.python.libPrefix}/site-packages" done '') ["doBuild"]; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 81305572a865..bb05a1c1302d 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2373,6 +2373,7 @@ let python = if getConfig ["python" "full"] false then pythonFull else pythonBase; python25 = if getConfig ["python" "full"] false then python25Full else python25Base; + python26 = if getConfig ["python" "full"] false then python26Full else python26Base; pythonBase = python25Base; pythonFull = python25Full; @@ -4353,6 +4354,11 @@ let inherit (xlibs) libXi libSM libXmu libXext libX11; }; + podofo = import ../development/libraries/podofo { + inherit fetchurl stdenv cmake zlib freetype libjpeg libtiff + fontconfig openssl; + }; + polkit = import ../development/libraries/polkit { inherit stdenv fetchurl pkgconfig eggdbus expat pam intltool gettext glib; }; @@ -4831,8 +4837,21 @@ let inherit python setuptools makeWrapper lib; }; + buildPython26Package = + import ../development/python-modules/generic { + inherit makeWrapper lib; + python = python26; + setuptools = setuptools_python26; + }; + pythonPackages = recurseIntoAttrs (import ./python-packages.nix { + inherit pkgs python buildPythonPackage; + }); + + python26Packages = recurseIntoAttrs (import ./python-packages.nix { inherit pkgs; + python = python26; + buildPythonPackage = buildPython26Package; }); foursuite = import ../development/python-modules/4suite { @@ -4857,6 +4876,11 @@ let inherit fetchurl stdenv python zlib libjpeg freetype; }; + pil_python26 = import ../development/python-modules/pil { + inherit fetchurl stdenv zlib libjpeg freetype; + python = python26; + }; + psyco = import ../development/python-modules/psyco { inherit fetchurl stdenv python; }; @@ -4913,6 +4937,11 @@ let inherit stdenv fetchurl lib python; }; + sip_python26 = import ../development/python-modules/python-sip { + inherit stdenv fetchurl lib; + python = python26; + }; + pyqt = builderDefsPackage (import ../development/python-modules/pyqt/4.3.3.nix) { inherit pkgconfig python pythonSip glib; inherit (xlibs) libX11 libXext; @@ -4924,6 +4953,13 @@ let qt4 = qt45; }; + pyqt4_python26 = import ../development/python-modules/pyqt { + inherit stdenv fetchurl lib; + qt4 = qt45; + python = python26; + sip = sip_python26; + }; + pyx = import ../development/python-modules/pyx { inherit fetchurl stdenv python makeWrapper; }; @@ -4936,6 +4972,11 @@ let inherit python makeWrapper; }; + setuptools_python26 = builderDefsPackage (import ../development/python-modules/setuptools) { + inherit makeWrapper; + python = python26; + }; + wxPython = wxPython26; wxPython26 = import ../development/python-modules/wxPython/2.6.nix { @@ -6325,6 +6366,17 @@ let inherit fetchurl stdenv ncurses; }; + calibre = import ../applications/misc/calibre { + inherit stdenv fetchurl libpng imagemagick pkgconfig libjpeg fontconfig podofo + qt4 makeWrapper unrar; + python = python26Full; + pyqt4 = pyqt4_python26; + sip = sip_python26; + pil = pil_python26; + popplerQt4 = popplerQt45; + inherit (python26Packages) mechanize lxml dateutil; + }; + carrier = builderDefsPackage (import ../applications/networking/instant-messengers/carrier/2.5.0.nix) { inherit fetchurl stdenv pkgconfig perl perlXMLParser libxml2 openssl nss gtkspell aspell gettext ncurses avahi dbus dbus_glib python diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 0dddb832ab77..80db6fb4127b 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1,7 +1,7 @@ -{ pkgs }: +{ pkgs, python, buildPythonPackage }: rec { - inherit (pkgs) buildPythonPackage fetchurl fetchsvn stdenv python; + inherit (pkgs) fetchurl fetchsvn stdenv; argparse = buildPythonPackage (rec { name = "argparse-0.9.1"; @@ -53,6 +53,23 @@ rec { }; }); + dateutil = buildPythonPackage (rec { + name = "python-dateutil-1.4.1"; + + src = fetchurl { + url = "http://pypi.python.org/packages/source/p/python-dateutil/${name}.tar.gz"; + sha256 = "0mrkh932k8s74h4rpgksvpmwbrrkq8zn78gbgwc22i2vlp31bdkl"; + }; + + meta = { + description = "Powerful extensions to the standard datetime module"; + + homepage = http://pypi.python.org/pypi/python-dateutil; + + license = "BSD-style"; + }; + }); + foolscap = buildPythonPackage (rec { name = "foolscap-0.4.2"; @@ -143,6 +160,23 @@ rec { }; }); + mechanize = buildPythonPackage (rec { + name = "mechanize-0.1.11"; + + src = fetchurl { + url = "mirror://sourceforge/wwwsearch/${name}.tar.gz"; + sha256 = "1h62mwy4iz09jqz17nrb9j8y0djd500zdfqwrz9xmdwqzqwixkj2"; + }; + + meta = { + description = "Stateful programmatic web browsing in Python"; + + homepage = http://wwwsearch.sourceforge.net/; + + license = "BSD-style"; + }; + }); + namebench = buildPythonPackage (rec { name = "namebench-1.0.5";