@@ -194,16 +194,20 @@ def decompile(list_of_files, source=None, platform=None):
194194 logging .debug ("formatstring is %s , base is %s, V8Reader is %s, temp \
195195 is %s" % (formatstring , base , V8Reader , tempbat ))
196196
197-
198197 with open (tempbat , 'w' , encoding = 'cp866' ) as temp :
199198 temp .write ('@echo off\n ' )
200- temp .write (format ('"%s" %s /DisableStartupMessages %s %s' % (pathbin1c , base , V8Reader , formatstring )))
199+ temp .write (format ('"%s" %s /DisableStartupMessages %s %s' % (pathbin1c ,
200+ base , V8Reader , formatstring ))
201+ )
201202 temp .close ()
202203 result = subprocess .check_call (['cmd.exe' , '/C' , tempbat ])
204+ assert result == 0 , format ("Не удалось разобрать\
205+ обработку %s" % (fullpathfile ))
203206 if not result == 0 :
204207 logging .error (format ("Не удалось разобрать \
205208 обработку %s" % (fullpathfile )))
206- raise format ("Не удалось разобрать обработку %s" % (fullpathfile ))
209+ raise format ("Не удалось разобрать\
210+ обработку %s" % (fullpathfile ))
207211 returnlist .append (newsourcepath )
208212 logging .info ("Разобран в %s" % (newsourcepath ))
209213
@@ -219,10 +223,10 @@ def add_to_git(pathlists):
219223
220224def compile (input , output , ext ):
221225 import codecs
222- if input is None :
223- raise "Не указан путь к входящему каталогу"
224- if output is None :
225- raise "Не указан путь к исходящему файлу"
226+
227+ assert not input is None , "Не указан путь к входящему каталогу"
228+ assert not output is None , "Не указан путь к исходящему файлу"
229+
226230 extfile = "epf" if ext == "auto" else ext
227231
228232 dirsource = os .path .abspath (os .path .join (os .path .curdir , input ))
@@ -238,33 +242,48 @@ def compile(input, output, ext):
238242 lines = r .read ()
239243 lines = lines .split ('\r \n ' )
240244 for l in lines :
245+ if l .startswith (u'\ufeff ' ):
246+ l = l [1 :]
241247 list = l .split ("-->" )
242248 if len (list ) < 2 :
243249 continue
244- log .error (l )
250+ log .debug (l )
245251 newPath = os .path .join (tempPath , list [0 ])
246252 dirname = os .path .dirname (newPath )
247253 if not os .path .exists (dirname ):
248254 os .mkdir (dirname )
249- oldPath = os .path .join (dirsource , list [1 ].replace ("\\ " , os .path .sep ))
255+ oldPath = os .path .join (dirsource ,
256+ list [1 ].replace (
257+ "\\ " , os .path .sep )
258+ )
259+
250260 if os .path .isdir (oldPath ):
251261 #tempFile = tempfile.mkstemp()
252262 newPath = os .path .join (tempPath , list [0 ])
253263 shutil .copytree (oldPath , newPath )
254264 else :
255- log .error (oldPath )
265+ log .debug (oldPath )
256266 shutil .copy (
257267 os .path .normpath (oldPath ),
258268 newPath
259269 )
260270
261271 #вызовем v8unpack, для сборки файла из исходников.
262272 tempFile = tempfile .mktemp ("." + extfile )
263- log .debug (["UnpackV8.exe" , "-PACK" , '{}{}' .format (tempPath , os .path .sep ), tempFile ])
264- log .error ('UnpackV8.exe -B "{}" "{}"' .format ('{}{}' .format (tempPath , os .path .sep ), tempFile ))
265- result = subprocess .check_call (['UnpackV8.exe' , '-PACK' , '{}{}' .format (tempPath , os .path .sep ), tempFile ])
273+ log .debug ('unpackv8 -B "{}" "{}"' .format ('{}' .format (tempPath ), tempFile ))
274+ result = subprocess .check_call (
275+ ['unpackv8' ,
276+ '-B' ,
277+ '{}' .format (tempPath ),
278+ tempFile ]
279+ )
280+
281+ log .debug ("copy from {} to {}" .format (tempFile , output ))
282+ assert result == 0 , "Не удалось упаковать каталог {}" .format (tempPath )
266283 shutil .move (tempFile , output )
267284
285+ return output
286+
268287def main ():
269288
270289 parser = argparse .ArgumentParser (description = "Утилита \
0 commit comments