*.dll
*.exe
*.o
-*.so
.lock*
linux_dpdk/.waf*
linux_dpdk/build*
.Trashes
ehthumbs.db
Thumbs.db
-
+.nfs*
+*.swp
# IDE/ Editors files #
######################
]
-def generate_module_path (module, is_python3, is_64bit, is_cel):
+def generate_module_path (module, is_python3, is_64bit, is_ucs2):
platform_path = [module['name']]
if module.get('py-dep'):
platform_path.append('python3' if is_python3 else 'python2')
if module.get('arch-dep'):
- platform_path.append('cel59' if is_cel else 'fedora18')
+ platform_path.append('ucs2' if is_ucs2 else 'ucs4')
platform_path.append('64bit' if is_64bit else '32bit')
return os.path.normcase(os.path.join(PATH_TO_PYTHON_LIB, *platform_path))
# platform data
is_64bit = platform.architecture()[0] == '64bit'
is_python3 = (sys.version_info >= (3, 0))
- is_cel = os.path.exists('/etc/system-profile')
+ is_ucs2 = (sys.maxunicode == 65535)
# regular modules
for p in modules_list:
- full_path = generate_module_path(p, is_python3, is_64bit, is_cel)
+ full_path = generate_module_path(p, is_python3, is_64bit, is_ucs2)
if not os.path.exists(full_path):
print("Unable to find required module library: '{0}'".format(p['name']))
print("Please provide the correct path using PATH_TO_PYTHON_LIB variable")
print("current path used: '{0}'".format(full_path))
exit(0)
-
- sys.path.insert(1, full_path)
+ if full_path not in sys.path:
+ sys.path.insert(1, full_path)
def import_nightly_modules ():
- sys.path.append(TREX_PATH)
#sys.path.append(PATH_TO_CTRL_PLANE)
- sys.path.append(PATH_STL_API)
- sys.path.append(PATH_STF_API)
+ for path in (TREX_PATH, PATH_STL_API, PATH_STF_API):
+ if path not in sys.path:
+ sys.path.append(path)
import_module_list(NIGHTLY_MODULES)
#pprint.pprint(sys.path)
import os
import warnings
+python_ver = 'python%s' % sys.version_info.major
+ucs_ver = 'ucs2' if sys.maxunicode == 65535 else 'ucs4'
+
CURRENT_PATH = os.path.dirname(os.path.realpath(__file__))
ROOT_PATH = os.path.abspath(os.path.join(CURRENT_PATH, os.pardir)) # path to trex_control_plane directory
PATH_TO_PYTHON_LIB = os.path.abspath(os.path.join(ROOT_PATH, os.pardir, os.pardir, 'external_libs'))
+ZMQ_PATH = os.path.abspath(os.path.join(PATH_TO_PYTHON_LIB, 'pyzmq-14.5.0', python_ver, ucs_ver, '64bit'))
CLIENT_UTILS_MODULES = ['dpkt-1.8.6',
'yaml-3.11',
'texttable-0.8.4',
'scapy-2.3.1'
+ 'zmq',
]
def import_client_utils_modules():
# must be in a higher priority
- sys.path.insert(0, PATH_TO_PYTHON_LIB)
+ if PATH_TO_PYTHON_LIB not in sys.path:
+ sys.path.insert(0, PATH_TO_PYTHON_LIB)
+
+ if ROOT_PATH not in sys.path:
+ sys.path.append(ROOT_PATH)
+
+ if ZMQ_PATH not in sys.path:
+ sys.path.append(ZMQ_PATH)
- sys.path.append(ROOT_PATH)
import_module_list(CLIENT_UTILS_MODULES)
for p in modules_list:
full_path = os.path.join(PATH_TO_PYTHON_LIB, p)
fix_path = os.path.normcase(full_path)
- sys.path.insert(1, full_path)
-
-
- import_platform_dirs()
-
-
-
-def import_platform_dirs ():
- # handle platform dirs
-
- # try fedora 18 first and then cel5.9
- # we are using the ZMQ module to determine the right platform
-
- full_path = os.path.join(PATH_TO_PYTHON_LIB, 'platform/fedora18')
- fix_path = os.path.normcase(full_path)
- sys.path.insert(0, full_path)
- try:
- # try to import and delete it from the namespace
- import zmq
- del zmq
- return
- except:
- sys.path.pop(0)
- pass
-
- full_path = os.path.join(PATH_TO_PYTHON_LIB, 'platform/cel59')
- fix_path = os.path.normcase(full_path)
- sys.path.insert(0, full_path)
- try:
- # try to import and delete it from the namespace
- import zmq
- del zmq
- return
-
- except:
- sys.path.pop(0)
- sys.modules['zmq'] = None
- warnings.warn("unable to determine platform type for ZMQ import")
+ if full_path not in sys.path:
+ sys.path.insert(1, full_path)
-
import_client_utils_modules()
import sys\r
import os\r
-python2_zmq_path = os.path.abspath(os.path.join(os.pardir,os.pardir,os.pardir,\r
- 'external_libs','pyzmq-14.5.0','python2','fedora18','64bit'))\r
-sys.path.append(python2_zmq_path)\r
+\r
+python_ver = 'python%s' % sys.version_info.major\r
+ucs_ver = 'ucs2' if sys.maxunicode == 65535 else 'ucs4'\r
+\r
+zmq_path = os.path.abspath(os.path.join(os.pardir,os.pardir,os.pardir,\r
+ 'external_libs','pyzmq-14.5.0', python_ver, ucs_ver, '64bit'))\r
+if zmq_path not in sys.path:\r
+ sys.path.append(zmq_path)\r
+\r
import zmq\r
import json\r
from argparse import *\r
import sys
import os
python_ver = 'python%s' % sys.version_info.major
+ucs_ver = 'ucs2' if sys.maxunicode == 65535 else 'ucs4'
CURRENT_PATH = os.path.dirname(os.path.realpath(__file__))
ROOT_PATH = os.path.abspath(os.path.join(CURRENT_PATH, os.pardir)) # path to trex_control_plane directory
PATH_TO_PYTHON_LIB = os.path.abspath(os.path.join(ROOT_PATH, os.pardir, os.pardir, 'external_libs'))
-PATH_TO_PLATFORM_LIB = os.path.abspath(os.path.join(PATH_TO_PYTHON_LIB, 'pyzmq-14.5.0', python_ver , 'fedora18', '64bit'))
+ZMQ_PATH = os.path.abspath(os.path.join(PATH_TO_PYTHON_LIB, 'pyzmq-14.5.0', python_ver, ucs_ver, '64bit'))
SERVER_MODULES = ['enum34-1.0.4',
'zmq',
def import_server_modules():
- # must be in a higher priority
- sys.path.insert(0, PATH_TO_PYTHON_LIB)
- sys.path.insert(0, PATH_TO_PLATFORM_LIB)
- sys.path.append(ROOT_PATH)
+ # must be in a higher priority
+ if PATH_TO_PYTHON_LIB not in sys.path:
+ sys.path.insert(0, PATH_TO_PYTHON_LIB)
+ if ZMQ_PATH not in sys.path:
+ sys.path.insert(0, ZMQ_PATH)
+ if ROOT_PATH not in sys.path:
+ sys.path.append(ROOT_PATH)
import_module_list(SERVER_MODULES)
for p in modules_list:
full_path = os.path.join(PATH_TO_PYTHON_LIB, p)
fix_path = os.path.normcase(full_path)
- sys.path.insert(1, full_path)
+ if full_path not in sys.path:
+ sys.path.insert(1, full_path)
import_server_modules()
\r
import sys\r
import os\r
-python2_zmq_path = os.path.abspath(os.path.join(os.pardir,os.pardir,os.pardir,os.pardir,\r
- os.pardir,'external_libs','pyzmq-14.5.0','python2','fedora18','64bit'))\r
-sys.path.append(python2_zmq_path)\r
+\r
+python_ver = 'python%s' % sys.version_info.major\r
+ucs_ver = 'ucs2' if sys.maxunicode == 65535 else 'ucs4'\r
+\r
+zmq_path = os.path.abspath(os.path.join(os.pardir,os.pardir,os.pardir,os.pardir,\r
+ os.pardir,'external_libs','pyzmq-14.5.0', python_ver, ucs_ver,'64bit'))\r
+\r
+if zmq_path not in sys.path:\r
+ sys.path.append(zmq_path)\r
\r
import zmq\r
import json\r