zulip_bots setup.py: Install deps from the bots' requirements.txt files.
This makes it straightforward to add dependencies for a bot, and works around https://github.com/pypa/pip/issues/4957.
This commit is contained in:
parent
56a9cbe5af
commit
0893a5f61e
2 changed files with 24 additions and 17 deletions
|
@ -5,6 +5,8 @@ from __future__ import print_function
|
|||
|
||||
import os
|
||||
import sys
|
||||
import glob
|
||||
import pip
|
||||
if False:
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
|
@ -47,16 +49,8 @@ package_info = dict(
|
|||
|
||||
setuptools_info = dict(
|
||||
install_requires=[
|
||||
'pip',
|
||||
'zulip',
|
||||
'mock>=2.0.0',
|
||||
'html2text', # for bots/define
|
||||
'BeautifulSoup4', # for bots/googlesearch
|
||||
'lxml', # for bots/googlesearch
|
||||
'requests', # for bots/link_shortener and bots/jira
|
||||
'python-chess[engine,gaviota]', # for bots/chess
|
||||
'wit', # for bots/witai
|
||||
'apiai', # for bots/dialogflow
|
||||
'simple_salesforce' # for bots/salesforce
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -98,5 +92,15 @@ except ImportError:
|
|||
package_list.append('zulip_bots.bots.' + dir_name)
|
||||
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')
|
||||
rcode = pip.main(['install', '-r', req_path, '--quiet'])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue