From f52d529090e2d329567bf8d9e8e568314b359cfb Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 5 Sep 2019 07:13:20 +0530 Subject: [PATCH] Command to build deps --- setup/commands.py | 33 +++++++++++++++++---------------- setup/installers.py | 21 +++++++++++++++++++++ 2 files changed, 38 insertions(+), 16 deletions(-) diff --git a/setup/commands.py b/setup/commands.py index a3c67cd99a..1c22436826 100644 --- a/setup/commands.py +++ b/setup/commands.py @@ -7,27 +7,28 @@ __copyright__ = '2009, Kovid Goyal ' __docformat__ = 'restructuredtext en' __all__ = [ - 'pot', 'translations', 'get_translations', 'iso639', 'iso3166', - 'build', 'mathjax', 'man_pages', - 'gui', - 'git_version', - 'develop', 'install', - 'kakasi', 'rapydscript', 'cacerts', 'recent_uas', 'resources', - 'check', 'to3', 'unicode_check', 'iterators_check', 'test', - 'sdist', 'bootstrap', 'extdev', - 'manual', 'tag_release', - 'upload_to_server', - 'upload_installers', - 'upload_user_manual', 'upload_demo', 'reupload', - 'stage1', 'stage2', 'stage3', 'stage4', 'stage5', 'publish', 'publish_betas', - 'linux', 'linux32', 'linux64', 'win', 'win32', 'win64', 'osx', - ] + 'pot', 'translations', 'get_translations', 'iso639', 'iso3166', + 'build', 'mathjax', 'man_pages', + 'gui', + 'git_version', + 'develop', 'install', + 'kakasi', 'rapydscript', 'cacerts', 'recent_uas', 'resources', + 'check', 'to3', 'unicode_check', 'iterators_check', 'test', + 'sdist', 'bootstrap', 'extdev', + 'manual', 'tag_release', + 'upload_to_server', + 'upload_installers', + 'upload_user_manual', 'upload_demo', 'reupload', + 'stage1', 'stage2', 'stage3', 'stage4', 'stage5', 'publish', 'publish_betas', + 'linux', 'linux32', 'linux64', 'win', 'win32', 'win64', 'osx', 'build_dep', +] -from setup.installers import Linux, Win, OSX, Linux32, Linux64, Win32, Win64, ExtDev +from setup.installers import Linux, Win, OSX, Linux32, Linux64, Win32, Win64, ExtDev, BuildDep linux, linux32, linux64 = Linux(), Linux32(), Linux64() win, win32, win64 = Win(), Win32(), Win64() osx = OSX() extdev = ExtDev() +build_dep = BuildDep() from setup.translations import POT, GetTranslations, Translations, ISO639, ISO3166 pot = POT() diff --git a/setup/installers.py b/setup/installers.py index 3ee5a1c8da..318a437dd3 100644 --- a/setup/installers.py +++ b/setup/installers.py @@ -88,6 +88,15 @@ def build_single(which='windows', bitness='64', shutdown=True): subprocess.Popen(cmd).wait() +def build_dep(args): + base, bypy = get_paths() + exe = get_exe() + cmd = [exe, bypy] + list(args) + ret = subprocess.Popen(cmd).wait() + if ret != 0: + raise SystemExit(ret) + + class BuildInstaller(Command): OS = BITNESS = '' @@ -151,6 +160,18 @@ class Win(BuildInstallers): OS = 'win' +class BuildDep(Command): + + description = ( + 'Build a calibre dependency. For e.g. build_dep windows expat.' + ' Without arguments builds all deps for specified platform. Use windows 32 for 32bit.' + ) + + def run(self, opts): + args = opts.cli_args + build_dep(args) + + class ExtDev(Command): description = 'Develop a single native extension conveniently'