summaryrefslogtreecommitdiffstats
path: root/meta-xilinx-core/scripts/lib/scriptpath.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta-xilinx-core/scripts/lib/scriptpath.py')
-rw-r--r--meta-xilinx-core/scripts/lib/scriptpath.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/meta-xilinx-core/scripts/lib/scriptpath.py b/meta-xilinx-core/scripts/lib/scriptpath.py
new file mode 100644
index 00000000..f32326db
--- /dev/null
+++ b/meta-xilinx-core/scripts/lib/scriptpath.py
@@ -0,0 +1,32 @@
1# Path utility functions for OE python scripts
2#
3# Copyright (C) 2012-2014 Intel Corporation
4# Copyright (C) 2011 Mentor Graphics Corporation
5#
6# SPDX-License-Identifier: GPL-2.0-only
7#
8
9import sys
10import os
11import os.path
12
13def add_oe_lib_path():
14 basepath = os.path.abspath(os.path.dirname(__file__) + '/../..')
15 newpath = basepath + '/meta/lib'
16 sys.path.insert(0, newpath)
17
18def add_bitbake_lib_path():
19 basepath = os.path.abspath(os.path.dirname(__file__) + '/../..')
20 bitbakepath = None
21 if os.path.exists(basepath + '/bitbake/lib/bb'):
22 bitbakepath = basepath + '/bitbake'
23 else:
24 # look for bitbake/bin dir in PATH
25 for pth in os.environ['PATH'].split(':'):
26 if os.path.exists(os.path.join(pth, '../lib/bb')):
27 bitbakepath = os.path.abspath(os.path.join(pth, '..'))
28 break
29
30 if bitbakepath:
31 sys.path.insert(0, bitbakepath + '/lib')
32 return bitbakepath