IGN: Setup loading of pictureflow plugin in linux

This commit is contained in:
Kovid Goyal 2008-05-15 00:23:01 -07:00
parent 33d1c53798
commit d91aaaf1de
6 changed files with 42 additions and 11 deletions

View File

@ -1,6 +1,6 @@
*_ui.py
moc_*.cpp
plugins
src/calibre/plugins
src/calibre/gui2/pictureflow/.build/
src/calibre/gui2/pictureflow/PyQt/.build/
src/calibre/gui2/pictureflow/Makefile

View File

@ -21,7 +21,7 @@ manual:
make -C src/calibre/manual clean html
pictureflow :
mkdir -p plugins && rm -f plugins/*pictureflow* && \
mkdir -p src/calibre/plugins && rm -f src/calibre/plugins/*pictureflow* && \
cd src/calibre/gui2/pictureflow && \
mkdir -p .build && cd .build && rm -f * && \
qmake ../pictureflow-lib.pro && make && \
@ -30,7 +30,7 @@ pictureflow :
cd .build && rm -f * && \
python ../configure.py && make && \
cd ../../../../../.. && \
cp src/calibre/gui2/pictureflow/.build/libpictureflow.so.?.?.? src/calibre/gui2/pictureflow/PyQt/.build/pictureflow.so plugins/ && \
python -c "import os, glob; lp = glob.glob('plugins/libpictureflow.so.*')[0]; os.rename(lp, lp[:-4])"
cp src/calibre/gui2/pictureflow/.build/libpictureflow.so.?.?.? src/calibre/gui2/pictureflow/PyQt/.build/pictureflow.so src/calibre/plugins/ && \
python -c "import os, glob; lp = glob.glob('src/calibre/plugins/libpictureflow.so.*')[0]; os.rename(lp, lp[:-4])"

View File

@ -48,11 +48,21 @@ main_functions = {
if __name__ == '__main__':
from setuptools import setup, find_packages
import subprocess
import subprocess, glob
from setuptools.command.egg_info import egg_info
class CalibreEggInfo(egg_info):
def run(self):
files = glob.glob('plugins/*')
egg_info.run(self)
entry_points['console_scripts'].append('calibre_postinstall = calibre.linux:post_install')
setup(
cmdclass = { 'egg_info' : CalibreEggInfo, },
name=APPNAME,
packages = find_packages('src'),
package_dir = { '' : 'src' },
@ -61,14 +71,16 @@ if __name__ == '__main__':
author_email='kovid@kovidgoyal.net',
url = 'http://%s.kovidgoyal.net'%APPNAME,
include_package_data = True,
package_data = {'': ['*.so.*', '*.so']},
entry_points = entry_points,
zip_safe = True,
zip_safe = False,
options = { 'bdist_egg' : {'exclude_source_files': True,}, },
description =
"""
Ebook management application.
""",
'''
E-book management application.
''',
long_description =
"""
'''
%s is an e-book library manager. It can view, convert and catalog e-books in most of the major e-book formats. It can also talk to a few e-book reader devices. It can go out to the internet and fetch metadata for your books. It can download newspapers and convert them into e-books for convenient reading. It is cross platform, running on Linux, Windows and OS X.
For screenshots: https://%s.kovidgoyal.net/wiki/Screenshots
@ -82,7 +94,7 @@ if __name__ == '__main__':
To update your copy of the source code:
bzr merge
"""%(APPNAME, APPNAME, APPNAME, APPNAME, APPNAME),
'''%(APPNAME, APPNAME, APPNAME, APPNAME, APPNAME),
license = 'GPL',
classifiers = [
'Development Status :: 4 - Beta',

View File

@ -540,3 +540,20 @@ def strftime(fmt, t=time.localtime()):
return unicode(result, locale.getpreferredencoding(), 'replace')
except:
return unicode(result, 'utf-8', 'replace')
if islinux:
import pkg_resources
if not os.environ.has_key('LD_LIBRARY_PATH'):
os.environ['LD_LIBRARY_PATH'] = ''
plugins = pkg_resources.resource_filename(__appname__, 'plugins')
os.environ['LD_LIBRARY_PATH'] = plugins + ':' + os.environ['LD_LIBRARY_PATH']
sys.path.insert(1, plugins)
cwd = os.getcwd()
os.chdir(plugins)
try:
import pictureflow
except:
import traceback
traceback.print_exc()
pictureflow = None
os.chdir(cwd)

View File

@ -32,6 +32,7 @@ makefile = pyqtconfig.QtGuiModuleMakefile (
# ".dll" extension on Windows).
makefile.extra_lib_dirs = ['../../.build']
makefile.extra_libs = ["pictureflow"]
makefile.extra_lflags = ['-Wl,--rpath=.']
# Generate the Makefile itself.
makefile.generate()

View File

@ -123,6 +123,7 @@ Take your pick:
* Convertor And LIBRary for E-books
* A high *calibre* product
* A tribute to the SONY Librie which was the first e-ink based e-book reader
* My wife chose it ;-)
Why does |app| show only some of my fonts on OS X?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~