diff --git a/setup/commands.py b/setup/commands.py index 25510f6477..e19896dada 100644 --- a/setup/commands.py +++ b/setup/commands.py @@ -13,7 +13,7 @@ __all__ = [ 'develop', 'install', 'kakasi', 'coffee', 'resources', 'check', - 'sdist', + 'sdist', 'bootstrap', 'manual', 'tag_release', 'pypi_register', 'pypi_upload', 'upload_to_server', 'upload_installers', @@ -38,10 +38,11 @@ build = Build() from setup.mathjax import MathJax mathjax = MathJax() -from setup.install import Develop, Install, Sdist +from setup.install import Develop, Install, Sdist, Bootstrap develop = Develop() install = Install() sdist = Sdist() +bootstrap = Bootstrap() from setup.gui import GUI gui = GUI() diff --git a/setup/install.py b/setup/install.py index fbb4bf4e6a..3993159bef 100644 --- a/setup/install.py +++ b/setup/install.py @@ -316,5 +316,19 @@ class Sdist(Command): if os.path.exists(self.DEST): os.remove(self.DEST) +class Bootstrap(Command): + description = 'Bootstrap a fresh checkout of calibre from git to a state where it can be installed. Requires various development tools/libraries/headers' + TRANSLATIONS_REPO = 'https://github.com/kovidgoyal/calibre-translations.git' + + def run(self, opts): + tdir = self.j(self.d(self.SRC), 'translations') + if os.path.exists(tdir): + subprocess.check_call(['git', 'pull'], cwd=tdir) + else: + subprocess.check_call(['git', 'clone', self.TRANSLATIONS_REPO, 'translations'], cwd=self.d(self.SRC)) + for cmd in 'build iso639 iso3166 translations gui resources'.split(): + self.info('Running %s setup.py %s' % (sys.executable, cmd)) + subprocess.check_call([sys.executable, 'setup.py', cmd], cwd=self.d(self.SRC)) + self.info('\n\nAll done! You should now be able to run "%s setup.py install" to install calibre' % sys.executable)