Add a bootstrap sub-command to setup.py to ease building from a git checkout

This commit is contained in:
Kovid Goyal 2015-07-15 13:24:16 +05:30
parent 2f44e20967
commit 9ef37427d3
2 changed files with 17 additions and 2 deletions

View File

@ -13,7 +13,7 @@ __all__ = [
'develop', 'install', 'develop', 'install',
'kakasi', 'coffee', 'resources', 'kakasi', 'coffee', 'resources',
'check', 'check',
'sdist', 'sdist', 'bootstrap',
'manual', 'tag_release', 'manual', 'tag_release',
'pypi_register', 'pypi_upload', 'upload_to_server', 'pypi_register', 'pypi_upload', 'upload_to_server',
'upload_installers', 'upload_installers',
@ -38,10 +38,11 @@ build = Build()
from setup.mathjax import MathJax from setup.mathjax import MathJax
mathjax = MathJax() mathjax = MathJax()
from setup.install import Develop, Install, Sdist from setup.install import Develop, Install, Sdist, Bootstrap
develop = Develop() develop = Develop()
install = Install() install = Install()
sdist = Sdist() sdist = Sdist()
bootstrap = Bootstrap()
from setup.gui import GUI from setup.gui import GUI
gui = GUI() gui = GUI()

View File

@ -316,5 +316,19 @@ class Sdist(Command):
if os.path.exists(self.DEST): if os.path.exists(self.DEST):
os.remove(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)