anchor.diff:  
     enableParallelBuilding = true;
   
  -  nativeBuildInputs = [ pkgconfig qmake removeReferencesTo wrapGAppsHook ];
  +  nativeBuildInputs = [ pkgconfig qmake removeReferencesTo ];
  +
  +  CALIBRE_PY3_PORT = builtins.toString pypkgs.isPy3k;
   
     buildInputs = [
       poppler_utils libpng imagemagick libjpeg
       fontconfig podofo qtbase chmlib icu sqlite libusb1 libmtp xdg_utils
  -  ] ++ (with python2Packages; [
  -    apsw cssselect css-parser dateutil dnspython html5-parser lxml mechanize netifaces pillow
  +  ] ++ (with pypkgs; [
  +    apsw cssselect css-parser dateutil dnspython html5-parser lxml netifaces pillow
       python pyqt5_with_qtwebkit sip
  -    regex msgpack beautifulsoup4
  +    regex msgpack beautifulsoup4 html2text
       # the following are distributed with calibre, but we use upstream instead
       odfpy
  +  ]) ++ lib.optionals (!pypkgs.isPy3k) (with pypkgs; [
  +    mechanize
     ]);
   
     installPhase = ''
  
positive.code:     # - switches the version update from enabled to disabled by default
      ./no_updates_dialog.patch
      # the unrar patch is not from debian
    ] ++ stdenv.lib.optional (!unrarSupport) ./dont_build_unrar_plugin.patch;
  
    prePatch = ''
      sed -i "/pyqt_sip_dir/ s:=.*:= '${python2Packages.pyqt5_with_qtwebkit}/share/sip/PyQt5':"  \
        setup/build_environment.py
  
      # Remove unneeded files and libs
  
negative.code:     export FC_LIB_DIR=${fontconfig.lib}/lib
      export PODOFO_INC_DIR=${podofo.dev}/include/podofo
      export PODOFO_LIB_DIR=${podofo.lib}/lib
      export SIP_BIN=${pypkgs.sip}/bin/sip
      ${pypkgs.python.interpreter} setup.py install --prefix=$out
  
      PYFILES="$out/bin/* $out/lib/calibre/calibre/web/feeds/*.py
        $out/lib/calibre/calibre/ebooks/metadata/*.py
  