Merge lp:~openerp-groupes/openobject-client-web/client-web-win32-packaging into lp:openobject-client-web/trunk

Proposed by Julien Thewys
Status: Merged
Merged at revision: 3828
Proposed branch: lp:~openerp-groupes/openobject-client-web/client-web-win32-packaging
Merge into: lp:openobject-client-web/trunk
Diff against target: 992 lines (+360/-544)
7 files modified
openobject/commands.py (+8/-5)
setup.nsi (+267/-0)
win32/OpenERPWebService.py (+53/-49)
win32/fixps.py (+0/-22)
win32/setup.nsi (+0/-266)
win32/setup.py (+32/-153)
win32/util.py (+0/-49)
To merge this branch: bzr merge lp:~openerp-groupes/openobject-client-web/client-web-win32-packaging
Reviewer Review Type Date Requested Status
Xavier (Open ERP) (community) Needs Information
Review via email: mp+39860@code.launchpad.net

Description of the change

Fixed config file path lookup
Fixed win32/* for windows service
Fixed setup.nsi

Tested (packaged and deployed with python 2.5 on Windows Server 2008 SP2 and Win XP SP3).

To post a comment you must log in.
Revision history for this message
Xavier (Open ERP) (xmo-deactivatedaccount) wrote :

* Why not leave setup.nsi in win32? (also it was removed and re-added I think, not moved via bzr)
* Can't we not just merge win32/setup.py into py2exe_utils?
* Maybe make win32/ into a package and move py2exe_utils stuff into it, if setup(service=) needs a Python module?

review: Needs Information
Revision history for this message
Julien Thewys (julien-thewys) wrote :

* setup.nsi: I ported the one from server so I considered it more like a re-add, and it is outside win32 in the server (same for pixmaps/)
* maybe we could merge it, I didn't find a quick way to do it without py2exe complaining/failing.
* nice to have ;-)

Revision history for this message
Xavier (Open ERP) (xmo-deactivatedaccount) wrote :

OK. Going to try to check/test this afternoon and maybe ask stw to check if he can do his own packaging using that, if everything works I'll merge. Thanks.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openobject/commands.py'
2--- openobject/commands.py 2010-10-29 10:00:32 +0000
3+++ openobject/commands.py 2010-11-02 15:59:41 +0000
4@@ -16,11 +16,14 @@
5
6 DISTRIBUTION_CONFIG = os.path.join('doc', 'openerp-web.cfg')
7 def get_config_file():
8- setupdir = os.path.dirname(os.path.dirname(__file__))
9- isdevdir = os.path.isfile(os.path.join(setupdir, 'setup.py'))
10- configfile = '/etc/openerp-web.cfg'
11- if isdevdir or not os.path.exists(configfile):
12- configfile = os.path.join(setupdir, DISTRIBUTION_CONFIG)
13+ if hasattr(sys, 'frozen'):
14+ configfile = os.path.join(openobject.paths.root(), DISTRIBUTION_CONFIG)
15+ else:
16+ setupdir = os.path.dirname(os.path.dirname(__file__))
17+ isdevdir = os.path.isfile(os.path.join(setupdir, 'setup.py'))
18+ configfile = '/etc/openerp-web.cfg'
19+ if isdevdir or not os.path.exists(configfile):
20+ configfile = os.path.join(setupdir, DISTRIBUTION_CONFIG)
21 return configfile
22
23 def configure_babel():
24
25=== renamed directory 'win32/pixmaps' => 'pixmaps'
26=== added file 'setup.nsi'
27--- setup.nsi 1970-01-01 00:00:00 +0000
28+++ setup.nsi 2010-11-02 15:59:41 +0000
29@@ -0,0 +1,267 @@
30+##############################################################################
31+#
32+# Copyright (c) 2004-2008 Tiny SPRL (http://tiny.be) All Rights Reserved.
33+#
34+# WARNING: This program as such is intended to be used by professional
35+# programmers who take the whole responsability of assessing all potential
36+# consequences resulting from its eventual inadequacies and bugs
37+# End users who are looking for a ready-to-use solution with commercial
38+# garantees and support are strongly adviced to contract a Free Software
39+# Service Company
40+#
41+# This program is Free Software; you can redistribute it and/or
42+# modify it under the terms of the GNU General Public License
43+# as published by the Free Software Foundation; either version 3
44+# of the License, or (at your option) any later version.
45+#
46+# This program is distributed in the hope that it will be useful,
47+# but WITHOUT ANY WARRANTY; without even the implied warranty of
48+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
49+# GNU General Public License for more details.
50+#
51+# You should have received a copy of the GNU General Public License
52+# along with this program; if not, write to the Free Software
53+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
54+###############################################################################
55+!ifndef VERSION
56+ !error "Do not forget to specify the version of OpenERP - /DVERSION=<VERSION>"
57+!endif
58+
59+!include "MUI.nsh"
60+
61+;--------------------------------
62+;General
63+
64+;Name and file
65+Name "OpenERP Web"
66+OutFile "openerp-web-setup-${VERSION}.exe"
67+SetCompressor lzma
68+SetCompress auto
69+
70+;Default installation folder
71+InstallDir "$PROGRAMFILES\OpenERP Web"
72+
73+;Get installation folder from registry if available
74+InstallDirRegKey HKLM "Software\OpenERP Web" ""
75+
76+BrandingText "OpenERP Web ${VERSION}"
77+
78+;Vista redirects $SMPROGRAMS to all users without this
79+RequestExecutionLevel admin
80+
81+;--------------------------------
82+;Variables
83+
84+Var MUI_TEMP
85+Var STARTMENU_FOLDER
86+
87+;--------------------------------
88+;Interface Settings
89+
90+!define MUI_ABORTWARNING
91+
92+!define REGKEY "SOFTWARE\$(^Name)"
93+!define MUI_LANGDLL_REGISTRY_ROOT HKLM
94+!define MUI_LANGDLL_REGISTRY_KEY ${REGKEY}
95+!define MUI_LANGDLL_REGISTRY_VALUENAME InstallerLanguage
96+
97+!insertmacro MUI_RESERVEFILE_LANGDLL
98+;--------------------------------
99+;Pages
100+
101+!define MUI_ICON ".\pixmaps\openerp-icon.ico"
102+!define MUI_WELCOMEFINISHPAGE_BITMAP ".\pixmaps\openerp-intro.bmp"
103+!define MUI_UNWELCOMEFINISHPAGE_BITMAP ".\pixmaps\openerp-intro.bmp"
104+!define MUI_HEADERIMAGE
105+!define MUI_HEADERIMAGE_BITMAP_NOSTRETCH
106+!define MUI_HEADER_TRANSPARENT_TEXT ""
107+!define MUI_HEADERIMAGE_BITMAP ".\pixmaps\openerp-slogan.bmp"
108+!define MUI_LICENSEPAGE_TEXT_BOTTOM "$(LicenseText)"
109+!define MUI_LICENSEPAGE_BUTTON "$(LicenseNext)"
110+
111+!insertmacro MUI_PAGE_WELCOME
112+!insertmacro MUI_PAGE_LICENSE ".\doc\LICENSE.TXT"
113+!insertmacro MUI_PAGE_DIRECTORY
114+
115+;Start Menu Folder Page Configuration
116+!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
117+!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\OpenERP Web"
118+!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "OpenERP Web"
119+
120+!insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
121+
122+!insertmacro MUI_PAGE_INSTFILES
123+
124+!define MUI_FINISHPAGE_NOAUTOCLOSE
125+!define MUI_FINISHPAGE_RUN
126+!define MUI_FINISHPAGE_RUN_CHECKED
127+!define MUI_FINISHPAGE_RUN_TEXT "$(FinishPageText)"
128+!define MUI_FINISHPAGE_RUN_FUNCTION "LaunchLink"
129+!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
130+!define MUI_FINISHPAGE_SHOWREADME $INSTDIR\README.txt
131+!insertmacro MUI_PAGE_FINISH
132+
133+
134+!insertmacro MUI_UNPAGE_WELCOME
135+!insertmacro MUI_UNPAGE_CONFIRM
136+!insertmacro MUI_UNPAGE_INSTFILES
137+
138+;--------------------------------
139+;Languages
140+
141+!insertmacro MUI_LANGUAGE "English"
142+!insertmacro MUI_LANGUAGE "French"
143+
144+!macro CreateInternetShortcut FILENAME URL
145+ WriteINIStr "${FILENAME}.url" "InternetShortcut" "URL" "${URL}"
146+!macroend
147+
148+;--------------------------------
149+;Installer Sections
150+Function .onInit
151+!ifndef ALLINONE
152+ ;Language selection dialog
153+ Push ""
154+ Push ${LANG_ENGLISH}
155+ Push English
156+ Push ${LANG_FRENCH}
157+ Push French
158+ Push A ; A means auto count languages
159+ ; for the auto count to work the first empty push (Push "") must remain
160+ LangDLL::LangDialog "Installer Language" "Please select the language of the installer"
161+
162+ Pop $LANGUAGE
163+ StrCmp $LANGUAGE "cancel" 0 +2
164+ Abort
165+!endif
166+
167+ ClearErrors
168+ ReadRegStr $0 HKLM "Software\OpenERP Web" ""
169+ IfErrors DoInstall 0
170+ MessageBox MB_OK "$(CannotInstallWebText)"
171+ Quit
172+ DoInstall:
173+FunctionEnd
174+
175+Section "OpenERP Web" SecOpenERPWeb
176+ nsExec::Exec "net stop openerp-web"
177+ sleep 2
178+
179+ SetOutPath "$INSTDIR"
180+
181+ ;ADD YOUR OWN FILES HERE...
182+ File /r "dist\*"
183+
184+ SetOutPath "$INSTDIR\service"
185+ File /r "win32\dist\*"
186+ File "win32\start.bat"
187+ File "win32\stop.bat"
188+
189+ SetOutPath "$INSTDIR\conf"
190+ File "/oname=openerp-web.cfg" ".\doc\openerp-web.cfg"
191+
192+ ;Store installation folder
193+ WriteRegStr HKLM "Software\OpenERP Web" "" $INSTDIR
194+
195+!ifndef ALLINONE
196+ ;Create uninstaller
197+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenERP Web" "DisplayName" "OpenERP Web ${VERSION}"
198+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenERP Web" "UninstallString" "$INSTDIR\Uninstall.exe"
199+!else
200+ WriteRegStr HKLM "Software\OpenERP AllInOne" "UninstallWeb" "$INSTDIR\Uninstall.exe"
201+!endif
202+ WriteUninstaller "$INSTDIR\Uninstall.exe"
203+
204+ !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
205+ ;Create shortcuts
206+ CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
207+
208+ CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Start OpenERP Web.lnk" "$INSTDIR\service\start.bat"
209+ CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Stop OpenERP Web.lnk" "$INSTDIR\service\stop.bat"
210+ CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Edit Web Config.lnk" "notepad.exe" "$INSTDIR\conf\openerp-web.cfg"
211+!ifndef ALLINONE
212+ CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\uninstall.exe"
213+!endif
214+ !insertmacro CreateInternetShortcut "$SMPROGRAMS\$STARTMENU_FOLDER\Forum" "http://www.openerp.com/forum"
215+ !insertmacro CreateInternetShortcut "$SMPROGRAMS\$STARTMENU_FOLDER\Translation" "https://translations.launchpad.net/openobject"
216+ !insertmacro MUI_STARTMENU_WRITE_END
217+
218+
219+ nsExec::Exec '"$INSTDIR\service\OpenERPWebService.exe" -auto -install'
220+
221+SectionEnd
222+
223+;Descriptions
224+
225+
226+;--------------------------------
227+;Uninstaller Section
228+
229+Section "Uninstall"
230+ nsExec::Exec "net stop openerp-web"
231+ sleep 2
232+ nsExec::Exec '"$INSTDIR\service\OpenERPWebService.exe" -remove'
233+ sleep 2
234+
235+ RMDIR /r "$INSTDIR"
236+ !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
237+
238+ Delete "$SMPROGRAMS\$MUI_TEMP\Forum.url"
239+ Delete "$SMPROGRAMS\$MUI_TEMP\Translation.url"
240+!ifndef ALLINONE
241+ Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
242+!endif
243+ Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
244+ Delete "$SMPROGRAMS\$MUI_TEMP\Start OpenERP Web.lnk"
245+ Delete "$SMPROGRAMS\$MUI_TEMP\Stop OpenERP Web.lnk"
246+ Delete "$SMPROGRAMS\$MUI_TEMP\Edit Web Config.lnk"
247+
248+ ;Delete empty start menu parent diretories
249+ StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
250+
251+ startMenuDeleteLoop:
252+ ClearErrors
253+ RMDir $MUI_TEMP
254+ GetFullPathName $MUI_TEMP "$MUI_TEMP\.."
255+
256+ IfErrors startMenuDeleteLoopDone
257+
258+ StrCmp $MUI_TEMP $SMPROGRAMS startMenuDeleteLoopDone startMenuDeleteLoop
259+
260+ startMenuDeleteLoopDone:
261+
262+!ifndef ALLINONE
263+ DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenERP Web"
264+!else
265+ DeleteRegKey HKLM "Software\OpenERP AllInOne\UninstallWeb"
266+!endif
267+ DeleteRegKey /ifempty HKLM "Software\OpenERP Web"
268+
269+SectionEnd
270+
271+Function LaunchLink
272+ nsExec::Exec "net start openerp-web"
273+FunctionEnd
274+
275+LangString LicenseText ${LANG_ENGLISH} "Usually, a proprietary license is provided with the software: limited number of users, limited in time usage, etc. This Open Source license is the opposite: it garantees you the right to use, copy, study, distribute and modify Open ERP for free."
276+LangString LicenseText ${LANG_FRENCH} "Normalement, une licence propriétaire est fournie avec le logiciel: limitation du nombre d'utilisateurs, limitation dans le temps, etc. Cette licence Open Source est l'opposé: Elle vous garantie le droit d'utiliser, de copier, d'étudier, de distribuer et de modifier Open ERP librement."
277+
278+LangString LicenseNext ${LANG_ENGLISH} "Next >"
279+LangString LicenseNext ${LANG_FRENCH} "Suivant >"
280+
281+LangString FinishPageText ${LANG_ENGLISH} "Start OpenERP Web"
282+LangString FinishPageText ${LANG_FRENCH} "Lancer le serveur Web OpenERP"
283+
284+;Language strings
285+LangString DESC_SecOpenERPWeb ${LANG_ENGLISH} "OpenERP Web."
286+LangString DESC_SecOpenERPWeb ${LANG_FRENCH} "Serveur Web OpenERP."
287+
288+LangString CannotInstallWebText ${LANG_ENGLISH} "Can not install the OpenERP Web because a previous installation already exists on this system. Please uninstall your current installation and relaunch this setup wizard."
289+LangString CannotInstallWebText ${LANG_FRENCH} "Ne peut pas installer le serveur Web Open ERP parce qu'une installation existe déjà sur ce système. S'il vous plait, désinstallez votre installation actuelle et relancer l'installeur."
290+
291+
292+;Assign language strings to sections
293+!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
294+ !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenERPWeb} $(DESC_SecOpenERPWeb)
295+!insertmacro MUI_FUNCTION_DESCRIPTION_END
296+
297
298=== modified file 'win32/OpenERPWebService.py'
299--- win32/OpenERPWebService.py 2010-09-16 10:37:47 +0000
300+++ win32/OpenERPWebService.py 2010-11-02 15:59:41 +0000
301@@ -1,50 +1,51 @@
302-import os
303-import sys
304-import thread
305-import subprocess
306-
307-# Working Directory
308-WORK_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
309-
310-# Update PATH
311-p = os.environ.get('PATH', '').split(';')
312-
313-p.insert(0, WORK_DIR)
314-p.insert(0, WORK_DIR+"\\python25")
315-p.insert(0, WORK_DIR+"\\python25\\Scripts")
316-
317-os.environ['PATH'] = ';'.join(p)
318+# -*- coding: utf-8 -*-
319+##############################################################################
320+#
321+# OpenERP, Open Source Management Solution
322+# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
323+#
324+# This program is free software: you can redistribute it and/or modify
325+# it under the terms of the GNU Affero General Public License as
326+# published by the Free Software Foundation, either version 3 of the
327+# License, or (at your option) any later version.
328+#
329+# This program is distributed in the hope that it will be useful,
330+# but WITHOUT ANY WARRANTY; without even the implied warranty of
331+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
332+# GNU Affero General Public License for more details.
333+#
334+# You should have received a copy of the GNU Affero General Public License
335+# along with this program. If not, see <http://www.gnu.org/licenses/>.
336+#
337+##############################################################################
338
339 # Win32 python extensions modules
340 import win32serviceutil
341 import win32service
342 import win32event
343 import win32api
344-import win32con
345 import win32process
346 import servicemanager
347
348-# The command itself
349-#EXECUTABLE = ["openerp-web.exe", "--config", "conf\openerp-web.cfg"]
350-EXECUTABLE = ["python.exe", "python25\Scripts\openerp-web", "--config", "conf\openerp-web.cfg"]
351-
352-class TinyService(win32serviceutil.ServiceFramework):
353-
354+import sys
355+import subprocess
356+import os
357+import thread
358+
359+class OpenERPWebService(win32serviceutil.ServiceFramework):
360+ # required info
361 _svc_name_ = "openerp-web"
362 _svc_display_name_ = "OpenERP Web"
363-
364- _svc_description_ = "OpenERP Web Client"
365+ # optionnal info
366+ _svc_description_ = "OpenERP Web service"
367
368 def __init__(self, args):
369 win32serviceutil.ServiceFramework.__init__(self, args)
370-
371 # Create an event which we will use to wait on.
372 # The "service stop" request will set this event.
373 self.hWaitStop = win32event.CreateEvent(None, 0, 0, None)
374-
375 # a reference to the server's process
376- self.proc = None
377-
378+ self.openerp_process = None
379 # info if the service terminates correctly or if the server crashed
380 self.stopping = False
381
382@@ -52,18 +53,22 @@
383 def SvcStop(self):
384 # Before we do anything, tell the SCM we are starting the stop process.
385 self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING)
386-
387- # stop the running TERP Server: say it's a normal exit
388- win32api.TerminateProcess(int(self.proc._handle), 0)
389- servicemanager.LogInfoMsg(TinyService._svc_display_name_ + " stopped correctly.")
390-
391+ # stop the running OpenERP Web: say it's a normal exit
392+ win32api.TerminateProcess(int(self.openerp_process._handle), 0)
393+ servicemanager.LogInfoMsg("OpenERP Web stopped correctly")
394 # And set my event.
395 win32event.SetEvent(self.hWaitStop)
396
397- def StartService(self):
398-
399- self.proc = subprocess.Popen(EXECUTABLE, cwd=WORK_DIR,
400- creationflags=win32process.CREATE_NO_WINDOW)
401+
402+ def StartOpenERP(self):
403+ # The server finds now its configuration automatically on Windows
404+ # We start the ERP Web as an independent process, but we keep its handle
405+ # The server's binary must be one directory above the service's binary (when py2exe'd the python libraries shouldn' mix)
406+ service_dir = os.path.dirname(sys.argv[0])
407+ server_dir = os.path.split(service_dir)[0]
408+ server_path = os.path.join(server_dir, 'openerp-web.exe')
409+ self.openerp_process = subprocess.Popen([server_path], cwd=server_dir, creationflags=win32process.CREATE_NO_WINDOW)
410+
411
412 def StartControl(self,ws):
413 # this listens to the Service Manager's events
414@@ -71,23 +76,22 @@
415 self.stopping = True
416
417 def SvcDoRun(self):
418-
419- # Start the service itself
420- self.StartService()
421-
422+ # Start OpenERP Web itself
423+ self.StartOpenERP()
424 # start the loop waiting for the Service Manager's stop signal
425 thread.start_new_thread(self.StartControl, (self.hWaitStop,))
426-
427 # Log a info message that the server is running
428- servicemanager.LogInfoMsg(TinyService._svc_display_name_ + " is up and running.")
429-
430+ servicemanager.LogInfoMsg("OpenERP Web up and running")
431 # verification if the server is really running, else quit with an error
432- self.proc.wait()
433-
434+ self.openerp_process.wait()
435 if not self.stopping:
436- sys.exit(TinyService._svc_display_name_ + " is not running, check the logfile for more info.")
437+ sys.exit("OpenERP Web check: server not running, check the logfile for more info")
438+
439+
440
441 if __name__=='__main__':
442 # Do with the service whatever option is passed in the command line
443- win32serviceutil.HandleCommandLine(TinyService)
444+ win32serviceutil.HandleCommandLine(OpenERPWebService)
445+
446+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
447
448
449=== removed file 'win32/fixps.py'
450--- win32/fixps.py 2009-04-15 07:40:52 +0000
451+++ win32/fixps.py 1970-01-01 00:00:00 +0000
452@@ -1,22 +0,0 @@
453-import os, sys
454-import re
455-
456-PY_DIR = os.path.dirname(sys.executable)
457-MY_DIR = os.path.dirname(os.path.abspath(__file__))
458-
459-pat = re.compile('^#!.*$', re.M)
460-
461-for f in os.listdir(MY_DIR):
462-
463- if not f.endswith('.py') or f.endswith('.pyw') or f == 'fixps.py':
464- continue
465-
466- f = os.path.join(MY_DIR, f)
467-
468- src = open(f).read()
469- src = pat.sub('#!"%s\python.exe"' % PY_DIR, src)
470-
471- fo = open(f, 'w')
472- fo.write(src)
473- fo.close()
474-
475
476=== removed file 'win32/setup.nsi'
477--- win32/setup.nsi 2010-09-15 17:46:36 +0000
478+++ win32/setup.nsi 1970-01-01 00:00:00 +0000
479@@ -1,266 +0,0 @@
480-##############################################################################
481-#
482-# Copyright (c) 2004-2008 Tiny SPRL (http://tiny.be) All Rights Reserved.
483-#
484-# WARNING: This program as such is intended to be used by professional
485-# programmers who take the whole responsability of assessing all potential
486-# consequences resulting from its eventual inadequacies and bugs
487-# End users who are looking for a ready-to-use solution with commercial
488-# garantees and support are strongly adviced to contract a Free Software
489-# Service Company
490-#
491-# This program is Free Software; you can redistribute it and/or
492-# modify it under the terms of the GNU General Public License
493-# as published by the Free Software Foundation; either version 3
494-# of the License, or (at your option) any later version.
495-#
496-# This program is distributed in the hope that it will be useful,
497-# but WITHOUT ANY WARRANTY; without even the implied warranty of
498-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
499-# GNU General Public License for more details.
500-#
501-# You should have received a copy of the GNU General Public License
502-# along with this program; if not, write to the Free Software
503-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
504-###############################################################################
505-!ifndef VERSION
506- !error "Do not forget to specify the version of OpenERP - /DVERSION=<VERSION>"
507-!endif
508-
509-!include "MUI.nsh"
510-
511-;--------------------------------
512-;General
513-
514-;Name and file
515-Name "OpenERP Web"
516-OutFile "openerp-web-setup-${VERSION}.exe"
517-SetCompressor lzma
518-SetCompress auto
519-
520-;Default installation folder
521-InstallDir "$PROGRAMFILES\OpenERP Web"
522-
523-;Get installation folder from registry if available
524-InstallDirRegKey HKLM "Software\OpenERP Web" ""
525-
526-BrandingText "OpenERP Web ${VERSION}"
527-
528-;Vista redirects $SMPROGRAMS to all users without this
529-RequestExecutionLevel admin
530-
531-;--------------------------------
532-;Variables
533-
534-Var MUI_TEMP
535-Var STARTMENU_FOLDER
536-
537-;--------------------------------
538-;Interface Settings
539-
540-!define MUI_ABORTWARNING
541-
542-!define REGKEY "SOFTWARE\$(^Name)"
543-!define MUI_LANGDLL_REGISTRY_ROOT HKLM
544-!define MUI_LANGDLL_REGISTRY_KEY ${REGKEY}
545-!define MUI_LANGDLL_REGISTRY_VALUENAME InstallerLanguage
546-
547-!insertmacro MUI_RESERVEFILE_LANGDLL
548-;--------------------------------
549-;Pages
550-
551-!define MUI_ICON ".\pixmaps\openerp-icon.ico"
552-!define MUI_WELCOMEFINISHPAGE_BITMAP ".\pixmaps\openerp-intro.bmp"
553-!define MUI_UNWELCOMEFINISHPAGE_BITMAP ".\pixmaps\openerp-intro.bmp"
554-!define MUI_HEADERIMAGE
555-!define MUI_HEADERIMAGE_BITMAP_NOSTRETCH
556-!define MUI_HEADER_TRANSPARENT_TEXT ""
557-!define MUI_HEADERIMAGE_BITMAP ".\pixmaps\openerp-slogan.bmp"
558-!define MUI_LICENSEPAGE_TEXT_BOTTOM "$(LicenseText)"
559-!define MUI_LICENSEPAGE_BUTTON "$(LicenseNext)"
560-
561-!insertmacro MUI_PAGE_WELCOME
562-!insertmacro MUI_PAGE_LICENSE "..\doc\LICENSE.TXT"
563-!insertmacro MUI_PAGE_DIRECTORY
564-
565-;Start Menu Folder Page Configuration
566-!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
567-!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\OpenERP Web"
568-!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "OpenERP Web"
569-
570-!insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
571-
572-!insertmacro MUI_PAGE_INSTFILES
573-
574-!define MUI_FINISHPAGE_NOAUTOCLOSE
575-!define MUI_FINISHPAGE_RUN
576-!define MUI_FINISHPAGE_RUN_CHECKED
577-!define MUI_FINISHPAGE_RUN_TEXT "$(FinishPageText)"
578-!define MUI_FINISHPAGE_RUN_FUNCTION "LaunchLink"
579-!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
580-!define MUI_FINISHPAGE_SHOWREADME $INSTDIR\README.txt
581-!insertmacro MUI_PAGE_FINISH
582-
583-
584-!insertmacro MUI_UNPAGE_WELCOME
585-!insertmacro MUI_UNPAGE_CONFIRM
586-!insertmacro MUI_UNPAGE_INSTFILES
587-
588-;--------------------------------
589-;Languages
590-
591-!insertmacro MUI_LANGUAGE "English"
592-!insertmacro MUI_LANGUAGE "French"
593-
594-!macro CreateInternetShortcut FILENAME URL
595- WriteINIStr "${FILENAME}.url" "InternetShortcut" "URL" "${URL}"
596-!macroend
597-
598-;--------------------------------
599-;Installer Sections
600-Function .onInit
601-!ifndef ALLINONE
602- ;Language selection dialog
603- Push ""
604- Push ${LANG_ENGLISH}
605- Push English
606- Push ${LANG_FRENCH}
607- Push French
608- Push A ; A means auto count languages
609- ; for the auto count to work the first empty push (Push "") must remain
610- LangDLL::LangDialog "Installer Language" "Please select the language of the installer"
611-
612- Pop $LANGUAGE
613- StrCmp $LANGUAGE "cancel" 0 +2
614- Abort
615-!endif
616-
617- ClearErrors
618- ReadRegStr $0 HKLM "Software\OpenERP Web" ""
619- IfErrors DoInstall 0
620- MessageBox MB_OK "$(CannotInstallWebText)"
621- Quit
622- DoInstall:
623-FunctionEnd
624-
625-Section "OpenERP Web" SecOpenERPWeb
626- nsExec::Exec "net stop openerp-web"
627- sleep 2
628-
629- SetOutPath "$INSTDIR\python25"
630-
631- ;ADD YOUR OWN FILES HERE...
632- File /r /x "*.pyc" /x "*.pyo" /x "*.msi" /x "*~" "build\python25\*"
633-
634- SetOutPath "$INSTDIR\bin"
635- File "start.bat"
636- File "stop.bat"
637- File "OpenERPWebService.py"
638-
639- SetOutPath "$INSTDIR\conf"
640- File "/oname=openerp-web.cfg" "..\doc\openerp-web.cfg"
641-
642- ;Store installation folder
643- WriteRegStr HKLM "Software\OpenERP Web" "" $INSTDIR
644-
645-!ifndef ALLINONE
646- ;Create uninstaller
647- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenERP Web" "DisplayName" "OpenERP Web ${VERSION}"
648- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenERP Web" "UninstallString" "$INSTDIR\Uninstall.exe"
649-!else
650- WriteRegStr HKLM "Software\OpenERP AllInOne" "UninstallWeb" "$INSTDIR\Uninstall.exe"
651-!endif
652- WriteUninstaller "$INSTDIR\Uninstall.exe"
653-
654- !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
655- ;Create shortcuts
656- CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
657- CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Start OpenERP Web.lnk" "$INSTDIR\bin\start.bat"
658- CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Stop OpenERP Web.lnk" "$INSTDIR\bin\stop.bat"
659- CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Edit Web Config.lnk" "notepad.exe" "$INSTDIR\conf\openerp-web.cfg"
660-!ifndef ALLINONE
661- CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\uninstall.exe"
662-!endif
663- !insertmacro CreateInternetShortcut "$SMPROGRAMS\$STARTMENU_FOLDER\Forum" "http://www.openerp.com/forum"
664- !insertmacro CreateInternetShortcut "$SMPROGRAMS\$STARTMENU_FOLDER\Translation" "https://translations.launchpad.net/openobject"
665- !insertmacro MUI_STARTMENU_WRITE_END
666-
667- nsExec::Exec '"$INSTDIR\python25\python.exe" "$INSTDIR\python25\Scripts\fixps.py"'
668- nsExec::Exec '"$INSTDIR\python25\python.exe" "$INSTDIR\bin\OpenERPWebService.py" --startup auto install'
669-
670-SectionEnd
671-
672-;Descriptions
673-
674-
675-;--------------------------------
676-;Uninstaller Section
677-
678-Section "Uninstall"
679- nsExec::Exec "net stop openerp-web"
680- sleep 2
681- nsExec::Exec '"$INSTDIR\python25\python.exe" "$INSTDIR\bin\OpenERPWebService.py" remove'
682- sleep 2
683-
684- RMDIR /r "$INSTDIR"
685- !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
686-
687- Delete "$SMPROGRAMS\$MUI_TEMP\Forum.url"
688- Delete "$SMPROGRAMS\$MUI_TEMP\Translation.url"
689-!ifndef ALLINONE
690- Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
691-!endif
692- Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
693- Delete "$SMPROGRAMS\$MUI_TEMP\Start OpenERP Web.lnk"
694- Delete "$SMPROGRAMS\$MUI_TEMP\Stop OpenERP Web.lnk"
695- Delete "$SMPROGRAMS\$MUI_TEMP\Edit Web Config.lnk"
696-
697- ;Delete empty start menu parent diretories
698- StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
699-
700- startMenuDeleteLoop:
701- ClearErrors
702- RMDir $MUI_TEMP
703- GetFullPathName $MUI_TEMP "$MUI_TEMP\.."
704-
705- IfErrors startMenuDeleteLoopDone
706-
707- StrCmp $MUI_TEMP $SMPROGRAMS startMenuDeleteLoopDone startMenuDeleteLoop
708-
709- startMenuDeleteLoopDone:
710-
711-!ifndef ALLINONE
712- DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenERP Web"
713-!else
714- DeleteRegKey HKLM "Software\OpenERP AllInOne\UninstallWeb"
715-!endif
716- DeleteRegKey /ifempty HKLM "Software\OpenERP Web"
717-
718-SectionEnd
719-
720-Function LaunchLink
721- nsExec::Exec "net start openerp-web"
722-FunctionEnd
723-
724-LangString LicenseText ${LANG_ENGLISH} "Usually, a proprietary license is provided with the software: limited number of users, limited in time usage, etc. This Open Source license is the opposite: it garantees you the right to use, copy, study, distribute and modify Open ERP for free."
725-LangString LicenseText ${LANG_FRENCH} "Normalement, une licence propriétaire est fournie avec le logiciel: limitation du nombre d'utilisateurs, limitation dans le temps, etc. Cette licence Open Source est l'opposé: Elle vous garantie le droit d'utiliser, de copier, d'étudier, de distribuer et de modifier Open ERP librement."
726-
727-LangString LicenseNext ${LANG_ENGLISH} "Next >"
728-LangString LicenseNext ${LANG_FRENCH} "Suivant >"
729-
730-LangString FinishPageText ${LANG_ENGLISH} "Start OpenERP Web"
731-LangString FinishPageText ${LANG_FRENCH} "Lancer le serveur Web OpenERP"
732-
733-;Language strings
734-LangString DESC_SecOpenERPWeb ${LANG_ENGLISH} "OpenERP Web."
735-LangString DESC_SecOpenERPWeb ${LANG_FRENCH} "Serveur Web OpenERP."
736-
737-LangString CannotInstallWebText ${LANG_ENGLISH} "Can not install the OpenERP Web because a previous installation already exists on this system. Please uninstall your current installation and relaunch this setup wizard."
738-LangString CannotInstallWebText ${LANG_FRENCH} "Ne peut pas installer le serveur Web Open ERP parce qu'une installation existe déjà sur ce système. S'il vous plait, désinstallez votre installation actuelle et relancer l'installeur."
739-
740-
741-;Assign language strings to sections
742-!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
743- !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenERPWeb} $(DESC_SecOpenERPWeb)
744-!insertmacro MUI_FUNCTION_DESCRIPTION_END
745-
746
747=== modified file 'win32/setup.py'
748--- win32/setup.py 2010-10-14 11:27:00 +0000
749+++ win32/setup.py 2010-11-02 15:59:41 +0000
750@@ -1,156 +1,35 @@
751-import os
752-import sys
753+# -*- coding: utf-8 -*-
754+##############################################################################
755+#
756+# OpenERP, Open Source Management Solution
757+# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
758+#
759+# This program is free software: you can redistribute it and/or modify
760+# it under the terms of the GNU Affero General Public License as
761+# published by the Free Software Foundation, either version 3 of the
762+# License, or (at your option) any later version.
763+#
764+# This program is distributed in the hope that it will be useful,
765+# but WITHOUT ANY WARRANTY; without even the implied warranty of
766+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
767+# GNU Affero General Public License for more details.
768+#
769+# You should have received a copy of the GNU Affero General Public License
770+# along with this program. If not, see <http://www.gnu.org/licenses/>.
771+#
772+##############################################################################
773
774 from distutils.core import setup
775-from distutils.core import Command
776-from distutils.errors import *
777-
778-import fnmatch
779-import util
780-
781-URLS = {
782- "python": ("http://www.python.org/ftp/python/2.5.4/python-2.5.4.msi", "python-2.5.4.msi"),
783- "ez_setup": ("http://peak.telecommunity.com/dist/ez_setup.py", "ez_setup.py"),
784- "pywin32": ("http://nchc.dl.sourceforge.net/sourceforge/pywin32/pywin32-212.win32-py2.5.exe", "pywin32-212.win32-py2.5.exe")
785-}
786-
787-BUILD_DIR=os.path.join(os.path.dirname(os.path.abspath(__file__)), "build")
788-PYDIR=os.path.join(BUILD_DIR, "python25")
789-
790-execfile(os.path.join("openobject", "release.py"))
791-
792-class bdist_wininst(Command):
793- user_options = [('allinone', None, 'Generate the windows installer for the All In One')]
794-
795- def initialize_options (self):
796- self.allinone = None
797-
798- def finalize_options (self):
799- pass
800-
801- def run (self):
802-
803- if (sys.platform != "win32"):
804- raise DistutilsPlatformError("Distribution must be compiled on a Windows 32 platform")
805-
806- if not os.path.exists(BUILD_DIR):
807- os.mkdir(BUILD_DIR)
808-
809- # change to the build dir
810- os.chdir(BUILD_DIR)
811-
812- self._check_python()
813- self._check_setuptools()
814- self._check_pywin32()
815- self._check_openerp_web()
816- self._check_fixps()
817-
818- for package in [
819- ('cherrypy', 'CherryPy >= 3.1.2'),
820- ('mako', 'mako >= 0.2.4'),
821- ('babel', 'Babel >= 0.9.4'),
822- ('formencode', 'FormEncode >= 1.2.2'),
823- ('simplejson', 'simplejson >= 2.0.9'),
824- ('dateutil', 'python-dateutil >= 1.4.1'),
825- ('pytz', 'pytz >= 2009j')
826- ]:
827- self._check_package(*package)
828-
829- # finally compile the setup.nsi
830- self._make_nsis()
831-
832- def run_py(self, *args):
833- return not os.system(PYDIR + "\\python.exe " + " ".join(args))
834-
835- def run_ez(self, *args):
836- return not os.system(PYDIR + "\\Scripts\\easy_install.exe -Z " + " ".join(args))
837-
838- def check_module(self, module):
839- return self.run_py('-c', '"import %s"' % module)
840-
841- def _check_python(self):
842-
843- if os.path.exists(os.path.join(PYDIR, "python.exe")):
844- return True
845-
846- url, name = URLS['python']
847- util.download(url)
848-
849- print "Extracting the the python installer..."
850- os.system('msiexec /a %s /qn TARGETDIR="%s"' % (name, PYDIR))
851-
852- def _check_setuptools(self):
853-
854- if self.check_module("setuptools"):
855- return
856-
857- url, name = URLS['ez_setup']
858- util.download(url)
859-
860- self.run_py(name)
861-
862- def _check_pywin32(self):
863-
864- if self.check_module("pywintypes"):
865- return
866-
867- url, name = URLS['pywin32']
868- util.download(url, name)
869-
870- util.unzip(name, 'tmp_pyw32')
871-
872- os.system("xcopy /q /y /e tmp_pyw32\\PLATLIB\\* \"%s\\Lib\\site-packages\"" % PYDIR)
873- os.system("copy /y \"%s\\Lib\\site-packages\\pywin32_system32\\*\" \"%s\"" % (PYDIR, PYDIR))
874- os.system("copy /y \"%s\\Lib\\site-packages\\win32\\*.exe\" \"%s\"" % (PYDIR, PYDIR))
875- os.system("copy /y \"%s\\Lib\\site-packages\\win32\\*.dll\" \"%s\"" % (PYDIR, PYDIR))
876- os.system("rmdir /s /q tmp_pyw32")
877-
878- def _check_package(self, package, dependency):
879- if self.check_module(package):
880- return
881- self.run_ez(dependency)
882-
883- def _check_pyparsing(self):
884-
885- if self.check_module("pyparsing"):
886- return
887-
888- url, name = URLS['pyparsing']
889- util.download(url, name)
890-
891- self.run_ez(name)
892-
893- def _check_openerp_web(self):
894-
895- if self.check_module("openobject"):
896- # remove old version
897- self.run_ez("-m", "openerp-web")
898-
899- for f in os.listdir("%s\\Scripts" % PYDIR):
900- if fnmatch.fnmatch(f, "*openerp-web*"):
901- os.remove(os.path.join(PYDIR, "Scripts", f))
902-
903- for f in os.listdir("%s\\Lib\\site-packages" % PYDIR):
904- if fnmatch.fnmatch(f, "openerp_web*"):
905- os.system("rd /s /q \"%s\\Lib\\site-packages\\%s\"" %(PYDIR, f))
906-
907- self.run_ez("-N", "..\\..")
908-
909- def _check_fixps(self):
910- os.system("copy /y ..\\fixps.py \"%s\\Scripts\"" % PYDIR)
911-
912- def _make_nsis(self):
913-
914- #TODO: read registry
915- makensis = "C:\\Program Files\\NSIS\\makensis.exe"
916- if not os.path.exists(makensis):
917- makensis = "makensis.exe"
918-
919- cmd = '"%s" %s /DVERSION=%s ..\\setup.nsi' % (makensis,
920- self.allinone and '/DALLINONE=1' or '',
921- version,)
922-
923- os.system(cmd)
924-
925-setup(cmdclass={'bdist_wininst': bdist_wininst})
926+import py2exe
927+
928+
929+setup(service=["OpenERPWebService"],
930+ options={"py2exe":{"excludes":["Tkconstants","Tkinter","tcl",
931+ "_imagingtk","PIL._imagingtk",
932+ "ImageTk", "PIL.ImageTk",
933+ "FixTk"],
934+ "compressed": 1}}
935+ )
936+
937+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
938
939
940=== removed file 'win32/util.py'
941--- win32/util.py 2010-10-14 11:27:00 +0000
942+++ win32/util.py 1970-01-01 00:00:00 +0000
943@@ -1,49 +0,0 @@
944-import os
945-import sys
946-import zipfile
947-import urllib
948-
949-def _reporthook(numblocks, blocksize, filesize, url=None):
950- base = os.path.basename(url)
951- try:
952- percent = min((numblocks*blocksize*100)/filesize, 100)
953- except:
954- percent = 100
955- if numblocks != 0:
956- sys.stdout.write("\b"*70)
957- sys.stdout.write("%-66s%3d%%" % (base, percent))
958-
959-def download(url, dst=None):
960-
961- if not dst:
962- dst = url.split('/')[-1]
963-
964- if os.path.exists(dst):
965- return
966-
967- print "Downloading %s..." % (url)
968-
969- try:
970- if sys.stdout.isatty():
971- urllib.urlretrieve(url, dst,
972- lambda nb, bs, fs, url=url: _reporthook(nb,bs,fs,url))
973- sys.stdout.write('\n')
974- else:
975- urllib.urlretrieve(url, dst)
976- except:
977- os.remove(dst)
978-
979-def unzip(file, dir):
980- zf = zipfile.ZipFile(file)
981- for i, name in enumerate(zf.namelist()):
982- if not name.endswith('/'):
983- outfile = os.path.join(dir, name)
984- outdir = os.path.dirname(outfile)
985-
986- if not os.path.exists(outdir):
987- os.makedirs(outdir)
988-
989- outfile = open(outfile, 'wb')
990- outfile.write(zf.read(name))
991- outfile.flush()
992- outfile.close()