Merge pull request #106550 from eduardosm/calibre

This commit is contained in:
Sandro 2021-01-30 18:49:25 +01:00 committed by GitHub
commit 3d7c3d115e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 54 additions and 17 deletions

View File

@ -1,4 +1,5 @@
{ lib { lib
, stdenv
, mkDerivation , mkDerivation
, fetchurl , fetchurl
, poppler_utils , poppler_utils
@ -16,7 +17,7 @@
, hyphen , hyphen
, unrarSupport ? false , unrarSupport ? false
, chmlib , chmlib
, pythonPackages , python3Packages
, libusb1 , libusb1
, libmtp , libmtp
, xdg_utils , xdg_utils
@ -26,11 +27,11 @@
mkDerivation rec { mkDerivation rec {
pname = "calibre"; pname = "calibre";
version = "4.23.0"; version = "5.10.1";
src = fetchurl { src = fetchurl {
url = "https://download.calibre-ebook.com/${version}/${pname}-${version}.tar.xz"; url = "https://download.calibre-ebook.com/${version}/${pname}-${version}.tar.xz";
sha256 = "sha256-Ft5RRzzw4zb5RqVyUaHk9Pu6H4V/F9j8FKoTLn61lRg="; sha256 = "18pnqxdyvgmw12yarxhvsgs4jk6c5hp05gf8khybcd78330954v9";
}; };
patches = [ patches = [
@ -42,9 +43,20 @@ mkDerivation rec {
# the unrar patch is not from debian # the unrar patch is not from debian
] ++ lib.optional (!unrarSupport) ./dont_build_unrar_plugin.patch; ] ++ lib.optional (!unrarSupport) ./dont_build_unrar_plugin.patch;
escaped_pyqt5_dir = builtins.replaceStrings ["/"] ["\\/"] (toString python3Packages.pyqt5);
platform_tag =
if stdenv.hostPlatform.isDarwin then
"WS_MACX"
else if stdenv.hostPlatform.isWindows then
"WS_WIN"
else
"WS_X11";
prePatch = '' prePatch = ''
sed -i "/pyqt_sip_dir/ s:=.*:= '${pythonPackages.pyqt5}/share/sip/PyQt5':" \ sed -i "s/\[tool.sip.project\]/[tool.sip.project]\nsip-include-dirs = [\"${escaped_pyqt5_dir}\/share\/sip\/PyQt5\"]/g" \
setup/build_environment.py setup/build.py
sed -i "s/\[tool.sip.bindings.pictureflow\]/[tool.sip.bindings.pictureflow]\ntags = [\"${platform_tag}\"]/g" \
setup/build.py
# Remove unneeded files and libs # Remove unneeded files and libs
rm -rf resources/calibre-portable.* \ rm -rf resources/calibre-portable.* \
@ -57,8 +69,6 @@ mkDerivation rec {
nativeBuildInputs = [ pkg-config qmake removeReferencesTo ]; nativeBuildInputs = [ pkg-config qmake removeReferencesTo ];
CALIBRE_PY3_PORT = builtins.toString pythonPackages.isPy3k;
buildInputs = [ buildInputs = [
chmlib chmlib
fontconfig fontconfig
@ -76,7 +86,7 @@ mkDerivation rec {
sqlite sqlite
xdg_utils xdg_utils
] ++ ( ] ++ (
with pythonPackages; [ with python3Packages; [
apsw apsw
beautifulsoup4 beautifulsoup4
css-parser css-parser
@ -92,11 +102,13 @@ mkDerivation rec {
msgpack msgpack
netifaces netifaces
pillow pillow
pyqt-builder
pyqt5 pyqt5
pyqtwebengine pyqtwebengine
python python
regex regex
sip sip_5
zeroconf
# the following are distributed with calibre, but we use upstream instead # the following are distributed with calibre, but we use upstream instead
odfpy odfpy
] ++ lib.optional (unrarSupport) unrardll ] ++ lib.optional (unrarSupport) unrardll
@ -114,11 +126,11 @@ mkDerivation rec {
export FC_LIB_DIR=${fontconfig.lib}/lib export FC_LIB_DIR=${fontconfig.lib}/lib
export PODOFO_INC_DIR=${podofo.dev}/include/podofo export PODOFO_INC_DIR=${podofo.dev}/include/podofo
export PODOFO_LIB_DIR=${podofo.lib}/lib export PODOFO_LIB_DIR=${podofo.lib}/lib
export SIP_BIN=${pythonPackages.sip}/bin/sip export SIP_BIN=${python3Packages.sip}/bin/sip
export XDG_DATA_HOME=$out/share export XDG_DATA_HOME=$out/share
export XDG_UTILS_INSTALL_MODE="user" export XDG_UTILS_INSTALL_MODE="user"
${pythonPackages.python.interpreter} setup.py install --root=$out \ ${python3Packages.python.interpreter} setup.py install --root=$out \
--prefix=$out \ --prefix=$out \
--libdir=$out/lib \ --libdir=$out/lib \
--staging-root=$out \ --staging-root=$out \
@ -147,7 +159,7 @@ mkDerivation rec {
# /nix/store/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-podofo-0.9.6-dev/include/podofo/base/PdfVariant.h # /nix/store/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-podofo-0.9.6-dev/include/podofo/base/PdfVariant.h
preFixup = '' preFixup = ''
remove-references-to -t ${podofo.dev} \ remove-references-to -t ${podofo.dev} \
$out/lib/calibre/calibre/plugins${lib.optionalString pythonPackages.isPy3k "/3"}/podofo.so $out/lib/calibre/calibre/plugins/podofo.so
for program in $out/bin/*; do for program in $out/bin/*; do
wrapProgram $program \ wrapProgram $program \

View File

@ -0,0 +1,25 @@
{ lib, fetchPypi, buildPythonPackage, packaging, sip_5 }:
buildPythonPackage rec {
pname = "pyqt-builder";
version = "1.6.0";
src = fetchPypi {
pname = "PyQt-builder";
inherit version;
sha256 = "0g51yak53zzjs4gpq65i01cmpz7w8cjny9wfyxlgr2vi0wag107v";
};
propagatedBuildInputs = [ packaging sip_5 ];
pythonImportsCheck = [ "pyqtbuild" ];
# There aren't tests
doCheck = false;
meta = with lib; {
description = "PEP 517 compliant build system for PyQt";
homepage = "https://pypi.org/project/PyQt-builder/";
license = licenses.gpl3Only;
};
}

View File

@ -85,6 +85,8 @@ mapAliases ({
buildGo112Package = throw "buildGo112Package has been removed"; # added 2020-04-26 buildGo112Package = throw "buildGo112Package has been removed"; # added 2020-04-26
buildGo112Module = throw "buildGo112Module has been removed"; # added 2020-04-26 buildGo112Module = throw "buildGo112Module has been removed"; # added 2020-04-26
bundler_HEAD = bundler; # added 2015-11-15 bundler_HEAD = bundler; # added 2015-11-15
calibre-py2 = throw "calibre-py2 has been removed from nixpkgs, as calibre has upgraded to python 3. Please use calibre as replacement."; # added 2021-01-13
calibre-py3 = throw "calibre-py3 has been removed from nixpkgs, as calibre's default python version is now 3. Please use calibre as replacement."; # added 2021-01-13
caddy1 = throw "caddy 1.x has been removed from nixpkgs, as it's unmaintained: https://github.com/caddyserver/caddy/blob/master/.github/SECURITY.md#supported-versions"; # added 2020-10-02 caddy1 = throw "caddy 1.x has been removed from nixpkgs, as it's unmaintained: https://github.com/caddyserver/caddy/blob/master/.github/SECURITY.md#supported-versions"; # added 2020-10-02
cantarell_fonts = cantarell-fonts; # added 2018-03-03 cantarell_fonts = cantarell-fonts; # added 2018-03-03
cargo-tree = throw "cargo-tree has been removed, use the builtin `cargo tree` command instead."; # added 2020-08-20 cargo-tree = throw "cargo-tree has been removed, use the builtin `cargo tree` command instead."; # added 2020-08-20

View File

@ -21225,11 +21225,7 @@ in
calculix = callPackage ../applications/science/math/calculix {}; calculix = callPackage ../applications/science/math/calculix {};
calibre-py2 = libsForQt5.callPackage ../applications/misc/calibre { pythonPackages = python2Packages; }; calibre = libsForQt5.callPackage ../applications/misc/calibre { };
calibre-py3 = libsForQt5.callPackage ../applications/misc/calibre { pythonPackages = python3Packages; };
calibre = calibre-py3;
calligra = libsForQt5.callPackage ../applications/office/calligra { calligra = libsForQt5.callPackage ../applications/office/calligra {
# Must use the same Qt version as Calligra itself: # Must use the same Qt version as Calligra itself:

View File

@ -5763,6 +5763,8 @@ in {
pyqrcode = callPackage ../development/python-modules/pyqrcode { }; pyqrcode = callPackage ../development/python-modules/pyqrcode { };
pyqt-builder = callPackage ../development/python-modules/pyqt-builder { };
pyqt4 = callPackage ../development/python-modules/pyqt/4.x.nix { inherit (pkgs) pkg-config; }; pyqt4 = callPackage ../development/python-modules/pyqt/4.x.nix { inherit (pkgs) pkg-config; };
pyqt5 = pkgs.libsForQt5.callPackage ../development/python-modules/pyqt/5.x.nix { pythonPackages = self; }; pyqt5 = pkgs.libsForQt5.callPackage ../development/python-modules/pyqt/5.x.nix { pythonPackages = self; };