summaryrefslogtreecommitdiff
path: root/setup/win32
diff options
context:
space:
mode:
authorChristophe Monniez <moc@odoo.com>2017-08-30 09:08:49 +0200
committerChristophe Monniez <moc@odoo.com>2017-10-03 12:01:53 +0200
commit06c2346da5f871fe885e075152dfa41cb6f9b024 (patch)
tree46b82dab672c4262e822cc112d0239746686679e /setup/win32
parent938ae8358545c41ea959cbfd8cd80201daaec31a (diff)
[REF] win32: move to WinPython...
Purpose: for multiple reasons (bytecode change in python 3.6, missing files for some packages, py2exe is unmaintained ...) the py2exe solution cannot be used anymore. Odoo for windows will now use a portable Python that will be shipped with the Windows installer. For that purpose, a Winpython 3.6.2 is used. In order to build the Windows installer, a Winpython dir with all the Odoo requirements fullfilled, must exists on the build system (qemu-kvm VM). * nsis installer: - Only the python dir is used to avoid packaging too much stuffs - better compression level - starts the Odoo service using nssm - bump to V11 * change the default win10 build vm path * print a warning when uncomplete addon move * try to force remove of addon path: when the addons are moved to Odoo/addons, it happens that the destination already exists. In that case, the source addon was not deleted, resulting in a uneeded file duplication. * fix version string to avoid invalid chars in windows service * Add requirements adpated for WinPython * package.py now shows the traceback when a build fails * verify that a file exists before publishing * debuild now creates an .xz file instead of .gz * package: use logging module * kvm CPU that works with older versions. * fix a pexpect encoding bug * fix the version to remove special chars '~' which is not appreciated by windows services [REM] win32setup: Remove win32 python service Purpose: Before this commit, the win32 service was managed by an executable builded from those two files with the help of py2xe. The win32 service is now managed by nssm which starts Odoo and therefore, those files are not needed anymore.
Diffstat (limited to 'setup/win32')
-rw-r--r--setup/win32/Makefile6
-rwxr-xr-xsetup/win32/setup.nsi39
-rw-r--r--setup/win32/win32_service.py53
-rw-r--r--setup/win32/win32_setup.py54
-rw-r--r--setup/win32/winpy_requirements.txt41
5 files changed, 67 insertions, 126 deletions
diff --git a/setup/win32/Makefile b/setup/win32/Makefile
index c0d33c904b1..2efa1db6f69 100644
--- a/setup/win32/Makefile
+++ b/setup/win32/Makefile
@@ -10,7 +10,7 @@ LAUNCH_PY2EXE=/cygdrive/c/python${PYTHON_VERSION}/python.exe setup.py py2exe
MAKENSIS_ARGUMENTS=/DVERSION=$(VERSION) /DSERVICENAME=${SERVICENAME}
-LAUNCH_MAKENSIS=/cygdrive/c/cygwin/makensis $(MAKENSIS_ARGUMENTS) setup.nsi
+LAUNCH_MAKENSIS=/cygdrive/c/tools/cygwin/makensis $(MAKENSIS_ARGUMENTS) setup.nsi
default: allinone
@@ -27,8 +27,8 @@ server_clean:
rm -rf $(SERVER_DIRECTORY)/.cyg*
allinone: server_clean
- (cd $(SERVER_DIRECTORY)/setup/win32 && $(LAUNCH_PY2EXE_SERVICE))
- (cd $(SERVER_DIRECTORY) && $(LAUNCH_PY2EXE))
+ #(cd $(SERVER_DIRECTORY)/setup/win32 && $(LAUNCH_PY2EXE_SERVICE))
+ #(cd $(SERVER_DIRECTORY) && $(LAUNCH_PY2EXE))
(cd $(SERVER_DIRECTORY)/setup/win32 && $(LAUNCH_MAKENSIS))
(cd $(SERVER_DIRECTORY)/setup/win32 && mkdir -p $(FILES_DIRECTORY))
(cd $(SERVER_DIRECTORY)/setup/win32 && cp openerp-*.exe $(FILES_DIRECTORY)/openerp-server-setup-$(VERSION).exe)
diff --git a/setup/win32/setup.nsi b/setup/win32/setup.nsi
index 8a70867e602..004ea5f398e 100755
--- a/setup/win32/setup.nsi
+++ b/setup/win32/setup.nsi
@@ -41,7 +41,7 @@
!define PUBLISHER 'Odoo S.A.'
!ifndef MAJOR_VERSION
- !define MAJOR_VERSION '10'
+ !define MAJOR_VERSION '11'
!endif
!ifndef MINOR_VERSION
@@ -49,7 +49,7 @@
!endif
!ifndef REVISION_VERSION
- !define REVISION_VERSION '0'
+ !define REVISION_VERSION 'alpha1'
!endif
!ifndef VERSION
@@ -76,11 +76,11 @@
Name '${DISPLAY_NAME}'
Caption "${PRODUCT_NAME} ${VERSION} Setup"
OutFile "openerp-allinone-setup-${VERSION}.exe"
-#SetCompressor /final /solid lzma
+SetCompressor /FINAL lzma
#SetCompress auto
ShowInstDetails show
-XPStyle on
+#XPStyle on
InstallDir "$PROGRAMFILES\Odoo ${VERSION}"
InstallDirRegKey HKCU "${REGISTRY_KEY}" ""
@@ -116,7 +116,7 @@ Var HWNDPostgreSQLPassword
!define STATIC_PATH "static"
!define PIXMAPS_PATH "${STATIC_PATH}\pixmaps"
-!define POSTGRESQL_EXE_FILENAME "postgresql-9.5.4-2-windows.exe"
+!define POSTGRESQL_EXE_FILENAME "postgresql-9.5.8-1-windows.exe"
!define POSTGRESQL_EXE "${STATIC_PATH}\${POSTGRESQL_EXE_FILENAME}"
!define MUI_ABORTWARNING
@@ -205,14 +205,20 @@ Section $(TITLE_OpenERP_Server) SectionOpenERP_Server
SectionIn 1 2
# TODO: install in a temp dir before
+
+ # Installing winpython
+ SetOutPath "$INSTDIR\python"
+ File /r /x "__pycache__" "..\..\..\WinPython\python-3.6.2\*"
+
+ SetOutPath "$INSTDIR\nssm"
+ File /r /x "src" "..\..\..\nssm-2.24\*"
SetOutPath "$INSTDIR\server"
- File /r "..\..\dist\*"
+ File /r /x "${POSTGRESQL_EXE_FILENAME}" /x "wkhtmltopdf" "..\..\*"
- SetOutPath "$INSTDIR\service"
- File /r "dist\*"
- File "start.bat"
- File "stop.bat"
+ # Install Visual C redistribuable files
+ DetailPrint "Installing Visual C++ redistributable files"
+ nsExec::Exec '"$INSTDIR\service\vcredist\vcredist_x86.exe" /q'
SetOutPath "$INSTDIR\thirdparty"
File /r "${STATIC_PATH}\wkhtmltopdf\*"
@@ -233,9 +239,11 @@ Section $(TITLE_OpenERP_Server) SectionOpenERP_Server
WriteIniStr "$INSTDIR\server\odoo.conf" "options" "pg_path" "$INSTDIR\PostgreSQL\bin"
${EndIf}
- nsExec::Exec '"$INSTDIR\server\odoo-bin.exe" --stop-after-init --logfile "$INSTDIR\server\odoo.log" -s'
- nsExec::Exec '"$INSTDIR\service\win32_service.exe" -auto -install'
-
+ DetailPrint "Installing Windows service"
+ nsExec::ExecTOLog '"$INSTDIR\python\python.exe" "$INSTDIR\server\odoo-bin" --stop-after-init --logfile "$INSTDIR\server\odoo.log" -s'
+ nsExec::ExecToLog '"$INSTDIR\nssm\win32\nssm.exe" install ${SERVICENAME} "$INSTDIR\python\python.exe" "\"$INSTDIR\server\odoo-bin\""'
+ nsExec::ExecToLog '"$INSTDIR\nssm\win32\nssm.exe" set AppDirectory "$\"$INSTDIR\server$\""'
+
nsExec::Exec "net stop ${SERVICENAME}"
sleep 2
@@ -298,12 +306,11 @@ Section "Uninstall"
ReadRegStr $0 HKLM "${UNINSTALL_REGISTRY_KEY_SERVER}" "UninstallString"
ExecWait '"$0" /S'
- nsExec::Exec "net stop odoo-server-9.0"
- nsExec::Exec "sc delete odoo-server-9.0"
+ nsExec::Exec "net stop ${SERVICENAME}"
+ nsExec::Exec "sc delete ${SERVICENAME}"
sleep 2
Rmdir /r "$INSTDIR\server"
- Rmdir /r "$INSTDIR\service"
Rmdir /r "$INSTDIR\thirdparty"
DeleteRegKey HKLM "${UNINSTALL_REGISTRY_KEY}"
SectionEnd
diff --git a/setup/win32/win32_service.py b/setup/win32/win32_service.py
deleted file mode 100644
index 8eb32bbdbb6..00000000000
--- a/setup/win32/win32_service.py
+++ /dev/null
@@ -1,53 +0,0 @@
-# -*- coding: utf-8 -*-
-
-import servicemanager
-import win32api
-import win32process
-import win32service
-import win32serviceutil
-
-import subprocess
-import sys
-from os.path import dirname, join, split
-
-
-exec(open(join(dirname(__file__), '..', 'server', 'odoo', 'release.py'), 'rb').read())
-
-
-class OdooService(win32serviceutil.ServiceFramework):
- _svc_name_ = nt_service_name
- _svc_display_name_ = "%s %s" % (nt_service_name, serie)
-
- def __init__(self, args):
- win32serviceutil.ServiceFramework.__init__(self, args)
- self.odooprocess = None # Reference to the server's process
-
- def SvcStop(self):
- # Before we do anything, tell the SCM we are starting the stop process.
- self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING)
- # Stop the running Odoo: say it's a normal exit
- win32api.TerminateProcess(int(self.odooprocess._handle), 0)
- servicemanager.LogInfoMsg("Odoo stopped correctly")
-
- def SvcDoRun(self):
- # We start Odoo as an independent process, but we keep its handle
- service_dir = dirname(sys.argv[0])
- server_dir = split(service_dir)[0]
- server_path = join(server_dir, 'server', 'odoo-bin.exe')
- self.odooprocess = subprocess.Popen(
- [server_path], cwd=server_dir, creationflags=win32process.CREATE_NO_WINDOW
- )
- servicemanager.LogInfoMsg('Odoo up and running')
- # exit with same exit code as Odoo process
- sys.exit(self.odooprocess.wait())
-
-
-def option_handler(opts):
- # configure the service to auto restart on failures...
- subprocess.call([
- 'sc', 'failure', nt_service_name, 'reset=', '0', 'actions=', 'restart/0/restart/0/restart/0'
- ])
-
-
-if __name__ == '__main__':
- win32serviceutil.HandleCommandLine(OdooService, customOptionHandler=option_handler)
diff --git a/setup/win32/win32_setup.py b/setup/win32/win32_setup.py
deleted file mode 100644
index a61081760d0..00000000000
--- a/setup/win32/win32_setup.py
+++ /dev/null
@@ -1,54 +0,0 @@
-# -*- coding: utf-8 -*-
-
-import os
-import glob
-import py2exe
-from distutils.core import setup
-
-
-exec(open(os.path.join(os.path.dirname(__file__), '..', '..', 'odoo', 'release.py'), 'rb').read())
-
-
-def generate_files():
- actions = {
- 'start': ['stop', 'start'],
- 'stop': ['stop'],
- }
-
- files = []
- if os.name == 'nt':
- files.append(("Microsoft.VC90.CRT", glob.glob('C:\Microsoft.VC90.CRT\*.*')))
- for action, steps in actions.items():
- fname = action + '.bat'
- files.append(fname)
- with open(fname, 'w') as fp:
- fp.write('@PATH=%WINDIR%\system32;%WINDIR%;%WINDIR%\System32\Wbem;.\n')
- for step in steps:
- fp.write('@net %s %s\n' % (step, nt_service_name))
- return files
-
-setup(
- service=["win32_service"],
- version=version,
- license=license,
- url=url,
- author=author,
- author_email=author_email,
- data_files=generate_files(),
- options={
- "py2exe": {
- "excludes": [
- 'Tkconstants',
- 'Tkinter',
- 'tcl',
- '_imagingtk',
- 'PIL._imagingtk',
- 'ImageTk',
- 'PIL.ImageTk',
- 'FixTk'
- ],
- "skip_archive": 1,
- "optimize": 2,
- }
- },
-)
diff --git a/setup/win32/winpy_requirements.txt b/setup/win32/winpy_requirements.txt
new file mode 100644
index 00000000000..70f696459ad
--- /dev/null
+++ b/setup/win32/winpy_requirements.txt
@@ -0,0 +1,41 @@
+Babel==2.3.4
+decorator==4.0.10
+docutils==0.12
+ebaysdk==2.1.4
+feedparser==5.2.1
+gevent>=1.1.2
+greenlet>=0.4.10
+html2text==2016.9.19
+Jinja2==2.8
+lxml>=3.5.0
+Mako==1.0.4
+MarkupSafe==0.23
+mock==2.0.0
+num2words==0.5.4
+ofxparse==0.16
+passlib==1.6.5
+Pillow>=3.4.1
+psutil>=4.3.1
+psycogreen==1.0
+psycopg2==2.7.1
+pydot==1.2.3
+pyldap>=2.4.28
+pyparsing==2.1.10
+PyPDF2==1.26.0
+pyserial==3.1.1
+python-dateutil==2.5.3
+python-openid==2.2.5
+pytz==2016.7
+pyusb==1.0.0
+PyYAML==3.12
+qrcode==5.3
+reportlab>=3.3.0
+requests==2.11.1
+six==1.10.0
+suds-jurko==0.6
+vatnumber==1.2
+vobject==0.9.3
+Werkzeug>=0.11.11
+XlsxWriter==0.9.3
+xlwt==1.3.*
+xlrd==1.0.0