Skip to content

Commit 3690d1d

Browse files
committed
calibre: build with py3 by default
1 parent d65002a commit 3690d1d

2 files changed

Lines changed: 30 additions & 33 deletions

File tree

pkgs/applications/misc/calibre/default.nix

Lines changed: 25 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,14 @@
1616
, hyphen
1717
, unrarSupport ? false
1818
, chmlib
19-
, python2Packages
19+
, pythonPackages
2020
, libusb1
2121
, libmtp
2222
, xdg_utils
2323
, makeDesktopItem
2424
, removeReferencesTo
2525
}:
2626

27-
let
28-
pypkgs = python2Packages;
29-
30-
in
3127
mkDerivation rec {
3228
pname = "calibre";
3329
version = "4.22.0";
@@ -47,7 +43,7 @@ mkDerivation rec {
4743
] ++ lib.optional (!unrarSupport) ./dont_build_unrar_plugin.patch;
4844

4945
prePatch = ''
50-
sed -i "/pyqt_sip_dir/ s:=.*:= '${pypkgs.pyqt5}/share/sip/PyQt5':" \
46+
sed -i "/pyqt_sip_dir/ s:=.*:= '${pythonPackages.pyqt5}/share/sip/PyQt5':" \
5147
setup/build_environment.py
5248
5349
# Remove unneeded files and libs
@@ -61,52 +57,49 @@ mkDerivation rec {
6157

6258
nativeBuildInputs = [ pkgconfig qmake removeReferencesTo ];
6359

64-
CALIBRE_PY3_PORT = builtins.toString pypkgs.isPy3k;
60+
CALIBRE_PY3_PORT = builtins.toString pythonPackages.isPy3k;
6561

6662
buildInputs = [
67-
poppler_utils
68-
libpng
63+
chmlib
64+
fontconfig
65+
hunspell
66+
hyphen
67+
icu
6968
imagemagick
7069
libjpeg
71-
fontconfig
70+
libmtp
71+
libpng
72+
libusb1
7273
podofo
74+
poppler_utils
7375
qtbase
74-
chmlib
75-
icu
76-
hunspell
77-
hyphen
7876
sqlite
79-
libusb1
80-
libmtp
8177
xdg_utils
8278
] ++ (
83-
with pypkgs; [
79+
with pythonPackages; [
8480
apsw
85-
cssselect
81+
beautifulsoup4
8682
css-parser
83+
cssselect
8784
dateutil
8885
dnspython
8986
feedparser
87+
html2text
9088
html5-parser
9189
lxml
9290
markdown
91+
mechanize
92+
msgpack
9393
netifaces
9494
pillow
95-
python
9695
pyqt5
97-
sip
98-
regex
99-
msgpack
100-
beautifulsoup4
101-
html2text
10296
pyqtwebengine
97+
python
98+
regex
99+
sip
103100
# the following are distributed with calibre, but we use upstream instead
104101
odfpy
105102
]
106-
) ++ lib.optionals (!pypkgs.isPy3k) (
107-
with pypkgs; [
108-
mechanize
109-
]
110103
);
111104

112105
installPhase = ''
@@ -121,18 +114,17 @@ mkDerivation rec {
121114
export FC_LIB_DIR=${fontconfig.lib}/lib
122115
export PODOFO_INC_DIR=${podofo.dev}/include/podofo
123116
export PODOFO_LIB_DIR=${podofo.lib}/lib
124-
export SIP_BIN=${pypkgs.sip}/bin/sip
117+
export SIP_BIN=${pythonPackages.sip}/bin/sip
125118
export XDG_DATA_HOME=$out/share
126119
export XDG_UTILS_INSTALL_MODE="user"
127120
128-
${pypkgs.python.interpreter} setup.py install --root=$out \
121+
${pythonPackages.python.interpreter} setup.py install --root=$out \
129122
--prefix=$out \
130123
--libdir=$out/lib \
131124
--staging-root=$out \
132125
--staging-libdir=$out/lib \
133126
--staging-sharedir=$out/share
134127
135-
136128
PYFILES="$out/bin/* $out/lib/calibre/calibre/web/feeds/*.py
137129
$out/lib/calibre/calibre/ebooks/metadata/*.py
138130
$out/lib/calibre/calibre/ebooks/rtf2xml/*.py"
@@ -154,7 +146,8 @@ mkDerivation rec {
154146
# 2018-11-06) was a single string like the following:
155147
# /nix/store/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-podofo-0.9.6-dev/include/podofo/base/PdfVariant.h
156148
preFixup = ''
157-
remove-references-to -t ${podofo.dev} $out/lib/calibre/calibre/plugins/podofo.so
149+
remove-references-to -t ${podofo.dev} \
150+
$out/lib/calibre/calibre/plugins${lib.optionalString pythonPackages.isPy3k "/3"}/podofo.so
158151
159152
for program in $out/bin/*; do
160153
wrapProgram $program \

pkgs/top-level/all-packages.nix

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19691,7 +19691,11 @@ in
1969119691

1969219692
calculix = callPackage ../applications/science/math/calculix {};
1969319693

19694-
calibre = libsForQt5.callPackage ../applications/misc/calibre { };
19694+
calibre-py2 = libsForQt5.callPackage ../applications/misc/calibre { pythonPackages = python2Packages; };
19695+
19696+
calibre-py3 = libsForQt5.callPackage ../applications/misc/calibre { pythonPackages = python3Packages; };
19697+
19698+
calibre = self.calibre-py3;
1969519699

1969619700
calligra = libsForQt5.callPackage ../applications/office/calligra {
1969719701
inherit (kdeApplications) akonadi-calendar akonadi-contacts;

0 commit comments

Comments
 (0)