summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2016-02-09 09:21:36 -0500
committerimarom <imarom@cisco.com>2016-02-09 09:21:36 -0500
commit0aa48dc740012b94cdd0cea3e49c1cb0258d9ce9 (patch)
tree7553ec0b775d0f513c2fd695096a3a2f412eae0c
parenta94f1cdde418a7e96fce6f9c5ec52da5bafbd4b9 (diff)
path checkup for lib
-rw-r--r--scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_ext.py23
1 files changed, 10 insertions, 13 deletions
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_ext.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_ext.py
index f3fd5224..835918d9 100644
--- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_ext.py
+++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_ext.py
@@ -11,11 +11,6 @@ if not TREX_STL_EXT_PATH:
# ../../../../external_libs
TREX_STL_EXT_PATH = os.path.abspath(os.path.join(CURRENT_PATH, os.pardir, os.pardir, os.pardir, os.pardir, 'external_libs'))
-# check path exists
-if not os.path.exists(TREX_STL_EXT_PATH):
- print "Unable to find external packages path: '{0}'".format(TREX_STL_EXT_PATH)
- print "Please provide the correct path using TREX_STL_EXT_PATH variable"
- exit(0)
# the modules required
CLIENT_UTILS_MODULES = ['dpkt-1.8.6',
@@ -24,20 +19,22 @@ CLIENT_UTILS_MODULES = ['dpkt-1.8.6',
'scapy-2.3.1'
]
-def import_client_utils_modules():
- import_module_list(CLIENT_UTILS_MODULES)
-
def import_module_list(modules_list):
assert(isinstance(modules_list, list))
+
for p in modules_list:
full_path = os.path.join(TREX_STL_EXT_PATH, p)
fix_path = os.path.normcase(full_path)
- sys.path.insert(1, full_path)
+ if not os.path.exists(fix_path):
+ print "Unable to find required module library: '{0}'".format(p)
+ print "Please provide the correct path using TREX_STL_EXT_PATH variable"
+ print "current path used: '{0}'".format(TREX_STL_EXT_PATH)
+ exit(0)
+
+ sys.path.insert(1, full_path)
- import_platform_dirs()
-
def import_platform_dirs ():
@@ -73,5 +70,5 @@ def import_platform_dirs ():
warnings.warn("unable to determine platform type for ZMQ import")
-import_client_utils_modules()
-
+import_module_list(CLIENT_UTILS_MODULES)
+import_platform_dirs()