mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
IGN:...
This commit is contained in:
parent
ef06fbee81
commit
18dc1ce656
@ -95,9 +95,19 @@ class Develop(Command):
|
|||||||
if self.staging_sharedir is None:
|
if self.staging_sharedir is None:
|
||||||
self.staging_sharedir = opts.staging_sharedir = self.j(opts.staging_root, 'share')
|
self.staging_sharedir = opts.staging_sharedir = self.j(opts.staging_root, 'share')
|
||||||
|
|
||||||
|
self.staging_libdir = opts.staging_libdir = self.j(self.staging_libdir, 'calibre')
|
||||||
|
self.staging_sharedir = opts.staging_sharedir = self.j(self.staging_sharedir, 'calibre')
|
||||||
|
|
||||||
if self.__class__.__name__ == 'Develop':
|
if self.__class__.__name__ == 'Develop':
|
||||||
self.libdir = self.SRC
|
self.libdir = self.SRC
|
||||||
self.sharedir = self.RESOURCES
|
self.sharedir = self.RESOURCES
|
||||||
|
else:
|
||||||
|
self.libdir = self.j(self.libdir, 'calibre')
|
||||||
|
self.sharedir = self.j(self.sharedir, 'calibre')
|
||||||
|
self.info('INSTALL paths:')
|
||||||
|
self.info('\tLIB:', self.staging_libdir)
|
||||||
|
self.info('\tSHARE:', self.staging_sharedir)
|
||||||
|
|
||||||
|
|
||||||
def pre_sub_commands(self, opts):
|
def pre_sub_commands(self, opts):
|
||||||
if not islinux:
|
if not islinux:
|
||||||
@ -113,6 +123,7 @@ class Develop(Command):
|
|||||||
c
|
c
|
||||||
|
|
||||||
def run(self, opts):
|
def run(self, opts):
|
||||||
|
self.manifest = []
|
||||||
self.opts = opts
|
self.opts = opts
|
||||||
self.regain_privileges()
|
self.regain_privileges()
|
||||||
self.consolidate_paths()
|
self.consolidate_paths()
|
||||||
@ -140,6 +151,7 @@ class Develop(Command):
|
|||||||
os.chown(dest, 0, 0)
|
os.chown(dest, 0, 0)
|
||||||
os.chmod(dest, stat.S_ISUID|stat.S_ISGID|stat.S_IRUSR|stat.S_IWUSR|\
|
os.chmod(dest, stat.S_ISUID|stat.S_ISGID|stat.S_IRUSR|stat.S_IWUSR|\
|
||||||
stat.S_IXUSR|stat.S_IXGRP|stat.S_IXOTH)
|
stat.S_IXUSR|stat.S_IXGRP|stat.S_IXOTH)
|
||||||
|
self.manifest.append(dest)
|
||||||
return dest
|
return dest
|
||||||
|
|
||||||
def install_files(self):
|
def install_files(self):
|
||||||
@ -148,7 +160,8 @@ class Develop(Command):
|
|||||||
def run_postinstall(self):
|
def run_postinstall(self):
|
||||||
if self.opts.postinstall:
|
if self.opts.postinstall:
|
||||||
from calibre.linux import PostInstall
|
from calibre.linux import PostInstall
|
||||||
PostInstall(self.opts, info=self.info, warn=self.warn)
|
PostInstall(self.opts, info=self.info, warn=self.warn,
|
||||||
|
manifest=self.manifest)
|
||||||
|
|
||||||
def success(self):
|
def success(self):
|
||||||
self.info('\nDevelopment environment successfully setup')
|
self.info('\nDevelopment environment successfully setup')
|
||||||
@ -171,6 +184,7 @@ class Develop(Command):
|
|||||||
self.info('Installing binary:', path)
|
self.info('Installing binary:', path)
|
||||||
open(path, 'wb').write(script)
|
open(path, 'wb').write(script)
|
||||||
os.chmod(path, self.MODE)
|
os.chmod(path, self.MODE)
|
||||||
|
self.manifest.append(path)
|
||||||
|
|
||||||
|
|
||||||
class Install(Develop):
|
class Install(Develop):
|
||||||
@ -224,6 +238,7 @@ class Install(Develop):
|
|||||||
if os.path.exists(dest):
|
if os.path.exists(dest):
|
||||||
shutil.rmtree(dest)
|
shutil.rmtree(dest)
|
||||||
shutil.copytree(self.RESOURCES, dest)
|
shutil.copytree(self.RESOURCES, dest)
|
||||||
|
self.manifest.extend([self.staging_libdir, self.staging_sharedir])
|
||||||
|
|
||||||
def success(self):
|
def success(self):
|
||||||
self.info('\n\ncalibre successfully installed. You can start'
|
self.info('\n\ncalibre successfully installed. You can start'
|
||||||
|
@ -87,7 +87,7 @@ class PostInstall:
|
|||||||
'bin')
|
'bin')
|
||||||
if not self.opts.staging_sharedir:
|
if not self.opts.staging_sharedir:
|
||||||
self.opts.staging_sharedir = os.path.join(self.opts.staging_root,
|
self.opts.staging_sharedir = os.path.join(self.opts.staging_root,
|
||||||
'etc')
|
'share', 'calibre')
|
||||||
self.opts.staging_etc = '/etc' if self.opts.staging_root == '/usr' else \
|
self.opts.staging_etc = '/etc' if self.opts.staging_root == '/usr' else \
|
||||||
os.path.join(self.opts.staging_root, 'etc')
|
os.path.join(self.opts.staging_root, 'etc')
|
||||||
|
|
||||||
@ -143,16 +143,16 @@ class PostInstall:
|
|||||||
from calibre.utils.smtp import option_parser as smtp_op
|
from calibre.utils.smtp import option_parser as smtp_op
|
||||||
any_formats = ['epub', 'htm', 'html', 'xhtml', 'xhtm', 'rar', 'zip',
|
any_formats = ['epub', 'htm', 'html', 'xhtml', 'xhtm', 'rar', 'zip',
|
||||||
'txt', 'lit', 'rtf', 'pdf', 'prc', 'mobi', 'fb2', 'odt']
|
'txt', 'lit', 'rtf', 'pdf', 'prc', 'mobi', 'fb2', 'odt']
|
||||||
if os.path.exists(os.path.join(self.opts.staging_sharedir,
|
bc = os.path.join(os.path.dirname(self.opts.staging_sharedir),
|
||||||
'bash-completion')):
|
'bash-completion')
|
||||||
f = os.path.join(self.opts.staging_sharedir,
|
if os.path.exists(bc):
|
||||||
'bash-completion', 'calibre')
|
f = os.path.join(bc, 'calibre')
|
||||||
else:
|
else:
|
||||||
f = os.path.join(self.opts.staging_etc,
|
f = os.path.join(self.opts.staging_etc, 'bash_completion.d/calibre')
|
||||||
'bash_completion.d/calibre')
|
|
||||||
if not os.path.exists(os.path.dirname(f)):
|
if not os.path.exists(os.path.dirname(f)):
|
||||||
os.makedirs(os.path.dirname(f))
|
os.makedirs(os.path.dirname(f))
|
||||||
self.manifest.append(f)
|
self.manifest.append(f)
|
||||||
|
self.info('Installing bash completion to', f)
|
||||||
with open(f, 'wb') as f:
|
with open(f, 'wb') as f:
|
||||||
f.write('# calibre Bash Shell Completion\n')
|
f.write('# calibre Bash Shell Completion\n')
|
||||||
f.write(opts_and_exts('calibre', guiop, any_formats))
|
f.write(opts_and_exts('calibre', guiop, any_formats))
|
||||||
@ -359,9 +359,9 @@ def option_parser():
|
|||||||
parser.add_option('--root', dest='staging_root', default='/usr',
|
parser.add_option('--root', dest='staging_root', default='/usr',
|
||||||
help='Prefix under which to install files')
|
help='Prefix under which to install files')
|
||||||
parser.add_option('--bindir', default=None, dest='staging_bindir',
|
parser.add_option('--bindir', default=None, dest='staging_bindir',
|
||||||
help='Location where calibre launcher scripts were installed')
|
help='Location where calibre launcher scripts were installed. Typically /usr/bin')
|
||||||
parser.add_option('--sharedir', default=None, dest='staging_sharedir',
|
parser.add_option('--sharedir', default=None, dest='staging_sharedir',
|
||||||
help='Location where calibre resources were installed')
|
help='Location where calibre resources were installed, typically /usr/share/calibre')
|
||||||
|
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
@ -447,30 +447,6 @@ def opts_and_exts(name, op, exts):
|
|||||||
complete -o filenames -F _'''%(opts,exts) + name + ' ' + name +"\n\n"
|
complete -o filenames -F _'''%(opts,exts) + name + ' ' + name +"\n\n"
|
||||||
|
|
||||||
|
|
||||||
def post_install():
|
|
||||||
parser = option_parser()
|
|
||||||
opts = parser.parse_args()[0]
|
|
||||||
|
|
||||||
global use_destdir
|
|
||||||
use_destdir = opts.destdir
|
|
||||||
manifest = []
|
|
||||||
|
|
||||||
try:
|
|
||||||
from PyQt4 import Qt
|
|
||||||
if Qt.PYQT_VERSION < int('0x40402', 16):
|
|
||||||
print 'WARNING: You need PyQt >= 4.4.2 for the GUI. You have', Qt.PYQT_VERSION_STR, '\nYou may experience crashes or other strange behavior.'
|
|
||||||
except ImportError:
|
|
||||||
print 'WARNING: You do not have PyQt4 installed. The GUI will not work.'
|
|
||||||
|
|
||||||
if opts.save_manifest_to:
|
|
||||||
open(opts.save_manifest_to, 'wb').write('\n'.join(manifest)+'\n')
|
|
||||||
|
|
||||||
|
|
||||||
def binary_install():
|
|
||||||
manifest = os.path.join(getattr(sys, 'frozen_path'), 'manifest')
|
|
||||||
post_install()
|
|
||||||
return 0
|
|
||||||
|
|
||||||
VIEWER = '''\
|
VIEWER = '''\
|
||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
Version=%s
|
Version=%s
|
||||||
|
Loading…
x
Reference in New Issue
Block a user