- Update to 0.7.22. With this update the USB functionality should still
continue to work, but device enumeration now requires root privileges. Also mountpoint detection and automounting doesn't work. PR: ports/148831 Submitted by: Rusty Nejdl <rnejdl@tethys.ringofsaturn.com> (based on)
This commit is contained in:
parent
d9ce2e1cd1
commit
3fb49a1478
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=262554
25 changed files with 971 additions and 672 deletions
|
@ -6,11 +6,10 @@
|
|||
#
|
||||
|
||||
PORTNAME= calibre
|
||||
PORTVERSION= 0.6.27
|
||||
PORTREVISION= 6
|
||||
PORTVERSION= 0.7.22
|
||||
PORTREVISION= 0
|
||||
CATEGORIES= deskutils python
|
||||
MASTER_SITES= ftp://ftp.SpringDaemons.com/soft/ \
|
||||
http://calibre-ebook.googlecode.com/files/
|
||||
MASTER_SITES= SF/${PORTNAME}/${PORTVERSION}/
|
||||
|
||||
MAINTAINER= stas@FreeBSD.org
|
||||
COMMENT= Ebook management application
|
||||
|
@ -18,11 +17,15 @@ COMMENT= Ebook management application
|
|||
LIB_DEPENDS= MagickWand.4:${PORTSDIR}/graphics/ImageMagick \
|
||||
fontconfig.1:${PORTSDIR}/x11-fonts/fontconfig \
|
||||
poppler-qt4.3:${PORTSDIR}/graphics/poppler-qt4 \
|
||||
wmflite:${PORTSDIR}/graphics/libwmf
|
||||
wmflite:${PORTSDIR}/graphics/libwmf \
|
||||
chm.0:${PORTSDIR}/misc/chmlib
|
||||
BUILD_DEPENDS= py*-setuptools>=0:${PORTSDIR}/devel/py-setuptools \
|
||||
py*-sip>=0:${PORTSDIR}/devel/py-sip \
|
||||
py*-qt4-core>=0:${PORTSDIR}/devel/py-qt4-core \
|
||||
py*-qt4-gui>=0:${PORTSDIR}/x11-toolkits/py-qt4-gui
|
||||
py*-qt4-gui>=0:${PORTSDIR}/x11-toolkits/py-qt4-gui \
|
||||
py*-cssutils>=0:${PORTSDIR}/www/py-cssutils \
|
||||
py*-dateutil>=0:${PORTSDIR}/devel/py-dateutil \
|
||||
py*-lxml>=0:${PORTSDIR}/devel/py-lxml
|
||||
RUN_DEPENDS= xdg-open:${PORTSDIR}/devel/xdg-utils \
|
||||
py*-dnspython>=0:${PORTSDIR}/dns/py-dnspython \
|
||||
py*-dateutil>=0:${PORTSDIR}/devel/py-dateutil \
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
MD5 (calibre-0.6.27.tar.gz) = 4bfbf9b3630cd0b2c399906dd6df99b3
|
||||
SHA256 (calibre-0.6.27.tar.gz) = f8528e84b9f1f6a2ff5f9cad4cbd56ec372beef95eb17b47cd680c29b0fe5c02
|
||||
SIZE (calibre-0.6.27.tar.gz) = 10461078
|
||||
MD5 (calibre-0.7.22.tar.gz) = 02faeda9598efdf51605a2475bce36c8
|
||||
SHA256 (calibre-0.7.22.tar.gz) = 255d48d58750b5dde30b1b1899035b02ea15ce0cd5a9e5d5b60afd6e56e4e2f4
|
||||
SIZE (calibre-0.7.22.tar.gz) = 17342409
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
--- setup/__init__.py.orig 2009-10-11 19:11:10.000000000 +0400
|
||||
+++ setup/__init__.py 2009-10-11 19:12:17.000000000 +0400
|
||||
@@ -11,7 +11,8 @@
|
||||
is64bit = platform.architecture()[0] == '64bit'
|
||||
iswindows = re.search('win(32|64)', sys.platform)
|
||||
isosx = 'darwin' in sys.platform
|
||||
-islinux = not isosx and not iswindows
|
||||
+isfreebsd = 'freebsd' in sys.platform
|
||||
+islinux = not isosx and not iswindows and not isfreebsd
|
||||
SRC = os.path.abspath('src')
|
||||
sys.path.insert(0, SRC)
|
||||
sys.resources_location = os.path.join(os.path.dirname(SRC), 'resources')
|
||||
@@ -117,7 +118,7 @@
|
||||
self.real_user = os.environ.get('SUDO_USER', None)
|
||||
|
||||
def drop_privileges(self):
|
||||
- if not islinux or isosx:
|
||||
+ if not islinux or isosx or isfreebsd:
|
||||
return
|
||||
if self.real_user is not None:
|
||||
self.info('Dropping privileges to those of', self.real_user+':',
|
||||
@@ -128,7 +129,7 @@
|
||||
os.seteuid(int(self.real_uid))
|
||||
|
||||
def regain_privileges(self):
|
||||
- if not islinux or isosx:
|
||||
+ if not islinux or isosx or isfreebsd:
|
||||
return
|
||||
if os.geteuid() != 0 and self.orig_euid == 0:
|
||||
self.info('Trying to get root privileges')
|
|
@ -1,46 +0,0 @@
|
|||
--- setup/extensions.py.orig 2009-12-11 15:04:40.000000000 -0800
|
||||
+++ setup/extensions.py 2009-12-14 18:25:26.000000000 -0800
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
from PyQt4.pyqtconfig import QtGuiModuleMakefile
|
||||
|
||||
-from setup import Command, islinux, isosx, SRC, iswindows
|
||||
+from setup import Command, islinux, isfreebsd, isosx, SRC, iswindows
|
||||
from setup.build_environment import fc_inc, fc_lib, \
|
||||
fc_error, poppler_libs, poppler_lib_dirs, poppler_inc_dirs, podofo_inc, \
|
||||
podofo_lib, podofo_error, poppler_error, pyqt, OSX_SDK, NMAKE, \
|
||||
@@ -19,7 +19,7 @@
|
||||
magick_inc_dirs, magick_lib_dirs, png_lib_dirs, png_libs, \
|
||||
magick_error, magick_libs, ft_lib_dirs, ft_libs, jpg_libs, jpg_lib_dirs
|
||||
MT
|
||||
-isunix = islinux or isosx
|
||||
+isunix = islinux or isosx or isfreebsd
|
||||
|
||||
make = 'make' if isunix else NMAKE
|
||||
|
||||
@@ -141,6 +141,11 @@
|
||||
['calibre/devices/libusb.c'],
|
||||
ldflags=['-lusb-1.0']))
|
||||
|
||||
+if isfreebsd:
|
||||
+ if os.environ.get('WITH_USB', 'no') == 'yes':
|
||||
+ extensions.append(Extension('libusb',
|
||||
+ ['calibre/devices/libusb.c'],
|
||||
+ ldflags=['-lusb']))
|
||||
|
||||
if isunix:
|
||||
cc = os.environ.get('CC', 'gcc')
|
||||
@@ -160,6 +165,13 @@
|
||||
ldflags.append('-lpython'+sysconfig.get_python_version())
|
||||
|
||||
|
||||
+if isfreebsd:
|
||||
+ cflags.append('-pthread')
|
||||
+ ldflags.append('-shared')
|
||||
+ cflags.append('-I'+sysconfig.get_python_inc())
|
||||
+ ldflags.append('-lpython'+sysconfig.get_python_version())
|
||||
+
|
||||
+
|
||||
if isosx:
|
||||
x, p = ('x86_64', 'ppc64') if leopard_build else ('i386', 'ppc')
|
||||
archs = ['-arch', x, '-arch', p, '-isysroot',
|
|
@ -1,46 +0,0 @@
|
|||
--- setup/install.py.orig 2009-10-10 06:15:00.000000000 +0400
|
||||
+++ setup/install.py 2009-10-12 14:23:51.000000000 +0400
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import sys, os, textwrap, subprocess, shutil, tempfile, atexit, stat
|
||||
|
||||
-from setup import Command, islinux, basenames, modules, functions, \
|
||||
+from setup import Command, islinux, isfreebsd, basenames, modules, functions, \
|
||||
__appname__, __version__
|
||||
|
||||
HEADER = '''\
|
||||
@@ -115,7 +115,7 @@
|
||||
|
||||
|
||||
def pre_sub_commands(self, opts):
|
||||
- if not islinux:
|
||||
+ if not (islinux or isfreebsd):
|
||||
self.info('\nSetting up a source based development environment is only '
|
||||
'supported on linux. On other platforms, see the User Manual'
|
||||
' for help with setting up a development environment.')
|
||||
@@ -143,9 +143,9 @@
|
||||
self.warn('Failed to compile mount helper. Auto mounting of',
|
||||
' devices will not work')
|
||||
|
||||
- if os.geteuid() != 0:
|
||||
- return self.warn('Must be run as root to compile mount helper. Auto '
|
||||
- 'mounting of devices will not work.')
|
||||
+# if os.geteuid() != 0:
|
||||
+# return self.warn('Must be run as root to compile mount helper. Auto '
|
||||
+# 'mounting of devices will not work.')
|
||||
src = os.path.join(self.SRC, 'calibre', 'devices', 'linux_mount_helper.c')
|
||||
dest = os.path.join(self.staging_bindir, 'calibre-mount-helper')
|
||||
self.info('Installing mount helper to '+ dest)
|
||||
@@ -153,9 +153,9 @@
|
||||
ret = p.wait()
|
||||
if ret != 0:
|
||||
return warn()
|
||||
- os.chown(dest, 0, 0)
|
||||
- os.chmod(dest, stat.S_ISUID|stat.S_ISGID|stat.S_IRUSR|stat.S_IWUSR|\
|
||||
- stat.S_IXUSR|stat.S_IXGRP|stat.S_IXOTH)
|
||||
+# os.chown(dest, 0, 0)
|
||||
+# os.chmod(dest, stat.S_ISUID|stat.S_ISGID|stat.S_IRUSR|stat.S_IWUSR|\
|
||||
+# stat.S_IXUSR|stat.S_IXGRP|stat.S_IXOTH)
|
||||
self.manifest.append(dest)
|
||||
return dest
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
--- src/calibre/__init__.py.orig 2009-10-11 20:14:29.000000000 +0400
|
||||
+++ src/calibre/__init__.py 2009-10-11 20:14:41.000000000 +0400
|
||||
@@ -14,7 +14,7 @@
|
||||
from PyQt4.QtCore import QUrl
|
||||
from PyQt4.QtGui import QDesktopServices
|
||||
from calibre.startup import plugins, winutil, winutilerror
|
||||
-from calibre.constants import iswindows, isosx, islinux, isfrozen, \
|
||||
+from calibre.constants import iswindows, isosx, islinux, isfreebsd, isfrozen, \
|
||||
terminal_controller, preferred_encoding, \
|
||||
__appname__, __version__, __author__, \
|
||||
win32event, win32api, winerror, fcntl, \
|
|
@ -1,20 +0,0 @@
|
|||
--- src/calibre/constants.py.orig 2009-12-11 15:04:40.000000000 -0800
|
||||
+++ src/calibre/constants.py 2009-12-13 17:39:53.000000000 -0800
|
||||
@@ -22,7 +22,8 @@
|
||||
iswindows = 'win32' in sys.platform.lower() or 'win64' in sys.platform.lower()
|
||||
isosx = 'darwin' in sys.platform.lower()
|
||||
isnewosx = isosx and getattr(sys, 'new_app_bundle', False)
|
||||
-islinux = not(iswindows or isosx)
|
||||
+isfreebsd = 'freebsd' in sys.platform.lower()
|
||||
+islinux = not(iswindows or isosx or isfreebsd)
|
||||
isfrozen = hasattr(sys, 'frozen')
|
||||
|
||||
try:
|
||||
@@ -58,6 +59,7 @@
|
||||
'fontconfig', 'pdfreflow', 'progress_indicator'] + \
|
||||
(['winutil'] if iswindows else []) + \
|
||||
(['libusb'] if islinux else []) + \
|
||||
+ (['libusb'] if isfreebsd else []) + \
|
||||
(['usbobserver'] if isosx else []):
|
||||
try:
|
||||
p, err = __import__(plugin), ''
|
|
@ -1,11 +0,0 @@
|
|||
--- src/calibre/devices/libusb.c.orig 2009-12-13 17:36:03.000000000 -0800
|
||||
+++ src/calibre/devices/libusb.c 2009-12-13 17:36:08.000000000 -0800
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
#define PY_SSIZE_T_CLEAN
|
||||
#include <Python.h>
|
||||
-#include <libusb-1.0/libusb.h>
|
||||
+#include <libusb.h>
|
||||
|
||||
libusb_context *ctxt = NULL;
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
--- src/calibre/devices/libusb.py.orig 2009-10-10 06:15:00.000000000 +0400
|
||||
+++ src/calibre/devices/libusb.py 2009-10-11 23:19:54.000000000 +0400
|
||||
@@ -8,10 +8,10 @@
|
||||
c_ubyte, c_ushort, c_int, c_char, c_void_p, c_byte, c_uint
|
||||
from errno import EBUSY, ENOMEM
|
||||
|
||||
-from calibre import iswindows, isosx, load_library
|
||||
+from calibre import iswindows, isosx, isfreebsd, load_library
|
||||
|
||||
_libusb_name = 'libusb'
|
||||
-PATH_MAX = 511 if iswindows else 1024 if isosx else 4096
|
||||
+PATH_MAX = 511 if iswindows else 1024 if isosx else 1024 if isfreebsd else 4096
|
||||
if iswindows:
|
||||
class Structure(_Structure):
|
||||
_pack_ = 1
|
82
deskutils/calibre/files/patch-src_calibre_devices_scanner.py
Normal file
82
deskutils/calibre/files/patch-src_calibre_devices_scanner.py
Normal file
|
@ -0,0 +1,82 @@
|
|||
--- src/calibre/devices/scanner.py.orig 2010-10-06 22:06:18.000000000 -0700
|
||||
+++ src/calibre/devices/scanner.py 2010-10-06 22:07:36.000000000 -0700
|
||||
@@ -5,10 +5,10 @@
|
||||
manner.
|
||||
'''
|
||||
|
||||
-import sys, os, re
|
||||
+import sys, os, re, subprocess
|
||||
from threading import RLock
|
||||
|
||||
-from calibre import iswindows, isosx, plugins, islinux
|
||||
+from calibre import iswindows, isosx, plugins, islinux, isfreebsd
|
||||
|
||||
osx_scanner = win_scanner = linux_scanner = None
|
||||
|
||||
@@ -140,17 +140,65 @@
|
||||
ans.add(tuple(dev))
|
||||
return ans
|
||||
|
||||
+class FreeBSDScanner(object):
|
||||
+
|
||||
+ def __call__(self):
|
||||
+ ans = set([])
|
||||
+
|
||||
+ try:
|
||||
+ out = subprocess.Popen("/usr/sbin/usbconfig dump_device_desc | /usr/bin/awk 'function get_str(s) { split(s, a, /<|>/); if (a[2] != \"no string\") { return a[2]; } else { return \"\";} } BEGIN {state=0;} /^[[:space:]]+idVendor/ {state = 1; vendor = $3; next;} /idProduct/ {productid = $3; next;} /bcdDevice/ {bcd = $3; next;} /iManufacturer/ { manufacturer = get_str($0); next; } /iProduct/ { product = get_str($0); next;} /iSerialNumber/ { sn = get_str($0); next;} /^$/ {if (state == 1) { state = 0; printf(\"%s%%%%%s%%%%%s%%%%%s%%%%%s%%%%%s\\n\",vendor, productid, bcd, manufacturer, product, sn);} }'", shell=True, stdout=subprocess.PIPE).communicate()[0]
|
||||
+ except OSError, e:
|
||||
+ print >>sys.stderr, "Execution failed:", e
|
||||
+
|
||||
+ if out.strip() == "":
|
||||
+ return ans
|
||||
+ for line in out.strip().split("\n"):
|
||||
+ ven, prod, bcd, man, prod_string, serial = line.strip().split("%%", 6)
|
||||
+ dev = []
|
||||
+ try:
|
||||
+ dev.append(int(ven, 16))
|
||||
+ except:
|
||||
+ continue
|
||||
+ try:
|
||||
+ dev.append(int(prod, 16))
|
||||
+ except:
|
||||
+ continue
|
||||
+ try:
|
||||
+ dev.append(int(bcd, 16))
|
||||
+ except:
|
||||
+ continue
|
||||
+ try:
|
||||
+ dev.append(man)
|
||||
+ except:
|
||||
+ dev.append('')
|
||||
+ try:
|
||||
+ dev.append(prod_string)
|
||||
+ except:
|
||||
+ dev.append('')
|
||||
+ try:
|
||||
+ dev.append(serial)
|
||||
+ except:
|
||||
+ dev.append('')
|
||||
+
|
||||
+ ans.add(tuple(dev))
|
||||
+ return ans
|
||||
+
|
||||
linux_scanner = None
|
||||
|
||||
if islinux:
|
||||
linux_scanner = LinuxScanner()
|
||||
|
||||
+freebsd_scanner = None
|
||||
+
|
||||
+if isfreebsd:
|
||||
+ freebsd_scanner = FreeBSDScanner()
|
||||
+
|
||||
class DeviceScanner(object):
|
||||
|
||||
def __init__(self, *args):
|
||||
if isosx and osx_scanner is None:
|
||||
raise RuntimeError('The Python extension usbobserver must be available on OS X.')
|
||||
- self.scanner = win_scanner if iswindows else osx_scanner if isosx else linux_scanner
|
||||
+ self.scanner = win_scanner if iswindows else osx_scanner if isosx else freebsd_scanner if isfreebsd else linux_scanner
|
||||
self.devices = []
|
||||
|
||||
def scan(self):
|
|
@ -1,38 +0,0 @@
|
|||
--- src/calibre/devices/usbms/device.py.orig 2009-10-11 19:19:08.000000000 +0400
|
||||
+++ src/calibre/devices/usbms/device.py 2009-10-11 19:19:46.000000000 +0400
|
||||
@@ -22,7 +22,7 @@
|
||||
from calibre.devices.interface import DevicePlugin
|
||||
from calibre.devices.errors import DeviceError, FreeSpaceError
|
||||
from calibre.devices.usbms.deviceconfig import DeviceConfig
|
||||
-from calibre import iswindows, islinux, isosx, __appname__
|
||||
+from calibre import iswindows, islinux, isosx, isfreebsd, __appname__
|
||||
from calibre.utils.filenames import ascii_filename as sanitize, shorten_components_to
|
||||
|
||||
class Device(DeviceConfig, DevicePlugin):
|
||||
@@ -554,7 +554,7 @@
|
||||
def open(self):
|
||||
time.sleep(5)
|
||||
self._main_prefix = self._card_a_prefix = self._card_b_prefix = None
|
||||
- if islinux:
|
||||
+ if islinux or isfreebsd:
|
||||
try:
|
||||
self.open_linux()
|
||||
except DeviceError:
|
||||
@@ -621,7 +621,7 @@
|
||||
pass
|
||||
|
||||
def eject(self):
|
||||
- if islinux:
|
||||
+ if islinux or isfreebsd:
|
||||
try:
|
||||
self.eject_linux()
|
||||
except:
|
||||
@@ -655,7 +655,7 @@
|
||||
self._linux_mount_map = {}
|
||||
|
||||
def post_yank_cleanup(self):
|
||||
- if islinux:
|
||||
+ if islinux or isfreebsd:
|
||||
try:
|
||||
self.linux_post_yank()
|
||||
except:
|
|
@ -1,29 +0,0 @@
|
|||
--- src/calibre/ebooks/html/input.py.orig 2009-10-11 19:20:45.000000000 +0400
|
||||
+++ src/calibre/ebooks/html/input.py 2009-10-11 19:21:09.000000000 +0400
|
||||
@@ -20,7 +20,7 @@
|
||||
from calibre.customize.conversion import InputFormatPlugin
|
||||
from calibre.ebooks.chardet import xml_to_unicode
|
||||
from calibre.customize.conversion import OptionRecommendation
|
||||
-from calibre.constants import islinux
|
||||
+from calibre.constants import islinux, isfreebsd
|
||||
from calibre import unicode_path
|
||||
from calibre.utils.localization import get_lang
|
||||
|
||||
@@ -344,7 +344,7 @@
|
||||
self.added_resources = {}
|
||||
self.log = log
|
||||
for path, href in htmlfile_map.items():
|
||||
- if not islinux:
|
||||
+ if not (islinux or isfreebsd):
|
||||
path = path.lower()
|
||||
self.added_resources[path] = href
|
||||
self.urlnormalize, self.DirContainer = urlnormalize, DirContainer
|
||||
@@ -409,7 +409,7 @@
|
||||
link = os.path.abspath(link)
|
||||
if not os.access(link, os.R_OK):
|
||||
return link_
|
||||
- if not islinux:
|
||||
+ if not (islinux or isfreebsd):
|
||||
link = link.lower()
|
||||
if link not in self.added_resources:
|
||||
bhref = os.path.basename(link)
|
|
@ -1,18 +0,0 @@
|
|||
--- src/calibre/ebooks/lrf/html/table_as_image.py.orig 2009-10-12 00:04:02.000000000 +0400
|
||||
+++ src/calibre/ebooks/lrf/html/table_as_image.py 2009-10-12 00:04:09.000000000 +0400
|
||||
@@ -9,7 +9,7 @@
|
||||
import os, tempfile, atexit, shutil
|
||||
from PyQt4.Qt import QUrl, QApplication, QSize, QEventLoop, \
|
||||
SIGNAL, QPainter, QImage, QObject, Qt
|
||||
-from PyQt4.QtWebKit import QWebPage
|
||||
+from PyQt4.QtWebKit import *
|
||||
|
||||
|
||||
class HTMLTableRenderer(QObject):
|
||||
@@ -91,4 +91,4 @@
|
||||
QApplication([])
|
||||
tr = HTMLTableRenderer(html, base_dir, width, height, dpi, factor)
|
||||
tr.loop.exec_()
|
||||
- return tr.images, tr.tdir
|
||||
\ No newline at end of file
|
||||
+ return tr.images, tr.tdir
|
|
@ -1,20 +0,0 @@
|
|||
--- src/calibre/ebooks/pdf/pdftohtml.py.orig 2009-10-11 19:20:09.000000000 +0400
|
||||
+++ src/calibre/ebooks/pdf/pdftohtml.py 2009-10-11 19:20:25.000000000 +0400
|
||||
@@ -12,7 +12,7 @@
|
||||
from functools import partial
|
||||
|
||||
from calibre.ebooks import ConversionError, DRMError
|
||||
-from calibre import isosx, iswindows, islinux
|
||||
+from calibre import isosx, iswindows, islinux, isfreebsd
|
||||
from calibre import CurrentDir
|
||||
|
||||
PDFTOHTML = 'pdftohtml'
|
||||
@@ -22,7 +22,7 @@
|
||||
if iswindows and hasattr(sys, 'frozen'):
|
||||
PDFTOHTML = os.path.join(os.path.dirname(sys.executable), 'pdftohtml.exe')
|
||||
popen = partial(subprocess.Popen, creationflags=0x08) # CREATE_NO_WINDOW=0x08 so that no ugly console is popped up
|
||||
-if islinux and getattr(sys, 'frozen_path', False):
|
||||
+if (islinux or isfreebsd) and getattr(sys, 'frozen_path', False):
|
||||
PDFTOHTML = os.path.join(getattr(sys, 'frozen_path'), 'pdftohtml')
|
||||
|
||||
def pdftohtml(output_dir, pdf_path, no_images):
|
|
@ -1,11 +0,0 @@
|
|||
--- src/calibre/ebooks/pdf/writer.py.orig 2009-12-11 15:04:41.000000000 -0800
|
||||
+++ src/calibre/ebooks/pdf/writer.py 2009-12-13 16:45:34.000000000 -0800
|
||||
@@ -19,7 +19,7 @@
|
||||
from PyQt4 import QtCore
|
||||
from PyQt4.Qt import QUrl, QEventLoop, SIGNAL, QObject, \
|
||||
QPrinter, QMetaObject, QSizeF, Qt
|
||||
-from PyQt4.QtWebKit import QWebView
|
||||
+from PyQt4.QtWebKit import *
|
||||
|
||||
from pyPdf import PdfFileWriter, PdfFileReader
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
--- src/calibre/gui2/__init__.py.orig 2009-12-11 15:04:41.000000000 -0800
|
||||
+++ src/calibre/gui2/__init__.py 2009-12-13 16:46:37.000000000 -0800
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
ORG_NAME = 'KovidsBrain'
|
||||
APP_UID = 'libprs500'
|
||||
-from calibre import islinux, iswindows, isosx
|
||||
+from calibre import islinux, iswindows, isosx, isfreebsd
|
||||
from calibre.utils.config import Config, ConfigProxy, dynamic
|
||||
from calibre.utils.localization import set_qt_translator
|
||||
from calibre.ebooks.metadata.meta import get_metadata, metadata_from_formats
|
||||
@@ -535,7 +535,7 @@
|
||||
|
||||
def is_ok_to_use_qt():
|
||||
global gui_thread, _store_app
|
||||
- if islinux and ':' not in os.environ.get('DISPLAY', ''):
|
||||
+ if (islinux or isfreebsd) and ':' not in os.environ.get('DISPLAY', ''):
|
||||
return False
|
||||
if _store_app is None and QApplication.instance() is None:
|
||||
_store_app = QApplication([])
|
|
@ -1,22 +0,0 @@
|
|||
--- ./src/calibre/gui2/dialogs/metadata_single.py.orig 2009-10-11 19:16:07.000000000 +0400
|
||||
+++ ./src/calibre/gui2/dialogs/metadata_single.py 2009-10-11 19:16:34.000000000 +0400
|
||||
@@ -24,7 +24,7 @@
|
||||
from calibre.ebooks import BOOK_EXTENSIONS
|
||||
from calibre.ebooks.metadata import authors_to_sort_string, string_to_authors, authors_to_string
|
||||
from calibre.ebooks.metadata.library_thing import cover_from_isbn
|
||||
-from calibre import islinux
|
||||
+from calibre import islinux, isfreebsd
|
||||
from calibre.ebooks.metadata.meta import get_metadata
|
||||
from calibre.utils.config import prefs
|
||||
from calibre.customize.ui import run_plugins_on_import
|
||||
@@ -382,8 +382,8 @@
|
||||
height_of_rest = self.frameGeometry().height() - self.cover.height()
|
||||
width_of_rest = self.frameGeometry().width() - self.cover.width()
|
||||
ag = QCoreApplication.instance().desktop().availableGeometry(self)
|
||||
- self.cover.MAX_HEIGHT = ag.height()-(25 if islinux else 0)-height_of_rest
|
||||
- self.cover.MAX_WIDTH = ag.width()-(25 if islinux else 0)-width_of_rest
|
||||
+ self.cover.MAX_HEIGHT = ag.height()-(25 if (islinux or isfreebsd) else 0)-height_of_rest
|
||||
+ self.cover.MAX_WIDTH = ag.width()-(25 if (islinux or isfreebsd) else 0)-width_of_rest
|
||||
if cover:
|
||||
pm = QPixmap()
|
||||
pm.loadFromData(cover)
|
|
@ -1,29 +0,0 @@
|
|||
--- src/calibre/gui2/lrf_renderer/main.py.orig 2009-10-11 19:13:56.000000000 +0400
|
||||
+++ src/calibre/gui2/lrf_renderer/main.py 2009-10-11 19:14:32.000000000 +0400
|
||||
@@ -5,7 +5,7 @@
|
||||
from PyQt4.QtGui import QKeySequence, QPainter, QDialog, QSpinBox, QSlider, QIcon
|
||||
from PyQt4.QtCore import Qt, QObject, SIGNAL, QCoreApplication, QThread
|
||||
|
||||
-from calibre import __appname__, setup_cli_handlers, islinux
|
||||
+from calibre import __appname__, setup_cli_handlers, islinux, isfreebsd
|
||||
from calibre.ebooks.lrf.lrfparser import LRFDocument
|
||||
|
||||
from calibre.gui2 import ORG_NAME, APP_UID, error_dialog, \
|
||||
@@ -255,7 +255,7 @@
|
||||
level = logging.DEBUG if opts.verbose else logging.INFO
|
||||
logger = logging.getLogger('lrfviewer')
|
||||
setup_cli_handlers(logger, level)
|
||||
- if islinux:
|
||||
+ if islinux or isfreebsd:
|
||||
try: # Set lrfviewer as the default for LRF files for this user
|
||||
from subprocess import call
|
||||
call('xdg-mime default calibre-lrfviewer.desktop application/lrf', shell=True)
|
||||
@@ -304,7 +304,7 @@
|
||||
if hasattr(opts, 'help'):
|
||||
parser.print_help()
|
||||
return 1
|
||||
- pid = os.fork() if islinux else -1
|
||||
+ pid = os.fork() if (islinux or isfreebsd) else -1
|
||||
if pid <= 0:
|
||||
app = Application(args)
|
||||
app.setWindowIcon(QIcon(I('viewer.svg')))
|
|
@ -1,11 +0,0 @@
|
|||
--- src/calibre/gui2/main.py.orig 2009-12-11 15:04:41.000000000 -0800
|
||||
+++ src/calibre/gui2/main.py 2009-12-13 16:47:27.000000000 -0800
|
||||
@@ -6,7 +6,7 @@
|
||||
from PyQt4.Qt import QCoreApplication, QIcon, QMessageBox
|
||||
|
||||
from calibre import prints
|
||||
-from calibre.constants import iswindows, __appname__, isosx
|
||||
+from calibre.constants import iswindows, __appname__, isosx, isfreebsd
|
||||
from calibre.utils.ipc import ADDRESS, RC
|
||||
from calibre.gui2 import ORG_NAME, APP_UID, initialize_file_icon_provider, \
|
||||
Application
|
|
@ -1,11 +0,0 @@
|
|||
--- src/calibre/gui2/viewer/documentview.py.orig 2009-10-12 00:03:34.000000000 +0400
|
||||
+++ src/calibre/gui2/viewer/documentview.py 2009-10-12 00:03:45.000000000 +0400
|
||||
@@ -10,7 +10,7 @@
|
||||
QPainter, QPalette, QBrush, QFontDatabase, QDialog, \
|
||||
QColor, QPoint, QImage, QRegion, QVariant, \
|
||||
QFont, QObject, QApplication, pyqtSignature
|
||||
-from PyQt4.QtWebKit import QWebPage, QWebView, QWebSettings
|
||||
+from PyQt4.QtWebKit import *
|
||||
|
||||
from calibre.utils.config import Config, StringConfig
|
||||
from calibre.utils.localization import get_language
|
|
@ -1,20 +0,0 @@
|
|||
--- src/calibre/gui2/viewer/main.py.orig 2009-10-11 19:16:59.000000000 +0400
|
||||
+++ src/calibre/gui2/viewer/main.py 2009-10-11 19:17:14.000000000 +0400
|
||||
@@ -19,7 +19,7 @@
|
||||
info_dialog, error_dialog
|
||||
from calibre.ebooks.oeb.iterator import EbookIterator
|
||||
from calibre.ebooks import DRMError
|
||||
-from calibre.constants import islinux
|
||||
+from calibre.constants import islinux, isfreebsd
|
||||
from calibre.utils.config import Config, StringConfig, dynamic
|
||||
from calibre.gui2.search_box import SearchBox2
|
||||
from calibre.ebooks.metadata import MetaInformation
|
||||
@@ -665,7 +665,7 @@
|
||||
def main(args=sys.argv):
|
||||
parser = option_parser()
|
||||
opts, args = parser.parse_args(args)
|
||||
- pid = os.fork() if False and islinux else -1
|
||||
+ pid = os.fork() if False and (islinux or isfreebsd) else -1
|
||||
if pid <= 0:
|
||||
app = Application(args)
|
||||
app.setWindowIcon(QIcon(I('viewer.svg')))
|
|
@ -1,11 +0,0 @@
|
|||
--- src/calibre/gui2/viewer/printing.py.orig 2009-10-12 00:05:04.000000000 +0400
|
||||
+++ src/calibre/gui2/viewer/printing.py 2009-10-12 00:05:09.000000000 +0400
|
||||
@@ -12,7 +12,7 @@
|
||||
from PyQt4 import QtCore
|
||||
from PyQt4.Qt import QUrl, QEventLoop, SIGNAL, QObject, QApplication, Qt, \
|
||||
QPrinter, QPrintPreviewDialog, QPrintDialog, QDialog, QMetaObject, Q_ARG
|
||||
-from PyQt4.QtWebKit import QWebView
|
||||
+from PyQt4.QtWebKit import *
|
||||
|
||||
PRINTCSS = 'body{width:100%;margin:0;padding:0;font-family:Arial;color:#000;background:none;font-size:12pt;text-align:left;}h1,h2,h3,h4,h5,h6{font-family:Helvetica;}h1{font-size:19pt;}h2{font-size:17pt;}h3{font-size:15pt;}h4,h5,h6{font-size:12pt;}pre,code,samp{font:10ptCourier,monospace;white-space:pre-wrap;page-break-inside:avoid;}blockquote{margin:1.3em;padding:1em;font-size:10pt;}hr{background-color:#ccc;}aimg{border:none;}a:link,a:visited{background:transparent;font-weight:700;text-decoration:underline;color:#333;}a:link:after,a{color:#000;}table{margin:1px;text-align:left;}th{border-bottom:1pxsolid#333;font-weight:bold;}td{border-bottom:1pxsolid#333;}th,td{padding:4px10px4px0;}tfoot{font-style:italic;}caption{background:#fff;margin-bottom:2em;text-align:left;}thead{display:table-header-group;}tr{page-break-inside:avoid;}#header,.header,#footer,.footer,#navbar,.navbar,#navigation,.navigation,#rightSideBar,.rightSideBar,#leftSideBar,.leftSideBar{display:none;}'
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
--- src/calibre/linux.py.orig 2009-12-11 15:04:41.000000000 -0800
|
||||
+++ src/calibre/linux.py 2009-12-14 17:29:52.000000000 -0800
|
||||
@@ -128,20 +128,12 @@
|
||||
self.icon_resources = []
|
||||
self.menu_resources = []
|
||||
self.mime_resources = []
|
||||
- self.setup_completion()
|
||||
- self.setup_udev_rules()
|
||||
self.install_man_pages()
|
||||
- self.setup_desktop_integration()
|
||||
self.create_uninstaller()
|
||||
|
||||
from calibre.utils.config import config_dir
|
||||
if os.path.exists(config_dir):
|
||||
os.chdir(config_dir)
|
||||
- for f in os.listdir('.'):
|
||||
- if os.stat(f).st_uid == 0:
|
||||
- os.rmdir(f) if os.path.isdir(f) else os.unlink(f)
|
||||
- if os.stat(config_dir).st_uid == 0:
|
||||
- os.rmdir(config_dir)
|
||||
|
||||
if warn is None and self.warnings:
|
||||
self.info('There were %d warnings'%len(self.warnings))
|
||||
@@ -318,7 +310,7 @@
|
||||
def install_man_pages(self):
|
||||
try:
|
||||
from calibre.utils.help2man import create_man_page
|
||||
- manpath = os.path.join(self.opts.staging_sharedir, 'man/man1')
|
||||
+ manpath = os.path.join(self.opts.staging_root, 'man/man1')
|
||||
if not os.path.exists(manpath):
|
||||
os.makedirs(manpath)
|
||||
self.info('Installing MAN pages...')
|
||||
@@ -331,7 +323,7 @@
|
||||
continue
|
||||
parser = parser()
|
||||
raw = create_man_page(prog, parser)
|
||||
- manfile = os.path.join(manpath, prog+'.1'+__appname__+'.bz2')
|
||||
+ manfile = os.path.join(manpath, prog+'.1')
|
||||
self.info('\tInstalling MAN page for', prog)
|
||||
open(manfile, 'wb').write(raw)
|
||||
self.manifest.append(manfile)
|
|
@ -1,19 +0,0 @@
|
|||
--- src/calibre/utils/help2man.py.orig 2009-10-11 23:44:37.000000000 +0400
|
||||
+++ src/calibre/utils/help2man.py 2009-10-11 23:49:58.000000000 +0400
|
||||
@@ -3,7 +3,7 @@
|
||||
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
-import time, bz2
|
||||
+import time, gzip
|
||||
|
||||
from calibre.constants import __version__, __appname__, __author__
|
||||
|
||||
@@ -57,6 +57,6 @@
|
||||
lines = [x if isinstance(x, unicode) else unicode(x, 'utf-8', 'replace') for
|
||||
x in lines]
|
||||
|
||||
- return bz2.compress((u'\n'.join(lines)).encode('utf-8'))
|
||||
+ return (u'\n'.join(lines)).encode('utf-8')
|
||||
|
||||
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue