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 *_ui.py
moc_*.cpp moc_*.cpp
plugins src/calibre/plugins
src/calibre/gui2/pictureflow/.build/ src/calibre/gui2/pictureflow/.build/
src/calibre/gui2/pictureflow/PyQt/.build/ src/calibre/gui2/pictureflow/PyQt/.build/
src/calibre/gui2/pictureflow/Makefile src/calibre/gui2/pictureflow/Makefile

View File

@ -21,7 +21,7 @@ manual:
make -C src/calibre/manual clean html make -C src/calibre/manual clean html
pictureflow : pictureflow :
mkdir -p plugins && rm -f plugins/*pictureflow* && \ mkdir -p src/calibre/plugins && rm -f src/calibre/plugins/*pictureflow* && \
cd src/calibre/gui2/pictureflow && \ cd src/calibre/gui2/pictureflow && \
mkdir -p .build && cd .build && rm -f * && \ mkdir -p .build && cd .build && rm -f * && \
qmake ../pictureflow-lib.pro && make && \ qmake ../pictureflow-lib.pro && make && \
@ -30,7 +30,7 @@ pictureflow :
cd .build && rm -f * && \ cd .build && rm -f * && \
python ../configure.py && make && \ python ../configure.py && make && \
cd ../../../../../.. && \ cd ../../../../../.. && \
cp src/calibre/gui2/pictureflow/.build/libpictureflow.so.?.?.? src/calibre/gui2/pictureflow/PyQt/.build/pictureflow.so plugins/ && \ 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('plugins/libpictureflow.so.*')[0]; os.rename(lp, lp[:-4])" 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__': if __name__ == '__main__':
from setuptools import setup, find_packages 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') entry_points['console_scripts'].append('calibre_postinstall = calibre.linux:post_install')
setup( setup(
cmdclass = { 'egg_info' : CalibreEggInfo, },
name=APPNAME, name=APPNAME,
packages = find_packages('src'), packages = find_packages('src'),
package_dir = { '' : 'src' }, package_dir = { '' : 'src' },
@ -61,14 +71,16 @@ if __name__ == '__main__':
author_email='kovid@kovidgoyal.net', author_email='kovid@kovidgoyal.net',
url = 'http://%s.kovidgoyal.net'%APPNAME, url = 'http://%s.kovidgoyal.net'%APPNAME,
include_package_data = True, include_package_data = True,
package_data = {'': ['*.so.*', '*.so']},
entry_points = entry_points, entry_points = entry_points,
zip_safe = True, zip_safe = False,
options = { 'bdist_egg' : {'exclude_source_files': True,}, },
description = description =
""" '''
Ebook management application. E-book management application.
""", ''',
long_description = 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. %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 For screenshots: https://%s.kovidgoyal.net/wiki/Screenshots
@ -82,7 +94,7 @@ if __name__ == '__main__':
To update your copy of the source code: To update your copy of the source code:
bzr merge bzr merge
"""%(APPNAME, APPNAME, APPNAME, APPNAME, APPNAME), '''%(APPNAME, APPNAME, APPNAME, APPNAME, APPNAME),
license = 'GPL', license = 'GPL',
classifiers = [ classifiers = [
'Development Status :: 4 - Beta', 'Development Status :: 4 - Beta',

View File

@ -540,3 +540,20 @@ def strftime(fmt, t=time.localtime()):
return unicode(result, locale.getpreferredencoding(), 'replace') return unicode(result, locale.getpreferredencoding(), 'replace')
except: except:
return unicode(result, 'utf-8', 'replace') 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). # ".dll" extension on Windows).
makefile.extra_lib_dirs = ['../../.build'] makefile.extra_lib_dirs = ['../../.build']
makefile.extra_libs = ["pictureflow"] makefile.extra_libs = ["pictureflow"]
makefile.extra_lflags = ['-Wl,--rpath=.']
# Generate the Makefile itself. # Generate the Makefile itself.
makefile.generate() makefile.generate()

View File

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