Index: tools/idl_parser/idl_lexer.py |
diff --git a/tools/idl_parser/idl_lexer.py b/tools/idl_parser/idl_lexer.py |
index 1f186d722d9e5921061d1862b604b3cfef4da907..4fcdccf2a503e53a8da72766fdc741a5e8f7d8ea 100755 |
--- a/tools/idl_parser/idl_lexer.py |
+++ b/tools/idl_parser/idl_lexer.py |
@@ -17,20 +17,10 @@ PLY can be found at: |
import os.path |
import sys |
-# |
-# Try to load the ply module, if not, then assume it is in the third_party |
-# directory. |
-# |
-try: |
- # Disable lint check which fails to find the ply module. |
- # pylint: disable=F0401 |
- from ply import lex |
-except ImportError: |
- module_path, module_name = os.path.split(__file__) |
- third_party = os.path.join(module_path, '..', '..', 'third_party') |
- sys.path.append(third_party) |
- # pylint: disable=F0401 |
- from ply import lex |
+SRC_DIR = os.path.join(os.path.dirname(__file__), os.pardir, os.pardir) |
+sys.path = [os.path.join(SRC_DIR, 'third_party')] + sys.path |
Yuki
2017/02/21 10:39:26
nit: sys.path.insert(0, third_party's dir) would b
|
+from ply import lex |
+ |
# |
# IDL Lexer |