def InstallPackage(self, package): system_installer = GetSystemInstaller() if not system_installer: ShowErrorDialog( GT(u'Cannot install package'), GT(u'A compatible package manager could not be found on the system' ), __name__, warn=True) return Logger.Info(__name__, GT(u'Attempting to install package: {}').format(package)) Logger.Info(__name__, GT(u'Installing with {}').format(system_installer)) install_cmd = ( system_installer, package, ) wx.Yield() # FIXME: Use ExecuteCommand here install_output = subprocess.Popen(install_cmd) # Command appears to not have been executed correctly if install_output == None: ShowErrorDialog(GT(u'Could not install package: {}'), GT(u'An unknown error occurred'), __name__) return # Command executed but did not return success code if install_output.returncode: err_details = ( GT(u'Process returned code {}').format( install_output.returncode), GT(u'Command executed: {}').format(u' '.join(install_cmd)), ) ShowErrorDialog(GT(u'An error occurred during installation'), u'\n'.join(err_details), __name__) return
def InitDefaultSettings(self): self.build_options = [] option_list = ( ( self.chk_md5, GetExecutable(u'md5sum'), ), ( self.chk_strip, GetExecutable(u'strip'), ), ( self.chk_rmstage, True, ), ( self.chk_lint, GetExecutable(u'lintian'), ), ( self.chk_install, GetSystemInstaller(), ), ) for option, command in option_list: # FIXME: Commands should be updated globally if not isinstance(command, bool): command = CommandExists(command) option.Enable(bool(command)) option.SetValue(FieldEnabled(option) and option.Default) if bool(command): self.build_options.append(option)
u'md5_disabled': GT(u'Install md5sum package for this option'), u'strip': ( GT(u'Discards unneeded symbols from binary files'), u'', GT(u'See "man 1 strip"'), ), u'strip_disabled': GT(u'Install binutils package for this option'), u'rmstage': GT(u'Delete staged directory tree after package has been created'), u'lintian': ( GT(u'Checks the package for warnings & errors according to lintian specifications'), u'', GT(u'See "Help ➜ Reference ➜ Lintian Tags Explanation"'), ), u'lintian_disabled': GT(u'Install lintian package for this option'), btnid.BUILD: GT(u'Start building'), u'install': ( GT(u'Install package using a system installer after build'), u'', u'{} {}'.format(GT(u'System installer set to:'), GetSystemInstaller()), ), u'install_disabled': ( GT(u'Installation requires one of the following utilities:'), u'', GT(u'gdebi-gtk, gdebi-kde'), ), } TT_pages = { pgid.CONTROL: TT_control, pgid.DEPENDS: TT_depends, pgid.FILES: TT_files, pgid.MAN: TT_manpages, pgid.SCRIPTS: TT_scripts, pgid.CHANGELOG: TT_changelog,