keryx team mailing list archive
-
keryx team
-
Mailing list archive
-
Message #00218
[Merge] lp:~mac9416/keryx/unstable into lp:keryx/unstable
mac9416 has proposed merging lp:~mac9416/keryx/unstable into lp:keryx/unstable.
Requested reviews:
Keryx Admins (keryx-admins)
apt-get is now called properly - package installation is looking good
Improved installation dialogs - made some translatable
--
https://code.launchpad.net/~mac9416/keryx/unstable/+merge/17081
Your team Keryx Development Team is subscribed to branch lp:keryx/unstable.
=== modified file 'lib/wxkeryx/main.py'
--- lib/wxkeryx/main.py 2010-01-06 03:53:01 +0000
+++ lib/wxkeryx/main.py 2010-01-09 21:39:14 +0000
@@ -223,9 +223,9 @@
def Closing(self, event): # Cleanup cleanup, everybody do your share
#self.thread.StopThreads()
#self.thread.Destroy()
- log.info(_('Cleaning up plugins'))
+ log.info(_("Cleaning up plugins"))
for name, instance, type, version in plugins.InterfacePluginList: instance.cleanup()
- log.info(_('Shutting down'))
+ log.info(_("Shutting down"))
self.Destroy()
def OnClose(self, event):
@@ -347,29 +347,17 @@
#list of failed files now stored in frame[1] as returned by download.py
def OnInstall(self, event):
-
-# dlg = wx.MessageDialog(None, _("This procedure will first make the downloaded packages available to the OS in a format suitable for installation, then will call the OS to install them. " + \
-# "These steps both require 'root' access to the machine, so keryx will write the commands to a script and then run it as 'root'. " + \
-# "Would you like to continue? (got root?)"),
-# _("Intro of Install"), wx.YES_NO | wx.ICON_QUESTION)
dlg = InstallProjectDialog(None, -1, _("Install Project"))
result = dlg.ShowModal()
- if dlg.sys_cache_radio.GetValue():
- sys_cache = True
- local_repo = False
- move = dlg.move_checkbox.GetValue()
- elif dlg.local_repo_radio.GetValue():
- local_repo = True
- sys_cache = False
+ move = dlg.move_checkbox.GetValue()
dlg.Destroy()
+ # Actually, I was just kidding about wanting to install.
if result == wx.ID_CANCEL:
return
- if sys_cache:
- install = project.projects[len(project.projects) - 1].plugin.installCache(project.projects[len(project.projects) -1].dir, 'installcache', move=move)
- elif local_repo:
- wx.MessageBox(_("This feature is not implemented yet. Sorry."),_("Not Implemented"))
+ # Start the installation
+ install = project.projects[len(project.projects) - 1].plugin.installCache(project.projects[len(project.projects) -1].dir, 'installcache', move=move)
if install: # If installCache was successful...
dlg = wx.MessageDialog(None, _("The packages were successfully " \
@@ -380,17 +368,19 @@
result = dlg.ShowModal()
dlg.Destroy()
else:
- wx.MessageBox(_("Oh no! A error occurred when doing the transfer." \
- " Check the log for more details. Make sure no other " \
- "package manager is running when you try to transfer " \
- "the files.\n\nYou may attempt to transfer the files " \
- "by hand (experienced users only)."), _("Install Error"),
- wx.ICON_ERROR)
- return
- if result == wx.ID_NO: # Don't want to install packages now...
- return
-
- # Install the packages
+ wx.MessageBox(_("An error occurred when doing the transfer. Make " \
+ "sure no other package manager is running when " \
+ "you try to transfer the files. Check the log " \
+ "for more details.\n\nYou may attempt to " \
+ "transfer the files by hand (experienced users " \
+ "only)."), _("Install Error"), wx.ICON_ERROR)
+ return
+
+ # Don't want to install packages now.
+ if result == wx.ID_NO:
+ return
+
+ # Get the necessary information for package installation
projdir = project.projects[len(project.projects) -1].dir
spacksdir = os.path.join(projdir, 'packages')
spacks = [x for x in os.listdir(spacksdir) if os.path.isfile(os.path.join(spacksdir, x)) and (os.path.splitext(x)[1] == '.deb')]
@@ -403,58 +393,22 @@
packnames = dlg.GetSelected()
dlg.Destroy()
- if result == wx.ID_CANCEL: # Never mind about installing packages now...
+ # Never mind about installing packages now...
+ if result == wx.ID_CANCEL:
return
result = project.projects[len(project.projects) - 1].plugin.installPacks(' '.join(packnames))
if result:
- wx.MessageBox(_("All packages successfully installed."), _("Install Succeessful"))
+ wx.MessageBox(_("All packages successfully installed."),
+ _("Install Succeessful"))
else:
- wx.MessageBox(_("Oh no! A error occurred while installing your packages. Check the log for more details. Make sure no other package manager is running when you try to Install the packages.\n" + \
- "Another option is installing the packages by hand (Knowledged users only)."), _("Install Error"))
-
-# if result == wx.ID_YES:
-# dlg = wx.MessageDialog(None, _("There are two methods for making the packages available. First, mimicing a Repository and informing the OS of it and letting it use the repo to retrieve its updates, " + \
-# "or moving the packages directly into the OS'es cache so that the OS thinks its already downloaded them and only needs to install them. This way is easier. " + \
-# "Would you like to use the cache method? Selecting 'No' will use the Repo method."), \
-# _("Choose Install method"), wx.YES_NO | wx.ICON_QUESTION)
-# result = dlg.ShowModal()
-# dlg.Destroy()
-# install = True
-# if result == wx.ID_YES: # Cache method
-# dlg = wx.MessageDialog(None, _("You can either move your packages you have downloaded to the cache, or just copy them.\n" + \
-# "Moving them will free up space in your project again. Move?\nPlease ensure no package manager is running before continuing! The script will be run next."), \
-# _("Move Packages?"), wx.YES_NO | wx.ICON_QUESTION)
-# result = dlg.ShowModal()
-# dlg.Destroy()
-# if result == wx.ID_YES:
-# move = True
-# else:
-# move = False
-# install = project.projects[len(project.projects) - 1].plugin.installCache(project.projects[len(project.projects) -1].dir, 'installcache', move=move)
-#
-# # Let's install them packages!
-# if install: # The cache needs to have been successfully filled.
-# projdir = project.projects[len(project.projects) -1].dir
-# spacksdir = os.path.join(projdir, 'packages')
-# spacks = [x for x in os.listdir(spacksdir) if os.path.isfile(os.path.join(spacksdir, x)) and (os.path.splitext(x)[1] == '.deb')]
-# packnames = ' '.join([x[:x.find('_')] for x in spacks])
-# #TODO: prompt the user for which of these to install
-# if not project.projects[len(project.projects) - 1].plugin.installPacks(packnames):
-# wx.MessageBox(_("Oh no! A error occurred while installing your packages. Check the log for more details. Make sure no other package manager is running when you try to Install the packages.\n" + \
-# "Another option is installing the packages by hand (Knowledged users only)."), _("Install Error"))
-# else:
-# log.info(_("Package installation succeeded"))
-
-# elif result == wx.ID_NO: # Repo method
-# wx.MessageBox(_("This feature is not implemented yet. Sorry."),_("Not Implemented"))
-# #install = project.projects[len(project.projects) - 1].installRepo()
-# if not install:
-# wx.MessageBox(_("Oh no! A error occurred when doing the transfer. Check the log for more details. Make sure no other package manager is running when you try to transfer the files.\n" + \
-# "Another option is transferring the files by hand (Knowledged users only)."), _("Install Error"))
-# else:
-# wx.MessageBox(_("Install finished."), _("Finished"))
-
+ wx.MessageBox(_("An error occurred while installing your " \
+ "packages. Make sure no other package manager is " \
+ "running when you try to Install the packages. " \
+ "Check the log for more details.\n\nAnother " \
+ "option is installing the packages by hand using " \
+ "apt-get."),
+ _("Install Error"))
def OnUpdates(self, event):
updates = []
@@ -610,30 +564,28 @@
class InstallProjectDialog(wx.Dialog):
def __init__(self, parent, id, title):
- wx.Dialog.__init__(self, parent, id, title, size=(480, 190))
+ wx.Dialog.__init__(self, parent, id, title, size=(480, 160))
panel = wx.Panel(self, -1)
vbox = wx.BoxSizer(wx.VERTICAL)
- wx.StaticBox(panel, -1, _("Installation method"), (5, 5), (470, 115))
-
- self.sys_cache_radio = wx.RadioButton(panel, -1, _("Move packages to system cache"), (15, 30), style=wx.RB_GROUP)
- self.Bind(wx.EVT_RADIOBUTTON, self.OnSysCache, self.sys_cache_radio)
- self.local_repo_radio = wx.RadioButton(panel, -1, _("Create local repository"), (15, 55))
- self.Bind(wx.EVT_RADIOBUTTON, self.OnLocalRepo, self.local_repo_radio)
-
-
- self.browse_btn = filebrowse.DirBrowseButton(self, -1, pos=(35, 80), size=(430, 30))
- self.browse_btn.Disable()
- self.Bind(wx.EVT_BUTTON, self.OnBrowse, self.browse_btn)
-
- self.move_checkbox = wx.CheckBox(panel, -1, _("Delete packages from project folder after installation"), (5, 125))
+ text = wx.StaticText(panel, -1, _("All downloaded package files will " \
+ "be copied to the APT cache so that APT will believe " \
+ "they have been downloaded. In the next step, " \
+ "apt-get will be called to install the packages."),
+ (15, 10), (470, 80))
+
+ #All downloaded package files will be copied to the APT cache ao that APT will believe they have been downloaded. In the next step, apt-get will be called to install the packages.
+
+ self.move_checkbox = wx.CheckBox(panel, -1,
+ _("Delete packages from project folder after installation"),
+ (5, 95))
btnSizer = wx.StdDialogButtonSizer()
- btn = wx.Button(self, wx.ID_CANCEL, 'Cancel')
+ btn = wx.Button(self, wx.ID_CANCEL, _("Cancel"))
btnSizer.SetCancelButton(btn)
btnSizer.AddButton(btn)
- btn = wx.Button(self, wx.ID_OK, 'Continue')
+ btn = wx.Button(self, wx.ID_OK, _("Continue"))
btnSizer.SetAffirmativeButton(btn)
btnSizer.AddButton(btn)
btnSizer.Realize()
@@ -643,15 +595,6 @@
self.SetSizer(vbox)
- def OnBrowse(self, evt):
- log.info(_('Browsing: Not implemted.'))
-
- def OnLocalRepo(self, evt):
- self.browse_btn.Enable()
-
- def OnSysCache(self, evt):
- self.browse_btn.Disable()
-
class SelectPackagesDialog(wx.Dialog):
"""Dialog for selection of packages to be installed"""
def __init__(self, parent, id, title, items):
@@ -660,10 +603,10 @@
vbox = wx.BoxSizer(wx.VERTICAL)
btnSizer = wx.BoxSizer(wx.HORIZONTAL)
- btn = wx.Button(self, wx.ID_ANY, 'Select All')
+ btn = wx.Button(self, wx.ID_ANY, _("Select All"))
self.Bind(wx.EVT_BUTTON, self.OnSelectAll, btn)
btnSizer.Add(btn)
- btn = wx.Button(self, wx.ID_ANY, 'Select None')
+ btn = wx.Button(self, wx.ID_ANY, _("Select None"))
self.Bind(wx.EVT_BUTTON, self.OnSelectNone, btn)
btnSizer.Add(btn)
@@ -718,7 +661,7 @@
sizer.Add(self.list, 1, wx.EXPAND)
self.SetSizer(sizer)
- self.list.InsertColumn(0, "Package")
+ self.list.InsertColumn(0, _("Package"))
for key, data in items.iteritems():
index = self.list.InsertStringItem(sys.maxint, data)
=== modified file 'plugins/Debian.py'
--- plugins/Debian.py 2010-01-06 03:53:01 +0000
+++ plugins/Debian.py 2010-01-09 21:39:14 +0000
@@ -48,7 +48,7 @@
outfile.close()
return True
except:
- log.error('Problem writing to project settings file')
+ log.error(_('Problem writing to project settings file'))
return False
def loadProject(self, directory):
@@ -146,7 +146,14 @@
return os.path.join(os.path.join(dir, 'sources'), 'sources.list')
def installCache(self, projdir, scriptname, move=False):
- """ Transfers all downloaded packages to the OS cache. Uses sh script called as 'root'"""
+ """ Transfers all downloaded packages to the OS cache.
+ Uses sh script called as 'root'
+ """
+ # Make sure there are packages to install
+ if not os.path.exists(os.path.join(projdir, 'packages')):
+ log.error(_("%s does not exist: no packages to be installed") % \
+ (os.path.join(projdir, 'packages')))
+ return False
scriptpath = os.path.join(projdir, scriptname+'.sh')
#slistsdir = os.path.join(projdir, 'lists')
spacksdir = os.path.join(projdir, 'packages')
@@ -272,9 +279,11 @@
return True
def installPacks(self, packnames):
- run = self.__runRoot('apt-get', 'install -y %s <\\`tty\\`' % (packnames), term='xterm -hold -e')
+ run = self.__runRoot('xterm',
+ '-e sh -c \"apt-get install -y %s; echo \\\"Press any key to exit.\\\"; read x\"' % \
+ (packnames))
if run[0] != 0:
- log.error('exit code:%i\n%s' % (run[0], run[1]))
+ log.error(_('exit code:%i\n%s' % (run[0], run[1])))
log.info(_('installCache: failed'))
return False
log.info(_('installCache: success'))
@@ -462,7 +471,7 @@
status.close()
return installed
- def __runRoot(self, program, args, term=None):
+ def __runRoot(self, program, args):
root = ''
for a in ('gksu', 'gksudo', 'kdesu', 'kdesudo'):
if commands.getstatusoutput('which '+a)[0] == 0:
@@ -477,10 +486,9 @@
description = ''
if root == '': return (64, 'Could not find superuser access')
try:
- if term:
- exit = commands.getstatusoutput('%s "%s %s %s %s"' % (term, root, description, program, args))
- else:
- exit = commands.getstatusoutput('%s %s "%s %s"' % (root, description, program, args))
+ print '%s %s -- %s %s' % (root, description, program, args)
+ exit = commands.getstatusoutput('%s %s -- %s %s' % \
+ (root, description, program, args))
except:
exit = (64, 'Error spawning shell command')
return exit