From 94d163e7d410aaac9c7ba84a8f67169330bde841 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=BE=D1=81=D0=BD=D0=B0=20=D0=95=D0=B2=D0=B3=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B9?= Date: Wed, 6 May 2015 11:28:27 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=BF=D0=BE=D0=B8=D1=81=D0=BA=20=D0=BF=D1=83=D1=82=D0=B8=20?= =?UTF-8?q?=D0=BA=20unpackv8=20=20=D0=B8=20=D0=B2=D1=8B=D0=B2=D0=BE=D0=B4?= =?UTF-8?q?=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B8,=20=D0=B5=D1=81=D0=BB?= =?UTF-8?q?=D0=B8=20=D0=BD=D0=B5=20=D0=BD=D0=B0=D1=88=D0=BB=D0=B8.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyv8unpack.py | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/pyv8unpack.py b/pyv8unpack.py index 5b8afae..6ff6fcf 100644 --- a/pyv8unpack.py +++ b/pyv8unpack.py @@ -231,6 +231,28 @@ def add_to_git(pathlists): logging.error(result) exit(result) +def findexecute(name): + found = [] + ext = '' + searchpath = os.environ.get("PATH", "").split(os.pathsep) + if sys.platform.startswith("win"): + ext = '.exe' + searchpath.insert(0, os.curdir) # implied by Windows shell + + for i in range(len(searchpath)): + dirName = searchpath[i] + # On windows the dirName *could* be quoted, drop the quotes + if sys.platform.startswith("win") and len(dirName) >= 2\ + and dirName[0] == '"' and dirName[-1] == '"': + dirName = dirName[1:-1] + absName = os.path.abspath( + os.path.normpath(os.path.join(dirName, name+ext))) + if os.path.isfile(absName) and not absName in found: + found.append(absName) + + firstpath = "" + if len(found) > 0: firstpath = found[0] + return firstpath def compilefromsource(input_, output, ext): import codecs @@ -274,9 +296,12 @@ def compilefromsource(input_, output, ext): # Вызовем v8unpack для сборки файла из исходников temp_file = tempfile.mktemp('.' + extfile) - log.debug('unpackv8 -B "{}" "{}"'.format('{}'.format(temp_path), temp_file)) + unpackpath = findexecute("unpackv8") + assert (len(unpackpath) > 0), "path to unpackv8 is empty" + log.debug('{} -B "{}" "{}"'.format(unpackpath, '{}'.format(temp_path), temp_file)) + print('{} -B "{}" "{}"'.format(unpackpath, '{}'.format(temp_path), temp_file)) result = subprocess.check_call([ - 'unpackv8', + unpackpath, '-B', '{}'.format(temp_path), # fixme temp_file