462 else: |
462 else: |
463 # it is a file |
463 # it is a file |
464 d = os.path.dirname(outname) |
464 d = os.path.dirname(outname) |
465 if not os.path.exists(d): |
465 if not os.path.exists(d): |
466 self.__makedirs(d) |
466 self.__makedirs(d) |
467 f = open(outname, "wb") |
467 with open(outname, "wb") as f: |
468 f.write(zipFile.read(name)) |
468 f.write(zipFile.read(name)) |
469 f.close() |
|
470 self.__installedFiles.append(outname) |
469 self.__installedFiles.append(outname) |
471 self.progress.setValue(tot) |
470 self.progress.setValue(tot) |
472 # now compile user interface files |
471 # now compile user interface files |
473 compileUiFiles(os.path.join(destination, packageName), True) |
472 compileUiFiles(os.path.join(destination, packageName), True) |
474 else: |
473 else: |
475 outname = os.path.join(destination, pluginFileName) |
474 outname = os.path.join(destination, pluginFileName) |
476 f = open(outname, "w", encoding="utf-8") |
475 with open(outname, "w", encoding="utf-8") as f: |
477 f.write(pluginSource) |
476 f.write(pluginSource) |
478 f.close() |
|
479 self.__installedFiles.append(outname) |
477 self.__installedFiles.append(outname) |
480 except os.error as why: |
478 except os.error as why: |
481 self.__rollback() |
479 self.__rollback() |
482 return ( |
480 return ( |
483 False, |
481 False, |