Dont use installed calibre when running sphinx-build

This commit is contained in:
Kovid Goyal 2017-07-04 21:51:42 +05:30
parent 9ccbf1ef8f
commit dfe2f5e04f
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
4 changed files with 15 additions and 17 deletions

View File

@ -1,4 +1,4 @@
#!/usr/bin/env calibre-debug #!/usr/bin/env python2
# vim:fileencoding=utf-8 # vim:fileencoding=utf-8
from __future__ import (unicode_literals, division, absolute_import, from __future__ import (unicode_literals, division, absolute_import,
print_function) print_function)
@ -6,18 +6,17 @@ from __future__ import (unicode_literals, division, absolute_import,
__license__ = 'GPL v3' __license__ = 'GPL v3'
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>' __copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
import sys, os, subprocess, shutil
import tempfile import tempfile
from functools import partial from functools import partial
from calibre import __appname__, __version__
from calibre.utils.icu import upper # ensure encoding is set to utf-8
del upper
import sys, os, subprocess, shutil
SPHINX_BUILD = 'sphinx-build2'
j, d, a = os.path.join, os.path.dirname, os.path.abspath j, d, a = os.path.join, os.path.dirname, os.path.abspath
BASE = d(a(__file__)) BASE = d(a(__file__))
SPHINX_BUILD = 'sphinx-build2'
sys.path.insert(0, d(BASE))
from setup import __appname__, __version__
del sys.path[0]
def sphinx_build(language, base, builder='html', bdir='html', t=None, quiet=True, very_quiet=False): def sphinx_build(language, base, builder='html', bdir='html', t=None, quiet=True, very_quiet=False):

View File

@ -15,11 +15,11 @@ import sys, os
from datetime import date from datetime import date
# If your extensions are in another directory, add it here. # If your extensions are in another directory, add it here.
sys.path.append(os.path.abspath('.')) sys.path.append(os.path.dirname(os.path.abspath(__file__)))
import init_calibre sys.path.insert(0, os.path.dirname(sys.path[-1]))
init_calibre from setup import __appname__, __version__
from calibre.constants import __appname__, __version__
import calibre.utils.localization as l # Ensure calibre translations are installed import calibre.utils.localization as l # Ensure calibre translations are installed
del sys.path[0]
del l del l
import custom import custom
custom custom

View File

@ -3,14 +3,13 @@
__license__ = 'GPL v3' __license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>' __copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
import sys, os, re, textwrap import os, re, textwrap
from functools import partial from functools import partial
import init_calibre import init_calibre
del init_calibre del init_calibre
from sphinx.util.console import bold from sphinx.util.console import bold
sys.path.append(os.path.abspath('../../../'))
from calibre.linux import entry_points, cli_index_strings from calibre.linux import entry_points, cli_index_strings
from epub import EPUBHelpBuilder from epub import EPUBHelpBuilder
from latex import LaTeXHelpBuilder from latex import LaTeXHelpBuilder

View File

@ -208,8 +208,8 @@ class Manual(Command):
os.environ['ALL_USER_MANUAL_LANGUAGES'] = ' '.join(languages) os.environ['ALL_USER_MANUAL_LANGUAGES'] = ' '.join(languages)
for language in languages: for language in languages:
jobs.append(([ jobs.append(([
'calibre-debug', self.j(self.d(self.SRC), 'manual', 'build.py'), sys.executable, self.j(self.d(self.SRC), 'manual', 'build.py'),
'--', language, self.j(tdir, language) language, self.j(tdir, language)
], '\n\n**************** Building translations for: %s' % language)) ], '\n\n**************** Building translations for: %s' % language))
self.info('Building manual for %d languages' % len(jobs)) self.info('Building manual for %d languages' % len(jobs))
subprocess.check_call(jobs[0][0]) subprocess.check_call(jobs[0][0])
@ -300,7 +300,7 @@ class ManPages(Command):
jobs = [] jobs = []
for l in languages: for l in languages:
jobs.append(( jobs.append((
['calibre-debug', self.j(base, 'build.py'), '--', '--man-pages', l, dest], [sys.executable, self.j(base, 'build.py'), '--man-pages', l, dest],
'\n\n**************** Building translations for: %s' % l) '\n\n**************** Building translations for: %s' % l)
) )
self.info('\tCreating man pages in {} for {} languages...'.format(dest, len(jobs))) self.info('\tCreating man pages in {} for {} languages...'.format(dest, len(jobs)))