Hi Robin,
I tried to develop the bare minimum app but exe generated has
library.zip file which need to replaced. How can i get around this.
Below a sample code of what i am trying to achieve.
Thanks
Thomas
import wx
import os
import sys
import zipfile
wildcard = "*.zip"
#modules ={}
class Frame1(wx.Frame):
def _init_ctrls(self, prnt):
wx.Frame.__init__(self, style=wx.DEFAULT_FRAME_STYLE, name='',
parent=prnt, title='Frame1', pos=wx.Point(-1, -1), id=wxID_FRAME1,
size=wx.Size(-1, -1))
class BoaApp(wx.App):
def processUpgradeProcess(self,filename,upgarde_dir):
self.unzipFileIntoDir(filename,upgarde_dir)
print filename
def OnInit(self):
upgarde_dir=os.path.dirname(os.path.abspath(sys.argv[0]))
frame=Frame1(None)
dlg = wx.FileDialog(frame, message="Choose the file upgrade",
defaultDir=os.getcwd(),
defaultFile="", wildcard=wildcard, style=wx.OPEN |
wx.CHANGE_DIR)
if dlg.ShowModal() == wx.ID_OK:
filenames = dlg.GetPaths()
print filenames
self.processUpgradeProcess(filenames[0],upgarde_dir)
frame.Destroy()
return True
def unzipFileIntoDir(self,file, dir):
zfobj = zipfile.ZipFile(file)
for name in zfobj.namelist():
if name.endswith('/'):
#os.mkdir(os.path.join(dir, name))
print "no directories at this stage"
else:
outfile = open(os.path.join(dir, name), 'wb')
outfile.write(zfobj.read(name))
outfile.close()
def main():
application = BoaApp(0)
application.MainLoop()
if __name__ == '__main__':
main()
Also the setup.py
from distutils.core import setup
from glob import glob
import py2exe
setup(name="DxBxClientUpgrade",
windows=["../dxbxUpgradeApp.py"],
version='1.0.001',
)
and the command i am using python setup.py py2exe
cheers
Thomas
···
On Sep 18, 10:49 am, Robin Dunn <ro...@alldunn.com> wrote:
On 9/17/09 2:43 PM, thomas wrote:
> Hi Werner,
> Thanks for that I was planning to follow similar structure .
> I have couple of queries here. Do you use a separate application for
> upgrade process.
> Windows wont let you replace the application when it is running right.
Correct. The typical implementation for a self-updater would be to do a
version check, and if an update is needed then launch a different
executable that does the download and install and then relaunches the
new version of the original executable. Keep in mind that on Windows
active DLLs (PYD files are DLLs) also can't be replaced, so you may have
to get a little creative to make sure that the updater program is not
using anything that you may want to replace in a future update.
--
Robin Dunn
Software Craftsmanhttp://wxPython.org