diff options
author | Yaroslav Brustinov <ybrustin@cisco.com> | 2016-03-24 20:00:27 +0200 |
---|---|---|
committer | Yaroslav Brustinov <ybrustin@cisco.com> | 2016-03-24 20:00:27 +0200 |
commit | 59f00264f39dfb95a62401776b4ed8c433682fa7 (patch) | |
tree | 96b5411f17faed9f62aa9e4722b29d767d502b1b /scripts/automation/trex_control_plane/stf/outer_packages.py | |
parent | 4e8ce34a9ef6b8883cfed47f77c9b753e1cf4248 (diff) |
gather stateful client to stf folder, create trex_client package
Diffstat (limited to 'scripts/automation/trex_control_plane/stf/outer_packages.py')
-rwxr-xr-x | scripts/automation/trex_control_plane/stf/outer_packages.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/scripts/automation/trex_control_plane/stf/outer_packages.py b/scripts/automation/trex_control_plane/stf/outer_packages.py new file mode 100755 index 00000000..5e29f8d6 --- /dev/null +++ b/scripts/automation/trex_control_plane/stf/outer_packages.py @@ -0,0 +1,30 @@ +#!/router/bin/python + +import sys +import os + + +CURRENT_PATH = os.path.dirname(os.path.realpath(__file__)) +PARENT_PATH = os.path.abspath(os.path.join(CURRENT_PATH, os.pardir, 'external_libs')) +SCRIPTS_PATH = os.path.abspath(os.path.join(CURRENT_PATH, os.pardir, os.pardir, os.pardir, 'external_libs')) + +CLIENT_MODULES = ['enum34-1.0.4', + 'jsonrpclib-pelix-0.2.5', +# 'termstyle', +# 'yaml-3.11' + ] + + +def import_module_list(ext_libs_path): + for p in CLIENT_MODULES: + full_path = os.path.join(ext_libs_path, p) + if not os.path.exists(full_path): + raise Exception('Library %s is absent in path %s' % (p, ext_libs_path)) + sys.path.insert(1, full_path) + +if os.path.exists(PARENT_PATH): + import_module_list(PARENT_PATH) +elif os.path.exists(SCRIPTS_PATH): + import_module_list(SCRIPTS_PATH) +else: + raise Exception('Could not find external libs in path: %s' % [PARENT_PATH, SCRIPTS_PATH]) |