@@ -231,6 +231,28 @@ def add_to_git(pathlists):
231231 logging .error (result )
232232 exit (result )
233233
234+ def findexecute (name ):
235+ found = []
236+ ext = ''
237+ searchpath = os .environ .get ("PATH" , "" ).split (os .pathsep )
238+ if sys .platform .startswith ("win" ):
239+ ext = '.exe'
240+ searchpath .insert (0 , os .curdir ) # implied by Windows shell
241+
242+ for i in range (len (searchpath )):
243+ dirName = searchpath [i ]
244+ # On windows the dirName *could* be quoted, drop the quotes
245+ if sys .platform .startswith ("win" ) and len (dirName ) >= 2 \
246+ and dirName [0 ] == '"' and dirName [- 1 ] == '"' :
247+ dirName = dirName [1 :- 1 ]
248+ absName = os .path .abspath (
249+ os .path .normpath (os .path .join (dirName , name + ext )))
250+ if os .path .isfile (absName ) and not absName in found :
251+ found .append (absName )
252+
253+ firstpath = ""
254+ if len (found ) > 0 : firstpath = found [0 ]
255+ return firstpath
234256
235257def compilefromsource (input_ , output , ext ):
236258 import codecs
@@ -274,9 +296,12 @@ def compilefromsource(input_, output, ext):
274296
275297 # Вызовем v8unpack для сборки файла из исходников
276298 temp_file = tempfile .mktemp ('.' + extfile )
277- log .debug ('unpackv8 -B "{}" "{}"' .format ('{}' .format (temp_path ), temp_file ))
299+ unpackpath = findexecute ("unpackv8" )
300+ assert (len (unpackpath ) > 0 ), "path to unpackv8 is empty"
301+ log .debug ('{} -B "{}" "{}"' .format (unpackpath , '{}' .format (temp_path ), temp_file ))
302+ print ('{} -B "{}" "{}"' .format (unpackpath , '{}' .format (temp_path ), temp_file ))
278303 result = subprocess .check_call ([
279- 'unpackv8' ,
304+ unpackpath ,
280305 '-B' ,
281306 '{}' .format (temp_path ), # fixme
282307 temp_file
0 commit comments