summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2015-07-23 11:12:52 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-11-16 11:36:53 +0000
commite7a5d6e7802b58cf6eae1d83e4bf5c50ab66f80a (patch)
treed81abab9baa51dca28539aaaa727c0abf4dbc6da
parentf435ac9db0581d8313a38d586b00c2b3de419298 (diff)
downloadopenembedded-core-e7a5d6e7802b58cf6eae1d83e4bf5c50ab66f80a.tar.gz
verify-homepage: use scriptpath to find bitbake path
We have shared code for this, let's use it. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
-rwxr-xr-xscripts/contrib/verify-homepage.py28
1 files changed, 9 insertions, 19 deletions
diff --git a/scripts/contrib/verify-homepage.py b/scripts/contrib/verify-homepage.py
index 86cc82bca3..9953babf6d 100755
--- a/scripts/contrib/verify-homepage.py
+++ b/scripts/contrib/verify-homepage.py
@@ -8,26 +8,16 @@ import os
import subprocess
import urllib2
-def search_bitbakepath():
- bitbakepath = ""
- # Search path to bitbake lib dir in order to load bb modules
- if os.path.exists(os.path.join(os.path.dirname(sys.argv[0]), '../../bitbake/lib/bb')):
- bitbakepath = os.path.join(os.path.dirname(sys.argv[0]), '../../bitbake/lib')
- bitbakepath = os.path.abspath(bitbakepath)
- else:
- # Look for bitbake/bin dir in PATH
- for pth in os.environ['PATH'].split(':'):
- if os.path.exists(os.path.join(pth, '../lib/bb')):
- bitbakepath = os.path.abspath(os.path.join(pth, '../lib'))
- break
- if not bitbakepath:
- sys.stderr.write("Unable to find bitbake by searching parent directory of this script or PATH\n")
- sys.exit(1)
- return bitbakepath
-
-# For importing the following modules
-sys.path.insert(0, search_bitbakepath())
+# Allow importing scripts/lib modules
+scripts_path = os.path.abspath(os.path.dirname(os.path.realpath(__file__)) + '/..')
+lib_path = scripts_path + '/lib'
+sys.path = sys.path + [lib_path]
+import scriptpath
+
+# Allow importing bitbake modules
+bitbakepath = scriptpath.add_bitbake_lib_path()
+
import bb.tinfoil
def wgetHomepage(pn, homepage):