mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix linux binary installer
This commit is contained in:
parent
2199ef433c
commit
9dcf9200d0
@ -6,7 +6,7 @@ __docformat__ = 'restructuredtext en'
|
|||||||
'''
|
'''
|
||||||
Create linux binary.
|
Create linux binary.
|
||||||
'''
|
'''
|
||||||
import glob, sys, subprocess, tarfile, os, re
|
import glob, sys, subprocess, tarfile, os, re, py_compile
|
||||||
HOME = '/home/kovid'
|
HOME = '/home/kovid'
|
||||||
PYINSTALLER = os.path.expanduser('~/build/pyinstaller')
|
PYINSTALLER = os.path.expanduser('~/build/pyinstaller')
|
||||||
CALIBREPREFIX = '___'
|
CALIBREPREFIX = '___'
|
||||||
@ -64,12 +64,14 @@ temp = ['keyword', 'codeop']
|
|||||||
|
|
||||||
recipes = ['calibre', 'web', 'feeds', 'recipes']
|
recipes = ['calibre', 'web', 'feeds', 'recipes']
|
||||||
prefix = '.'.join(recipes)+'.'
|
prefix = '.'.join(recipes)+'.'
|
||||||
|
recipes_toc = []
|
||||||
|
extra_toc = [
|
||||||
|
('keyword', '/usr/lib/python2.5/keyword.pyo', 'PYSOURCE'),
|
||||||
|
('codeop', '/usr/lib/python2.5/codeop.pyo', 'PYSOURCE')
|
||||||
|
]
|
||||||
for f in glob.glob(os.path.join(CALIBRESRC, *(recipes+['*.py']))):
|
for f in glob.glob(os.path.join(CALIBRESRC, *(recipes+['*.py']))):
|
||||||
temp.append(prefix + os.path.basename(f).partition('.')[0])
|
py_compile.compile(f, doraise=True)
|
||||||
hook = os.path.expanduser('~/temp/hook-calibre.py')
|
recipes_toc.append((prefix + os.path.basename(f).partition('.')[0], f+'o', 'PYSOURCE'))
|
||||||
f = open(hook, 'wb')
|
|
||||||
hook_script = 'hiddenimports = %s'%repr(temp)
|
|
||||||
f.write(hook_script)
|
|
||||||
|
|
||||||
sys.path.insert(0, CALIBRESRC)
|
sys.path.insert(0, CALIBRESRC)
|
||||||
from calibre.linux import entry_points
|
from calibre.linux import entry_points
|
||||||
@ -82,18 +84,19 @@ for entry in entry_points['console_scripts'] + entry_points['gui_scripts']:
|
|||||||
executables.append(fields[0].strip())
|
executables.append(fields[0].strip())
|
||||||
scripts.append(os.path.join(CALIBRESRC, *map(lambda x: x.strip(), fields[1].split(':')[0].split('.')))+'.py')
|
scripts.append(os.path.join(CALIBRESRC, *map(lambda x: x.strip(), fields[1].split(':')[0].split('.')))+'.py')
|
||||||
|
|
||||||
recipes = Analysis(glob.glob(os.path.join(CALIBRESRC, 'calibre', 'web', 'feeds', 'recipes', '*.py')),
|
|
||||||
pathex=[CALIBRESRC], hookspath=[os.path.dirname(hook)], excludes=excludes)
|
|
||||||
analyses = [Analysis([os.path.join(HOMEPATH,'support/_mountzlib.py'), os.path.join(HOMEPATH,'support/useUnicode.py'), loader, script],
|
analyses = [Analysis([os.path.join(HOMEPATH,'support/_mountzlib.py'), os.path.join(HOMEPATH,'support/useUnicode.py'), loader, script],
|
||||||
pathex=[PYINSTALLER, CALIBRESRC, CALIBREPLUGINS], excludes=excludes) for script in scripts]
|
pathex=[PYINSTALLER, CALIBRESRC, CALIBREPLUGINS], excludes=excludes) for script in scripts]
|
||||||
|
|
||||||
pyz = TOC()
|
pyz = TOC()
|
||||||
binaries = TOC()
|
binaries = TOC()
|
||||||
|
|
||||||
|
pyz += extra_toc
|
||||||
|
pyz += recipes_toc
|
||||||
|
|
||||||
for a in analyses:
|
for a in analyses:
|
||||||
pyz = a.pure + pyz
|
pyz = a.pure + pyz
|
||||||
binaries = a.binaries + binaries
|
binaries = a.binaries + binaries
|
||||||
pyz = PYZ(pyz + recipes.pure, name='library.pyz')
|
pyz = PYZ(pyz, name='library.pyz')
|
||||||
|
|
||||||
built_executables = []
|
built_executables = []
|
||||||
for script, exe, a in zip(scripts, executables, analyses):
|
for script, exe, a in zip(scripts, executables, analyses):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user