@@ -231,6 +231,28 @@ def add_to_git(pathlists):
231
231
logging .error (result )
232
232
exit (result )
233
233
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
234
256
235
257
def compilefromsource (input_ , output , ext ):
236
258
import codecs
@@ -274,9 +296,12 @@ def compilefromsource(input_, output, ext):
274
296
275
297
# Вызовем v8unpack для сборки файла из исходников
276
298
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 ))
278
303
result = subprocess .check_call ([
279
- 'unpackv8' ,
304
+ unpackpath ,
280
305
'-B' ,
281
306
'{}' .format (temp_path ), # fixme
282
307
temp_file
0 commit comments