This commit is contained in:
Kovid Goyal 2010-11-29 13:13:10 -07:00
parent 25467ff22a
commit eeda4caf10
4 changed files with 30 additions and 22 deletions

View File

@ -18,7 +18,7 @@ __all__ = [
'pypi_register', 'pypi_upload', 'upload_to_server', 'pypi_register', 'pypi_upload', 'upload_to_server',
'upload_user_manual', 'upload_to_mobileread', 'upload_demo', 'upload_user_manual', 'upload_to_mobileread', 'upload_demo',
'upload_to_sourceforge', 'upload_to_google_code', 'upload_to_sourceforge', 'upload_to_google_code',
'linux32', 'linux64', 'linux', 'linux_freeze', 'linux_freeze2', 'linux32', 'linux64', 'linux', 'linux_freeze',
'osx32_freeze', 'osx', 'rsync', 'push', 'osx32_freeze', 'osx', 'rsync', 'push',
'win32_freeze', 'win32', 'win', 'win32_freeze', 'win32', 'win',
'stage1', 'stage2', 'stage3', 'stage4', 'publish' 'stage1', 'stage2', 'stage3', 'stage4', 'publish'
@ -79,10 +79,8 @@ from setup.installer.linux import Linux, Linux32, Linux64
linux = Linux() linux = Linux()
linux32 = Linux32() linux32 = Linux32()
linux64 = Linux64() linux64 = Linux64()
from setup.installer.linux.freeze import LinuxFreeze from setup.installer.linux.freeze2 import LinuxFreeze
linux_freeze = LinuxFreeze() linux_freeze = LinuxFreeze()
from setup.installer.linux.freeze2 import LinuxFreeze2
linux_freeze2 = LinuxFreeze2()
from setup.installer.osx import OSX from setup.installer.osx import OSX
osx = OSX() osx = OSX()

View File

@ -17,7 +17,7 @@ class Linux32(VMInstaller):
INSTALLER_EXT = 'tar.bz2' INSTALLER_EXT = 'tar.bz2'
VM_NAME = 'gentoo32_build' VM_NAME = 'gentoo32_build'
VM = '/vmware/bin/gentoo32_build' VM = '/vmware/bin/gentoo32_build'
FREEZE_COMMAND = 'linux_freeze2' FREEZE_COMMAND = 'linux_freeze'
FREEZE_TEMPLATE = 'sudo python -OO setup.py {freeze_command}' FREEZE_TEMPLATE = 'sudo python -OO setup.py {freeze_command}'

View File

@ -16,21 +16,9 @@ SITE_PACKAGES = ['IPython', 'PIL', 'dateutil', 'dns', 'PyQt4', 'mechanize',
'sip.so', 'BeautifulSoup.py', 'cssutils', 'encutils', 'lxml', 'sip.so', 'BeautifulSoup.py', 'cssutils', 'encutils', 'lxml',
'sipconfig.py', 'xdg'] 'sipconfig.py', 'xdg']
gcc = subprocess.Popen(["gcc-config", "-c"], stdout=subprocess.PIPE).communicate()[0]
chost, _, gcc = gcc.rpartition('-')
stdcpp = '/usr/lib/gcc/%s/%s/libstdc++.so.?'%(chost.strip(), gcc.strip())
stdcpp = glob.glob(stdcpp)[-1]
is64bit = platform.architecture()[0] == '64bit'
arch = 'x86_64' if is64bit else 'i686'
ffi = '/usr/lib/libffi.so.5' if is64bit else '/usr/lib/gcc/i686-pc-linux-gnu/4.4.1/libffi.so.4'
QTDIR = '/usr/lib/qt4' QTDIR = '/usr/lib/qt4'
QTDLLS = ('QtCore', 'QtGui', 'QtNetwork', 'QtSvg', 'QtXml', 'QtWebKit', 'QtDBus') QTDLLS = ('QtCore', 'QtGui', 'QtNetwork', 'QtSvg', 'QtXml', 'QtWebKit', 'QtDBus')
binary_includes = [ binary_includes = [
'/usr/bin/pdftohtml', '/usr/bin/pdftohtml',
'/usr/lib/libwmflite-0.2.so.7', '/usr/lib/libwmflite-0.2.so.7',
@ -49,8 +37,6 @@ binary_includes = [
'/usr/lib/libjpeg.so.8', '/usr/lib/libjpeg.so.8',
'/usr/lib/libxslt.so.1', '/usr/lib/libxslt.so.1',
'/usr/lib/libgthread-2.0.so.0', '/usr/lib/libgthread-2.0.so.0',
stdcpp,
ffi,
'/usr/lib/libpng14.so.14', '/usr/lib/libpng14.so.14',
'/usr/lib/libexslt.so.0', '/usr/lib/libexslt.so.0',
'/usr/lib/libMagickWand.so.4', '/usr/lib/libMagickWand.so.4',
@ -66,7 +52,11 @@ binary_includes = [
] ]
binary_includes += [os.path.join(QTDIR, 'lib%s.so.4'%x) for x in QTDLLS] binary_includes += [os.path.join(QTDIR, 'lib%s.so.4'%x) for x in QTDLLS]
class LinuxFreeze2(Command): is64bit = platform.architecture()[0] == '64bit'
arch = 'x86_64' if is64bit else 'i686'
class LinuxFreeze(Command):
def run(self, opts): def run(self, opts):
self.drop_privileges() self.drop_privileges()
@ -93,7 +83,21 @@ class LinuxFreeze2(Command):
self.info('Copying libs...') self.info('Copying libs...')
os.mkdir(self.lib_dir) os.mkdir(self.lib_dir)
os.mkdir(self.bin_dir) os.mkdir(self.bin_dir)
for x in binary_includes:
gcc = subprocess.Popen(["gcc-config", "-c"], stdout=subprocess.PIPE).communicate()[0]
chost, _, gcc = gcc.rpartition('-')
gcc_lib = '/usr/lib/gcc/%s/%s/'%(chost.strip(), gcc.strip())
stdcpp = gcc_lib+'libstdc++.so.?'
stdcpp = glob.glob(stdcpp)[-1]
ffi = gcc_lib+'libffi.so.?'
ffi = glob.glob(ffi)
if ffi:
ffi = ffi[-1]
else:
ffi = glob.glob('/usr/lib/libffi.so.?')[-1]
for x in binary_includes + [stdcpp, ffi]:
dest = self.bin_dir if '/bin/' in x else self.lib_dir dest = self.bin_dir if '/bin/' in x else self.lib_dir
shutil.copy2(x, dest) shutil.copy2(x, dest)
shutil.copy2('/usr/lib/libpython%s.so.1.0'%self.py_ver, dest) shutil.copy2('/usr/lib/libpython%s.so.1.0'%self.py_ver, dest)
@ -268,7 +272,6 @@ class LinuxFreeze2(Command):
base=`dirname $path` base=`dirname $path`
lib=$base/lib lib=$base/lib
export LD_LIBRARY_PATH=$lib:$LD_LIBRARY_PATH export LD_LIBRARY_PATH=$lib:$LD_LIBRARY_PATH
export QT_PLUGIN_PATH=$lib/qt_plugins
export MAGICK_CONFIGURE_PATH=$lib/ImageMagick/config export MAGICK_CONFIGURE_PATH=$lib/ImageMagick/config
export MAGICK_CODER_MODULE_PATH=$lib/ImageMagick/modules-Q16/coders export MAGICK_CODER_MODULE_PATH=$lib/ImageMagick/modules-Q16/coders
export MAGICK_CODER_FILTER_PATH=$lib/ImageMagick/modules-Q16/filters export MAGICK_CODER_FILTER_PATH=$lib/ImageMagick/modules-Q16/filters
@ -336,12 +339,19 @@ class LinuxFreeze2(Command):
def set_helper(): def set_helper():
__builtin__.help = _Helper() __builtin__.help = _Helper()
def set_qt_plugin_path():
from PyQt4.Qt import QCoreApplication
paths = list(map(unicode, QCoreApplication.libraryPaths()))
paths.insert(0, sys.frozen_path + '/lib/qt_plugins')
QCoreApplication.setLibraryPaths(paths)
def main(): def main():
try: try:
sys.argv[0] = sys.calibre_basename sys.argv[0] = sys.calibre_basename
set_default_encoding() set_default_encoding()
set_helper() set_helper()
set_qt_plugin_path()
mod = __import__(sys.calibre_module, fromlist=[1]) mod = __import__(sys.calibre_module, fromlist=[1])
func = getattr(mod, sys.calibre_function) func = getattr(mod, sys.calibre_function)
return func() return func()