From e7e9059cb812914d2760bdb6c5032d17d95ee8df Mon Sep 17 00:00:00 2001 From: Eeshan Garg Date: Mon, 4 Jun 2018 20:01:53 -0230 Subject: [PATCH] zulip_bots: Move installation of bot deps to tools/provision. A lot of these bot dependencies are pretty hefty and shouldn't be installed as part of the zulip_bots package. So the installation of these belongs in tools/provision, not in setup.py. --- tools/provision | 12 ++++++++++++ zulip_bots/setup.py | 12 ------------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tools/provision b/tools/provision index 496e3d3..fb14dd1 100755 --- a/tools/provision +++ b/tools/provision @@ -4,6 +4,7 @@ import os import sys import argparse import subprocess +import glob from importlib import import_module @@ -93,6 +94,17 @@ the Python version this command is executed with.""" if py_version > (3, 1): install_dependencies('py3_requirements.txt') + # Install all requirements for all bots. get_bot_paths() + # has requirements that must be satisfied prior to calling + # it by setup(). + current_dir = os.path.dirname(os.path.abspath(__file__)) + bots_dir = os.path.join(current_dir, "..", "zulip_bots", "zulip_bots", "bots") + req_paths = glob.glob(bots_dir + "/*/requirements.txt") + for req_path in req_paths: + path_split = req_path.split(os.path.sep)[-5:] + relative_path = os.path.join(*path_split) + install_dependencies(relative_path) + print(green + 'Success!' + end_format) activate_command = os.path.join(base_dir, diff --git a/zulip_bots/setup.py b/zulip_bots/setup.py index c45c19b..315c5d6 100755 --- a/zulip_bots/setup.py +++ b/zulip_bots/setup.py @@ -98,15 +98,3 @@ except ImportError: package_info['packages'] = package_list setup(**package_info) - -# Install all requirements for all bots. get_bot_paths() -# has requirements that must be satisfied prior to calling -# it by setup(). -current_dir = os.path.dirname(os.path.abspath(__file__)) -bots_dir = os.path.join(current_dir, "zulip_bots", "bots") -bots_subdirs = map(lambda d: os.path.abspath(d), glob.glob(bots_dir + '/*')) -bot_paths = filter(lambda d: os.path.isdir(d), bots_subdirs) -for bot_path in bot_paths: - req_path = os.path.join(bot_path, 'requirements.txt') - if os.path.exists(req_path): - subprocess.check_call([sys.executable, '-m', 'pip', 'install', '-r', req_path, '--quiet'])