From e79fca992c7b57eb82969af3265de421f397fda2 Mon Sep 17 00:00:00 2001 From: Dominik Riebeling Date: Sun, 14 Aug 2011 18:57:49 +0000 Subject: Remove use of which.py module. Implement simple which functionality. This has less features than which.py but is sufficient, and removing an external dependency is always good. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30315 a1c6a512-1295-4272-9138-f99709370657 --- utils/common/deploy.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/utils/common/deploy.py b/utils/common/deploy.py index 74dfab420c..6a8b2580da 100755 --- a/utils/common/deploy.py +++ b/utils/common/deploy.py @@ -29,7 +29,6 @@ # If the required Qt installation isn't in PATH use --qmake option. # Tested on Linux and MinGW / W32 # -# requires python which package (http://code.google.com/p/which/) # requires pysvn package. # requires upx.exe in PATH on Windows. # @@ -54,12 +53,6 @@ except ImportError: print "Fatal: This script requires the pysvn package to run." print " See http://pysvn.tigris.org/." sys.exit(-5) -try: - import which -except ImportError: - print "Fatal: This script requires the which package to run." - print " See http://code.google.com/p/which/." - sys.exit(-5) cpus = 1 try: import multiprocessing @@ -109,6 +102,16 @@ def usage(myself): print " from svn." +def which(executable): + path = os.environ.get("PATH", "").split(os.pathsep) + for p in path: + fullpath = p + "/" + executable + if os.path.exists(fullpath): + return fullpath + print "which: could not find " + executable + return "" + + def getsources(svnsrv, filelist, dest): '''Get the files listed in filelist from svnsrv and put it at dest.''' client = pysvn.Client() @@ -160,7 +163,7 @@ def findqt(cross=""): bins = [cross + "qmake", cross + "qmake-qt4"] for binary in bins: try: - q = which.which(binary) + q = which(binary) if len(q) > 0: result = checkqt(q) if not result == "": @@ -346,7 +349,7 @@ def finddlls(program, extrapaths=[], cross=""): break if dllpath == "": try: - dllpath = re.sub(r"\\", r"/", which.which(file)) + dllpath = re.sub(r"\\", r"/", which(file)) print file + ": found at " + dllpath dllpaths.append(dllpath) except: -- cgit v1.2.3