diff --git a/manual/build.py b/manual/build.py index 103a0ceef5..ff2d139c5d 100755 --- a/manual/build.py +++ b/manual/build.py @@ -1,4 +1,4 @@ -#!/usr/bin/env calibre-debug +#!/usr/bin/env python2 # vim:fileencoding=utf-8 from __future__ import (unicode_literals, division, absolute_import, print_function) @@ -6,18 +6,17 @@ from __future__ import (unicode_literals, division, absolute_import, __license__ = 'GPL v3' __copyright__ = '2014, Kovid Goyal ' +import sys, os, subprocess, shutil import tempfile 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 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): diff --git a/manual/conf.py b/manual/conf.py index edd999e340..9e03a1a67e 100644 --- a/manual/conf.py +++ b/manual/conf.py @@ -15,11 +15,11 @@ import sys, os from datetime import date # If your extensions are in another directory, add it here. -sys.path.append(os.path.abspath('.')) -import init_calibre -init_calibre -from calibre.constants import __appname__, __version__ +sys.path.append(os.path.dirname(os.path.abspath(__file__))) +sys.path.insert(0, os.path.dirname(sys.path[-1])) +from setup import __appname__, __version__ import calibre.utils.localization as l # Ensure calibre translations are installed +del sys.path[0] del l import custom custom diff --git a/manual/custom.py b/manual/custom.py index e769d97c38..c8bf5fbffa 100644 --- a/manual/custom.py +++ b/manual/custom.py @@ -3,14 +3,13 @@ __license__ = 'GPL v3' __copyright__ = '2008, Kovid Goyal ' -import sys, os, re, textwrap +import os, re, textwrap from functools import partial import init_calibre del init_calibre from sphinx.util.console import bold -sys.path.append(os.path.abspath('../../../')) from calibre.linux import entry_points, cli_index_strings from epub import EPUBHelpBuilder from latex import LaTeXHelpBuilder diff --git a/setup/publish.py b/setup/publish.py index b6b669d6ab..cc3cc5e0b9 100644 --- a/setup/publish.py +++ b/setup/publish.py @@ -208,8 +208,8 @@ class Manual(Command): os.environ['ALL_USER_MANUAL_LANGUAGES'] = ' '.join(languages) for language in languages: jobs.append(([ - 'calibre-debug', self.j(self.d(self.SRC), 'manual', 'build.py'), - '--', language, self.j(tdir, language) + sys.executable, self.j(self.d(self.SRC), 'manual', 'build.py'), + language, self.j(tdir, language) ], '\n\n**************** Building translations for: %s' % language)) self.info('Building manual for %d languages' % len(jobs)) subprocess.check_call(jobs[0][0]) @@ -300,7 +300,7 @@ class ManPages(Command): jobs = [] for l in languages: 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) ) self.info('\tCreating man pages in {} for {} languages...'.format(dest, len(jobs)))