zulip_bots: Use relative paths to find zulip_bots/bots/*.
This commit is contained in:
parent
472c869efa
commit
d181d0192e
|
@ -56,7 +56,9 @@ the tests for xkcd and wikipedia bots):
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
glob_pattern = os.path.abspath('../zulip_bots/zulip_bots/bots/*/test_*.py')
|
current_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
bots_dir = os.path.join(current_dir, '..', 'zulip_bots/zulip_bots/bots')
|
||||||
|
glob_pattern = bots_dir + '/*/test_*.py'
|
||||||
test_modules = glob.glob(glob_pattern)
|
test_modules = glob.glob(glob_pattern)
|
||||||
|
|
||||||
# get only the names of bots that have tests
|
# get only the names of bots that have tests
|
||||||
|
|
|
@ -70,8 +70,9 @@ Example: ./provision.py helloworld xkcd wikipedia
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
bots_dir = os.path.abspath("bots")
|
current_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
bots_subdirs = map(os.path.abspath, glob.glob("bots/*"))
|
bots_dir = os.path.join(current_dir, "bots")
|
||||||
|
bots_subdirs = map(os.path.abspath, glob.glob(bots_dir + '/*'))
|
||||||
available_bots = filter(lambda d: os.path.isdir(d), bots_subdirs)
|
available_bots = filter(lambda d: os.path.isdir(d), bots_subdirs)
|
||||||
|
|
||||||
options = parse_args(available_bots)
|
options = parse_args(available_bots)
|
||||||
|
|
|
@ -95,7 +95,8 @@ def main():
|
||||||
lib_module = import_module_from_source(options.path_to_bot, name=options.name)
|
lib_module = import_module_from_source(options.path_to_bot, name=options.name)
|
||||||
elif options.name:
|
elif options.name:
|
||||||
if options.provision:
|
if options.provision:
|
||||||
bots_parent_dir = os.path.abspath("bots")
|
current_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
bots_parent_dir = os.path.join(current_dir, "bots")
|
||||||
bot_dir = os.path.join(bots_parent_dir, options.name)
|
bot_dir = os.path.join(bots_parent_dir, options.name)
|
||||||
provision_bot(bot_dir, options.force)
|
provision_bot(bot_dir, options.force)
|
||||||
lib_module = import_module('zulip_bots.bots.{bot}.{bot}'.format(bot=options.name))
|
lib_module = import_module('zulip_bots.bots.{bot}.{bot}'.format(bot=options.name))
|
||||||
|
|
Loading…
Reference in a new issue