Skip to contentSkip to conversation

yocto-bsp: insert the path of argparse_oe.py into libpath

PATCH New Yue Tao 1 participant 1 message Jul 14, 2017

lore
Share & tools
lore

Yue Tao

author
#0 lore raw

PATCH 1/1 yocto-bsp: insert the path of argparse_oe.py into libpath

Issue: LIN9-4616

Finding the path of argparse_oe.py in env PATH. Usually, it can be found in project/scripts/lib, or oe-core/scripts/lib. Find the first one and insert it into libpath.

(LOCAL REV: NOT UPSTREAM) -- pending

---
 scripts/yocto-bsp |    7 +++++++
 1 file changed, 7 insertions(+)
scripts/yocto-bsp +7 -0
index 6fb1f41..fdd3ed2 100755
@@ -35,6 +35,13 @@ import sys
 import argparse
 import logging
 
+path_from_env = os.getenv('PATH').split(':')
+for script_path in path_from_env:
+    if script_path.endswith('scripts'):
+        if os.path.exists(os.path.join(script_path, 'lib/argparse_oe.py')):
+            sys.path.insert(0, script_path + '/lib')
+            break
+
 scripts_path = os.path.dirname(os.path.realpath(__file__))
 sys.path.insert(0, scripts_path + '/lib')
 import argparse_oe
Signature · 1 line
1.7.9.5