contrib_bots: Allow to import code from subdirectory of lib

Allow to import code from subdirectory of `contrib_bots/lib`.
Because sometimes bot requires grouping in their directory,
especially for the bot that has configuartion file and documentation.
This commit is contained in:
Rafid Aslam 2016-12-14 17:12:26 +07:00 committed by showell
parent c96681eef5
commit 746d9d2b6b

View file

@ -22,7 +22,7 @@ class RestrictedClient(object):
def get_lib_module(lib_fn): def get_lib_module(lib_fn):
lib_fn = os.path.abspath(lib_fn) lib_fn = os.path.abspath(lib_fn)
if os.path.dirname(lib_fn) != os.path.join(our_dir, 'lib'): if not os.path.dirname(lib_fn).startswith(os.path.join(our_dir, 'lib')):
print('Sorry, we will only import code from contrib_bots/lib.') print('Sorry, we will only import code from contrib_bots/lib.')
sys.exit(1) sys.exit(1)