all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Calibre
@ 2015-02-15 10:20 Andreas Enge
  2015-02-17  4:23 ` Calibre Mark H Weaver
  2015-02-17  5:02 ` Calibre Mark H Weaver
  0 siblings, 2 replies; 9+ messages in thread
From: Andreas Enge @ 2015-02-15 10:20 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1481 bytes --]

Hello,

the attached file adds the e-book management program calibre. Eventually,
I will put it into ebook.scm. Comments are welcome, in particular concerning
the xdg issue.

The program works for downloading and reading ebooks, but it has problems
with mounting my attached e-reader. The problem seems to be that the guix
calibre is not allowed to connect to my debian dbus:
Udisks mount call failed:
Traceback (most recent call last):
  File "/gnu/store/jdpva5h8jb5d9xirzya1ivsvbl2vnpps-calibre-2.19.0/lib/calibre/calibre/devices/usbms/device.py", line 600, in do_mount
    mount(node)
  File "/gnu/store/jdpva5h8jb5d9xirzya1ivsvbl2vnpps-calibre-2.19.0/lib/calibre/calibre/devices/udisks.py", line 180, in mount
    u.mount(node_path)
  File "/gnu/store/jdpva5h8jb5d9xirzya1ivsvbl2vnpps-calibre-2.19.0/lib/calibre/calibre/devices/udisks.py", line 133, in mount
    dbus_interface=self.FILESYSTEM))
  File "/gnu/store/2f06bpk30myjx186f7mj86pc69k6jzi1-python2-dbus-1.2.0/lib/python2.7/site-packages/dbus/proxies.py", line 145, in __call__
    **keywords)
  File "/gnu/store/2f06bpk30myjx186f7mj86pc69k6jzi1-python2-dbus-1.2.0/lib/python2.7/site-packages/dbus/connection.py", line 651, in call_blocking
    message, timeout)
DBusException: org.freedesktop.UDisks2.Error.NotAuthorized: Not authorized to perform operation (polkit authority not available and caller is not uid 0)

Do you have an idea how to solve this?

In the meantime, one may mount the e-reader by hand.

Andreas


[-- Attachment #2: calibre.scm --]
[-- Type: text/plain, Size: 4752 bytes --]

;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015 Andreas Enge <andreas@enge.fr>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu packages calibre)
  #:use-module ((guix licenses) #:select (gpl3))
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix build-system python)
  #:use-module (gnu packages databases)
  #:use-module (gnu packages ebook)
  #:use-module (gnu packages fontutils)
  #:use-module (gnu packages freedesktop)
  #:use-module (gnu packages glib)
  #:use-module (gnu packages icu4c)
  #:use-module (gnu packages image)
  #:use-module (gnu packages imagemagick)
  #:use-module (gnu packages libusb)
  #:use-module (gnu packages pdf)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages python)
  #:use-module (gnu packages qt)
  #:use-module (gnu packages xorg))

(define-public calibre
  (package
    (name "calibre")
    (version "2.19.0")
    (source (origin
             (method url-fetch)
             (uri (string-append "http://download.calibre-ebook.com/"
                                 version "/calibre-"
                                 version ".tar.xz"))
             (sha256
               (base32
                "1acj1i8hlbi99jjgcs9dl9ap7951m1p460srmkdyjmlljw1qhcbn"))))
    (build-system python-build-system)
    (native-inputs
     `(("pkg-config" ,pkg-config)
       ("qt" ,qt) ; for qmake
       ;; xdg-utils is supposed to be used for desktop integration, but it
       ;; also creates lots of messages
       ;; mkdir: cannot create directory '/homeless-shelter': Permission denied
       ("xdg-utils" ,xdg-utils)))
    ;; FIXME: The following are missing inputs according to the documentation,
    ;; but the package can apparently be used without them,
    ;; They may need to be added if a deficiency is detected.
    ;; BeautifulSoup >= 3.0.5
    ;; dnspython >= 1.6.0
    ;; poppler >= 0.20.2
    ;; libwmf >= 0.2.8
    ;; psutil >= 0.6.1
    ;; python-pygments >= 2.0.1 ; used for ebook editing
    (inputs
     `(("chmlib" ,chmlib)
       ("fontconfig" ,fontconfig)
       ("glib" ,glib)
       ("icu4c" ,icu4c)
       ("imagemagick" ,imagemagick)
       ("libmtp" ,libmtp)
       ("libpng" ,libpng)
       ("libusb" ,libusb)
       ("libxrender" ,libxrender)
       ("podofo" ,podofo)
       ("python" ,python-2)
       ("python2-apsw" ,python2-apsw)
       ("python2-cssselect" ,python2-cssselect)
       ("python2-cssutils" ,python2-cssutils)
       ("python2-dateutil" ,python2-dateutil)
       ("python2-dbus" ,python2-dbus)
       ("python2-lxml" ,python2-lxml)
       ("python2-mechanize" ,python2-mechanize)
       ("python2-netifaces" ,python2-netifaces)
       ;; pil is unmaintained, but the maintained fork pillow does not work.
       ("python2-pil" ,python2-pil)
       ("python2-pyqt" ,python2-pyqt)
       ("python2-sip" ,python2-sip)
       ("qt" ,qt)
       ("sqlite" ,sqlite))) 
    (arguments
     `(#:python ,python-2
       #:test-target "check"
       #:tests? #f ; FIXME: enable once flake8 is packaged
       #:phases
         (alist-cons-before
          'build 'configure
          (lambda* (#:key inputs #:allow-other-keys)
            (let ((podofo (assoc-ref inputs "podofo"))
                  (pyqt (assoc-ref inputs "python2-pyqt")))
              (substitute* "setup/build_environment.py"
                (("sys.prefix") (string-append "'" pyqt "'")))
              (setenv "PODOFO_INC_DIR" (string-append podofo "/include/podofo"))
              (setenv "PODOFO_LIB_DIR" (string-append podofo "/lib"))))
          %standard-phases)))
    (home-page "http://calibre-ebook.com/")
    (synopsis "E-book library management software")
    (description "Calibre is an ebook library manager.  It can view, convert
and catalog ebooks in most of the major ebook formats.  It can also talk
to many ebook reader devices.  It can go out to the Internet and fetch
metadata for books.  It can download newspapers and convert them into
ebooks for convenient reading.")
    (license gpl3))) ; some files are under various other licenses, see COPYRIGHT

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Calibre
  2015-02-15 10:20 Calibre Andreas Enge
@ 2015-02-17  4:23 ` Mark H Weaver
  2015-02-17 20:21   ` Calibre Andreas Enge
  2015-02-17  5:02 ` Calibre Mark H Weaver
  1 sibling, 1 reply; 9+ messages in thread
From: Mark H Weaver @ 2015-02-17  4:23 UTC (permalink / raw)
  To: Andreas Enge; +Cc: guix-devel

Andreas Enge <andreas@enge.fr> writes:

> the attached file adds the e-book management program calibre. Eventually,
> I will put it into ebook.scm. Comments are welcome, in particular concerning
> the xdg issue.
>
> The program works for downloading and reading ebooks, but it has problems
> with mounting my attached e-reader. The problem seems to be that the guix
> calibre is not allowed to connect to my debian dbus:
> Udisks mount call failed:
> Traceback (most recent call last):
[...]
> DBusException: org.freedesktop.UDisks2.Error.NotAuthorized: Not authorized to perform operation (polkit authority not available and caller is not uid 0)

It's not that you're not allowed to connect to Debian D-Bus, but rather
that D-Bus (or UDisks2) thinks you are not authorized to mount a disk.
My knowledge of this is weak, but I guess the way this works on modern
systems is that <http://www.freedesktop.org/wiki/Software/polkit/>
(Policy Kit) enables an authorization scheme where whoever is logged in
at the physical console is also granted access to mount disks, use
audio/video devices, etc.  I'm not sure why it's not working here, but I
guess it might be because we lack polkit in Guix.

     Mark

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Calibre
  2015-02-15 10:20 Calibre Andreas Enge
  2015-02-17  4:23 ` Calibre Mark H Weaver
@ 2015-02-17  5:02 ` Mark H Weaver
  2015-02-17 20:30   ` Calibre Andreas Enge
  1 sibling, 1 reply; 9+ messages in thread
From: Mark H Weaver @ 2015-02-17  5:02 UTC (permalink / raw)
  To: Andreas Enge; +Cc: guix-devel

Andreas Enge <andreas@enge.fr> writes:
> the attached file adds the e-book management program
> calibre. Eventually, I will put it into ebook.scm. Comments are
> welcome, in particular concerning the xdg issue.

The calibre source tarball contains non-free software.  Debian
distributes their own excerpted source tarball instead, with the
src/unrar, src/calibre/ebooks/markdown, and resources/viewer/mathjax
directories removed, as well as src/odf/thumbnail.py.

I haven't done a full investigation and don't plan to.  You're adding
this package, so that's your job :)  However, I did verify that your
'license' field is not sufficient, and found the following problems:

(1) src/unrar's license includes the following clause:

--8<---------------cut here---------------start------------->8---
   2. UnRAR source code may be used in any software to handle
      RAR archives without limitations free of charge, but cannot be
      used to develop RAR (WinRAR) compatible archiver and to
      re-create RAR compression algorithm, which is proprietary.
      Distribution of modified UnRAR source code in separate form
      or as a part of other software is permitted, provided that
      full text of this paragraph, starting from "UnRAR source code"
      words, is included in license, or in documentation if license
      is not available, and in source code comments of resulting package.
--8<---------------cut here---------------end--------------->8---

    This restriction on use makes it non-free software.

(2) src/calibre/ebooks/markdown/serializers.py license includes the text:

--8<---------------cut here---------------start------------->8---
  # By obtaining, using, and/or copying this software and/or its
  # associated documentation, you agree that you have read, understood,
  # and will comply with the following terms and conditions:
  #
  # Permission to use, copy, modify, and distribute this software and
  # its associated documentation for any purpose and without fee is
  # hereby granted, provided that the above copyright notice appears in
  # all copies, and that both that copyright notice and this permission
  # notice appear in supporting documentation, and that the name of
  # Secret Labs AB or the author not be used in advertising or publicity
  # pertaining to distribution of the software without specific, written
  # prior permission.
--8<---------------cut here---------------end--------------->8---

    I'm not as confident that this one is a problem, partly because I
    guess it is probably unenforceable, but the first paragraph is
    attempting to put a restriction on use.  They are saying that you're
    not even allowed to use this software unless you have "read,
    understood, and will comply with ...".

(3) src/odf/thumbnail.py simply says "License: Freeware".  I have no
    idea what that means.  It is "Non-functional Data" (an image), so
    (quoting the GNU FSDG) "It can be included in a free system
    distribution as long as its license gives you permission to copy and
    redistribute, both for commercial and non-commercial purposes."
    However, I don't think we can deduce that from "License: Freeware".

We'll need to add a 'snippet' to remove everything that doesn't comply
with the GNU FSDG[*], and to do a more careful job with the 'license'
field..  For now, we could probably assume that removing everything that
Debian removed will be sufficient.

     Thanks,
       Mark

[*] https://gnu.org/distros/free-system-distribution-guidelines.html

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Calibre
  2015-02-17  4:23 ` Calibre Mark H Weaver
@ 2015-02-17 20:21   ` Andreas Enge
  0 siblings, 0 replies; 9+ messages in thread
From: Andreas Enge @ 2015-02-17 20:21 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: guix-devel

On Mon, Feb 16, 2015 at 11:23:50PM -0500, Mark H Weaver wrote:
> I'm not sure why it's not working here, but I
> guess it might be because we lack polkit in Guix.

It is packaged in Guix. But then it probably needs to be installed and
activated, which may be a subtle business.

Andreas

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Calibre
  2015-02-17  5:02 ` Calibre Mark H Weaver
@ 2015-02-17 20:30   ` Andreas Enge
  2015-02-17 21:35     ` Calibre Mark H Weaver
  2015-02-17 22:17     ` Calibre Andreas Enge
  0 siblings, 2 replies; 9+ messages in thread
From: Andreas Enge @ 2015-02-17 20:30 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: guix-devel

On Tue, Feb 17, 2015 at 12:02:00AM -0500, Mark H Weaver wrote:
> The calibre source tarball contains non-free software.  Debian
> distributes their own excerpted source tarball instead, with the
> src/unrar, src/calibre/ebooks/markdown, and resources/viewer/mathjax
> directories removed, as well as src/odf/thumbnail.py.

Amazing, thanks for looking into it. How do you find out which files
debian drops? I suppose that a "dfsg" in the package name is a warning
sign? This is even more surprising as there is the file COPYRIGHT
in the distribution, which diligently lists the licenses of lots of
packages, except apparently for the non-free ones... I will try
to contact the upstream author.

> (1) src/unrar's license includes the following clause:
> 
> --8<---------------cut here---------------start------------->8---
>    2. UnRAR source code may be used in any software to handle
>       RAR archives without limitations free of charge, but cannot be
>       used to develop RAR (WinRAR) compatible archiver and to
>       re-create RAR compression algorithm, which is proprietary.
>       Distribution of modified UnRAR source code in separate form
>       or as a part of other software is permitted, provided that
>       full text of this paragraph, starting from "UnRAR source code"
>       words, is included in license, or in documentation if license
>       is not available, and in source code comments of resulting package.
> --8<---------------cut here---------------end--------------->8---
> 
>     This restriction on use makes it non-free software.

Clearly so!

> (2) src/calibre/ebooks/markdown/serializers.py license includes the text:
> 
> --8<---------------cut here---------------start------------->8---
>   # By obtaining, using, and/or copying this software and/or its
>   # associated documentation, you agree that you have read, understood,
>   # and will comply with the following terms and conditions:
>   #
>   # Permission to use, copy, modify, and distribute this software and
>   # its associated documentation for any purpose and without fee is
>   # hereby granted, provided that the above copyright notice appears in
>   # all copies, and that both that copyright notice and this permission
>   # notice appear in supporting documentation, and that the name of
>   # Secret Labs AB or the author not be used in advertising or publicity
>   # pertaining to distribution of the software without specific, written
>   # prior permission.
> --8<---------------cut here---------------end--------------->8---
> 
>     I'm not as confident that this one is a problem, partly because I
>     guess it is probably unenforceable, but the first paragraph is
>     attempting to put a restriction on use.  They are saying that you're
>     not even allowed to use this software unless you have "read,
>     understood, and will comply with ...".

I suppose that the first sentence merely states "the following license
is valid", so I do not think it is a real problem. One always needs to
comply with the license, no?

> (3) src/odf/thumbnail.py simply says "License: Freeware".  I have no
>     idea what that means.  It is "Non-functional Data" (an image), so
>     (quoting the GNU FSDG) "It can be included in a free system
>     distribution as long as its license gives you permission to copy and
>     redistribute, both for commercial and non-commercial purposes."
>     However, I don't think we can deduce that from "License: Freeware".

I think it is supposed to mean "public domain", but that is just guessing.
We should drop the file.

I will try to take out 1) and 3); I am not sure about 2), though.
As usual in python, I suppose that things will still compile and install,
and then one just needs to hope that it still works.

Andreas

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Calibre
  2015-02-17 20:30   ` Calibre Andreas Enge
@ 2015-02-17 21:35     ` Mark H Weaver
  2015-02-17 21:50       ` Calibre Andreas Enge
  2015-02-17 22:17     ` Calibre Andreas Enge
  1 sibling, 1 reply; 9+ messages in thread
From: Mark H Weaver @ 2015-02-17 21:35 UTC (permalink / raw)
  To: Andreas Enge; +Cc: guix-devel

Andreas Enge <andreas@enge.fr> writes:

> On Tue, Feb 17, 2015 at 12:02:00AM -0500, Mark H Weaver wrote:
>> The calibre source tarball contains non-free software.  Debian
>> distributes their own excerpted source tarball instead, with the
>> src/unrar, src/calibre/ebooks/markdown, and resources/viewer/mathjax
>> directories removed, as well as src/odf/thumbnail.py.
>
> Amazing, thanks for looking into it. How do you find out which files
> debian drops?

I downloaded Debian's 'dfsg' source tarball, and the upstream source
tarball, and used 'diff' to find the diferences.

> I suppose that a "dfsg" in the package name is a warning
> sign?

Yes, although in many cases it is because the GNU Free Documentation
License doesn't comply with Debian's DFSG when invariant sections are
used.

> This is even more surprising as there is the file COPYRIGHT
> in the distribution, which diligently lists the licenses of lots of
> packages, except apparently for the non-free ones...

Debian's copyright file only lists the licenses of what they included in
their source package, so anything they removed is not included.

>> (2) src/calibre/ebooks/markdown/serializers.py license includes the text:
>> 
>> --8<---------------cut here---------------start------------->8---
>>   # By obtaining, using, and/or copying this software and/or its
>>   # associated documentation, you agree that you have read, understood,
>>   # and will comply with the following terms and conditions:
>>   #
>>   # Permission to use, copy, modify, and distribute this software and
>>   # its associated documentation for any purpose and without fee is
>>   # hereby granted, provided that the above copyright notice appears in
>>   # all copies, and that both that copyright notice and this permission
>>   # notice appear in supporting documentation, and that the name of
>>   # Secret Labs AB or the author not be used in advertising or publicity
>>   # pertaining to distribution of the software without specific, written
>>   # prior permission.
>> --8<---------------cut here---------------end--------------->8---
>> 
>>     I'm not as confident that this one is a problem, partly because I
>>     guess it is probably unenforceable, but the first paragraph is
>>     attempting to put a restriction on use.  They are saying that you're
>>     not even allowed to use this software unless you have "read,
>>     understood, and will comply with ...".
>
> I suppose that the first sentence merely states "the following license
> is valid", so I do not think it is a real problem. One always needs to
> comply with the license, no?

No.  Normally one only has to comply with the license if you do
something that would violate copyright law, e.g. redistribution.

      Mark

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Calibre
  2015-02-17 21:35     ` Calibre Mark H Weaver
@ 2015-02-17 21:50       ` Andreas Enge
  2015-02-17 22:09         ` Calibre Mark H Weaver
  0 siblings, 1 reply; 9+ messages in thread
From: Andreas Enge @ 2015-02-17 21:50 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: guix-devel

On Tue, Feb 17, 2015 at 04:35:44PM -0500, Mark H Weaver wrote:
> Andreas Enge <andreas@enge.fr> writes:
> > This is even more surprising as there is the file COPYRIGHT
> > in the distribution, which diligently lists the licenses of lots of
> > packages, except apparently for the non-free ones...
> Debian's copyright file only lists the licenses of what they included in
> their source package, so anything they removed is not included.

Yes, but here the COPYRIGHT file is already in the original tarball.

I am giving up on contacting the author; all communication goes via forums
or bug trackers that require to sign up and accept terms and conditions,
or that show a captcha which is not working on icecat.

Andreas

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Calibre
  2015-02-17 21:50       ` Calibre Andreas Enge
@ 2015-02-17 22:09         ` Mark H Weaver
  0 siblings, 0 replies; 9+ messages in thread
From: Mark H Weaver @ 2015-02-17 22:09 UTC (permalink / raw)
  To: Andreas Enge; +Cc: guix-devel

Andreas Enge <andreas@enge.fr> writes:

> On Tue, Feb 17, 2015 at 04:35:44PM -0500, Mark H Weaver wrote:
>> Andreas Enge <andreas@enge.fr> writes:
>> > This is even more surprising as there is the file COPYRIGHT
>> > in the distribution, which diligently lists the licenses of lots of
>> > packages, except apparently for the non-free ones...
>> Debian's copyright file only lists the licenses of what they included in
>> their source package, so anything they removed is not included.
>
> Yes, but here the COPYRIGHT file is already in the original tarball.

In general, you cannot trust the upstream authors' summary of their
license.  Most authors are very sloppy about legal matters.  What
ultimately matters are the copyright notices on the source files.

> I am giving up on contacting the author; all communication goes via forums
> or bug trackers that require to sign up and accept terms and conditions,
> or that show a captcha which is not working on icecat.

That's annoying :-(

I've recently started to use LibreJS most of the time, but have found
that even after whitelisting a site, it still sometimes prevents a site
from working properly.  In such cases I have to disable LibreJS
altogether and then re-enable it afterwards.

      Mark

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Calibre
  2015-02-17 20:30   ` Calibre Andreas Enge
  2015-02-17 21:35     ` Calibre Mark H Weaver
@ 2015-02-17 22:17     ` Andreas Enge
  1 sibling, 0 replies; 9+ messages in thread
From: Andreas Enge @ 2015-02-17 22:17 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 430 bytes --]

> (2) src/calibre/ebooks/markdown/serializers.py license includes the text:

In fact, Debian deletes the markdown copy in the original tarball, but only
because they use their Debian markdown package instead. I looked at
python3-markdown, and the offending file is still in there.

$ guix import pypi Markdown
creates a package with bsd-3 license.

So I assume this file is in fact okay to use. A new patch is attached.

Andreas


[-- Attachment #2: 0001-gnu-Add-calibre.patch --]
[-- Type: text/plain, Size: 9121 bytes --]

From de7b872e47d8cb551aa41cdc68663f66363b5c54 Mon Sep 17 00:00:00 2001
From: Andreas Enge <andreas@enge.fr>
Date: Tue, 17 Feb 2015 23:15:18 +0100
Subject: [PATCH] gnu: Add calibre.

* gnu/packages/ebook.scm (calibre): New variable.
* gnu/packages/patches/calibre-drop-unrar.patch: New file.
* gnu-system.am (dist_patch_DATA): Register patch.
---
 gnu-system.am                                 |   3 +-
 gnu/packages/ebook.scm                        | 108 +++++++++++++++++++++++++-
 gnu/packages/patches/calibre-drop-unrar.patch |  49 ++++++++++++
 3 files changed, 157 insertions(+), 3 deletions(-)
 create mode 100644 gnu/packages/patches/calibre-drop-unrar.patch

diff --git a/gnu-system.am b/gnu-system.am
index eeadd8f..390ef72 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -1,6 +1,6 @@
 # GNU Guix --- Functional package management for GNU
 # Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
-# Copyright © 2013, 2014 Andreas Enge <andreas@enge.fr>
+# Copyright © 2013, 2014, 2015 Andreas Enge <andreas@enge.fr>
 # Copyright © 2013, 2014, 2015 Mark H Weaver <mhw@netris.org>
 #
 # This file is part of GNU Guix.
@@ -361,6 +361,7 @@ dist_patch_DATA =						\
   gnu/packages/patches/bigloo-gc-shebangs.patch			\
   gnu/packages/patches/binutils-ld-new-dtags.patch		\
   gnu/packages/patches/binutils-loongson-workaround.patch	\
+  gnu/packages/patches/calibre-drop-unrar.patch			\
   gnu/packages/patches/cdparanoia-fpic.patch			\
   gnu/packages/patches/clucene-pkgconfig.patch			\
   gnu/packages/patches/cmake-fix-tests.patch			\
diff --git a/gnu/packages/ebook.scm b/gnu/packages/ebook.scm
index f34966c..5b73b49 100644
--- a/gnu/packages/ebook.scm
+++ b/gnu/packages/ebook.scm
@@ -17,10 +17,26 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu packages ebook)
-  #:use-module ((guix licenses) #:select (lgpl2.1+))
+  #:use-module ((guix licenses) #:select (gpl3 lgpl2.1+))
   #:use-module (guix packages)
   #:use-module (guix download)
-  #:use-module (guix build-system gnu))
+  #:use-module (guix build-system gnu)
+  #:use-module (guix build-system python)
+  #:use-module (gnu packages)
+  #:use-module (gnu packages databases)
+  #:use-module (gnu packages ebook)
+  #:use-module (gnu packages fontutils)
+  #:use-module (gnu packages freedesktop)
+  #:use-module (gnu packages glib)
+  #:use-module (gnu packages icu4c)
+  #:use-module (gnu packages image)
+  #:use-module (gnu packages imagemagick)
+  #:use-module (gnu packages libusb)
+  #:use-module (gnu packages pdf)
+  #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages python)
+  #:use-module (gnu packages qt)
+  #:use-module (gnu packages xorg))
 
 (define-public chmlib
   (package
@@ -38,3 +54,91 @@
     (synopsis "Library for CHM files")
     (description "CHMLIB is a library for dealing with ITSS/CHM format files.")
     (license lgpl2.1+)))
+
+(define-public calibre
+  (package
+    (name "calibre")
+    (version "2.19.0")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (string-append "http://download.calibre-ebook.com/"
+                            version "/calibre-"
+                            version ".tar.xz"))
+        (sha256
+          (base32
+           "1acj1i8hlbi99jjgcs9dl9ap7951m1p460srmkdyjmlljw1qhcbn"))
+        ;; Remove non-free or doubtful code, see
+        ;; https://lists.gnu.org/archive/html/guix-devel/2015-02/msg00478.html
+        (modules '((guix build utils)))
+        (snippet
+          '(begin
+            (delete-file-recursively "src/unrar")
+            (delete-file "src/odf/thumbnail.py")))
+        (patches (list (search-patch "calibre-drop-unrar.patch")))))
+    (build-system python-build-system)
+    (native-inputs
+     `(("pkg-config" ,pkg-config)
+       ("qt" ,qt) ; for qmake
+       ;; xdg-utils is supposed to be used for desktop integration, but it
+       ;; also creates lots of messages
+       ;; mkdir: cannot create directory '/homeless-shelter': Permission denied
+       ("xdg-utils" ,xdg-utils)))
+    ;; FIXME: The following are missing inputs according to the documentation,
+    ;; but the package can apparently be used without them,
+    ;; They may need to be added if a deficiency is detected.
+    ;; BeautifulSoup >= 3.0.5
+    ;; dnspython >= 1.6.0
+    ;; poppler >= 0.20.2
+    ;; libwmf >= 0.2.8
+    ;; psutil >= 0.6.1
+    ;; python-pygments >= 2.0.1 ; used for ebook editing
+    (inputs
+     `(("chmlib" ,chmlib)
+       ("fontconfig" ,fontconfig)
+       ("glib" ,glib)
+       ("icu4c" ,icu4c)
+       ("imagemagick" ,imagemagick)
+       ("libmtp" ,libmtp)
+       ("libpng" ,libpng)
+       ("libusb" ,libusb)
+       ("libxrender" ,libxrender)
+       ("podofo" ,podofo)
+       ("python" ,python-2)
+       ("python2-apsw" ,python2-apsw)
+       ("python2-cssselect" ,python2-cssselect)
+       ("python2-cssutils" ,python2-cssutils)
+       ("python2-dateutil" ,python2-dateutil)
+       ("python2-dbus" ,python2-dbus)
+       ("python2-lxml" ,python2-lxml)
+       ("python2-mechanize" ,python2-mechanize)
+       ("python2-netifaces" ,python2-netifaces)
+       ;; pil is unmaintained, but the maintained fork pillow does not work.
+       ("python2-pil" ,python2-pil)
+       ("python2-pyqt" ,python2-pyqt)
+       ("python2-sip" ,python2-sip)
+       ("qt" ,qt)
+       ("sqlite" ,sqlite))) 
+    (arguments
+     `(#:python ,python-2
+       #:test-target "check"
+       #:tests? #f ; FIXME: enable once flake8 is packaged
+       #:phases
+         (alist-cons-before
+          'build 'configure
+          (lambda* (#:key inputs #:allow-other-keys)
+            (let ((podofo (assoc-ref inputs "podofo"))
+                  (pyqt (assoc-ref inputs "python2-pyqt")))
+              (substitute* "setup/build_environment.py"
+                (("sys.prefix") (string-append "'" pyqt "'")))
+              (setenv "PODOFO_INC_DIR" (string-append podofo "/include/podofo"))
+              (setenv "PODOFO_LIB_DIR" (string-append podofo "/lib"))))
+          %standard-phases)))
+    (home-page "http://calibre-ebook.com/")
+    (synopsis "E-book library management software")
+    (description "Calibre is an ebook library manager.  It can view, convert
+and catalog ebooks in most of the major ebook formats.  It can also talk
+to many ebook reader devices.  It can go out to the Internet and fetch
+metadata for books.  It can download newspapers and convert them into
+ebooks for convenient reading.")
+    (license gpl3))) ; some files are under various other licenses, see COPYRIGHT
diff --git a/gnu/packages/patches/calibre-drop-unrar.patch b/gnu/packages/patches/calibre-drop-unrar.patch
new file mode 100644
index 0000000..6b7a9f4
--- /dev/null
+++ b/gnu/packages/patches/calibre-drop-unrar.patch
@@ -0,0 +1,49 @@
+Taken from Debian.
+
+Author: Dmitry Shachnev <mitya57@gmail.com>
+Description: do not build unrar extension as we strip unrar from the tarball
+Forwarded: not-needed
+Last-Update: 2013-04-04
+
+Index: calibre/setup/extensions.py
+===================================================================
+--- calibre.orig/setup/extensions.py	2014-02-02 10:42:14.510954007 +0100
++++ calibre/setup/extensions.py	2014-02-02 10:42:14.502954007 +0100
+@@ -209,24 +209,6 @@
+                 sip_files=['calibre/ebooks/pdf/render/qt_hack.sip']
+                 ),
+ 
+-    Extension('unrar',
+-              ['unrar/%s.cpp'%(x.partition('.')[0]) for x in '''
+-               rar.o strlist.o strfn.o pathfn.o savepos.o smallfn.o global.o file.o
+-               filefn.o filcreat.o archive.o arcread.o unicode.o system.o
+-               isnt.o crypt.o crc.o rawread.o encname.o resource.o match.o
+-               timefn.o rdwrfn.o consio.o options.o ulinks.o errhnd.o rarvm.o
+-               secpassword.o rijndael.o getbits.o sha1.o extinfo.o extract.o
+-               volume.o list.o find.o unpack.o cmddata.o filestr.o scantree.o
+-               '''.split()] + ['calibre/utils/unrar.cpp'],
+-              inc_dirs=['unrar'],
+-              cflags=[('/' if iswindows else '-') + x for x in (
+-                  'DSILENT', 'DRARDLL', 'DUNRAR')] + (
+-                  [] if iswindows else ['-D_FILE_OFFSET_BITS=64',
+-                                        '-D_LARGEFILE_SOURCE']),
+-              optimize_level=2,
+-              libraries=['User32', 'Advapi32', 'kernel32', 'Shell32'] if iswindows else []
+-              ),
+-
+     ]
+ 
+ 
+Index: calibre/src/calibre/ebooks/metadata/archive.py
+===================================================================
+--- calibre.orig/src/calibre/ebooks/metadata/archive.py	2014-02-02 10:42:14.510954007 +0100
++++ calibre/src/calibre/ebooks/metadata/archive.py	2014-02-02 10:42:14.502954007 +0100
+@@ -42,7 +42,7 @@
+     description = _('Extract common e-book formats from archives '
+         '(zip/rar) files. Also try to autodetect if they are actually '
+         'cbz/cbr files.')
+-    file_types = set(['zip', 'rar'])
++    file_types = set(['zip'])
+     supported_platforms = ['windows', 'osx', 'linux']
+     on_import = True
+ 
-- 
2.2.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-02-17 22:17 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-15 10:20 Calibre Andreas Enge
2015-02-17  4:23 ` Calibre Mark H Weaver
2015-02-17 20:21   ` Calibre Andreas Enge
2015-02-17  5:02 ` Calibre Mark H Weaver
2015-02-17 20:30   ` Calibre Andreas Enge
2015-02-17 21:35     ` Calibre Mark H Weaver
2015-02-17 21:50       ` Calibre Andreas Enge
2015-02-17 22:09         ` Calibre Mark H Weaver
2015-02-17 22:17     ` Calibre Andreas Enge

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.