def make_plugins(self): """ Package built-in plugins into ZIP archives. """ if isdir('@plugins/'): mkdir(os.path.join(self.build_exe, 'plugins')) for file_or_directory in os.listdir(expandPath('@plugins/')): plugin = os.path.join(expandPath('@plugins/'), file_or_directory) if isdir(plugin): distutils.log.info('packaging plugin: %s', file_or_directory) zippath = os.path.join(self.build_exe, 'plugins', '%s.zip' % file_or_directory) with zipfile.ZipFile(zippath, 'w', zipfile.ZIP_STORED) as zipf: for root, dirs, files in os.walk(plugin): if not root.endswith('__pycache__'): for filename in files: path = expandPath(os.path.join(root, filename)) if path.endswith('.py'): new_path = '%s.pyc' % rstrip(path, '.py') py_compile.compile(path, new_path) arcname = os.path.join(file_or_directory, os.path.relpath(new_path, plugin)) zipf.write(new_path, arcname) fremove(new_path) else: arcname = os.path.join(file_or_directory, os.path.relpath(path, plugin)) zipf.write(path, arcname)
def uninstall(self, plugin): """ Uninstall the given plugin. :type plugin: AbstractPlugin """ if self.dispose(plugin): self.session.removePlugin(plugin) path = plugin.path() if isdir(path): rmdir(path) elif fexists(path): fremove(path)
def uninstall(self, reasoner): """ Uninstall the given reasoner. :type reasoner: AbstractReasoner """ if self.dispose(reasoner): self.session.removeReasoner(reasoner) path = reasoner.path() if isdir(path): rmdir(path) elif fexists(path): fremove(path)
def make_cleanup(self): """ Cleanup the build directory from garbage files. """ if WIN32: fremove(os.path.join(self.build_exe, 'jvm.dll')) elif MACOS: # Delete symlinks to Qt frameworks created during build for framework in os.listdir(QT_LIB_PATH): source = os.path.relpath(os.path.join(QT_LIB_PATH, framework), os.path.join(sys.exec_prefix, "lib")) target = os.path.join(os.path.join(sys.exec_prefix, "lib"), framework) if os.path.islink(target) and os.readlink(target) == source: distutils.log.info("Removing symlink %s to %s", target, source) os.unlink(target)
def doDeleteProject(self, path): """ Delete the given project. :type path: str """ msgbox = QtWidgets.QMessageBox(self) msgbox.setIconPixmap( QtGui.QIcon(':/icons/48/ic_help_outline_black').pixmap(48)) msgbox.setInformativeText( '<b>NOTE: This action is not reversible!</b>') msgbox.setStandardButtons(QtWidgets.QMessageBox.No | QtWidgets.QMessageBox.Yes) msgbox.setTextFormat(QtCore.Qt.RichText) msgbox.setWindowIcon(QtGui.QIcon(':/icons/128/ic_eddy')) #msgbox.setWindowTitle('Remove project: {0}?'.format(os.path.basename(path))) msgbox.setWindowTitle('Remove project: {0}?'.format(path)) #msgbox.setText('Are you sure you want to remove project: <b>{0}</b>'.format(os.path.basename(path))) msgbox.setText( 'Are you sure you want to remove project: <b>{0}</b>'.format(path)) msgbox.exec_() if msgbox.result() == QtWidgets.QMessageBox.Yes: try: # REMOVE THE PROJECT FROM DISK #rmdir(path) fremove(path) except Exception as e: msgbox = QtWidgets.QMessageBox(self) msgbox.setDetailedText(format_exception(e)) msgbox.setIconPixmap( QtGui.QIcon(':/icons/48/ic_error_outline_black').pixmap( 48)) msgbox.setStandardButtons(QtWidgets.QMessageBox.Close) msgbox.setTextFormat(QtCore.Qt.RichText) msgbox.setText( 'Eddy could not remove the specified project: <b>{0}</b>!'. format(path)) msgbox.setWindowIcon(QtGui.QIcon(':/icons/128/ic_eddy')) msgbox.setWindowTitle('ERROR!') msgbox.exec_() else: self.sgnUpdateRecentProjects.emit()
def make_clean(self): """ Cleanup the build directory from garbage files. """ fremove(os.path.join(self.build_exe, 'jvm.dll'))