diff --git a/setup/package.py b/setup/package.py index c4978f61e17..bd06f1af473 100755 --- a/setup/package.py +++ b/setup/package.py @@ -11,6 +11,7 @@ import signal import subprocess import sys import tempfile +import textwrap import time import traceback from xmlrpc import client as xmlrpclib @@ -23,6 +24,10 @@ from glob import glob ROOTDIR = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) TSTAMP = time.strftime("%Y%m%d", time.gmtime()) +# Get some variables from release.py +version = ... +version_info = ... +nt_service_name = ... exec(open(os.path.join(ROOTDIR, 'odoo', 'release.py'), 'rb').read()) VERSION = version.split('-')[0].replace('saas~', '') GPGPASSPHRASE = os.getenv('GPGPASSPHRASE') @@ -450,11 +455,16 @@ class KVM(object): class KVMWinBuildExe(KVM): def run(self): logging.info('Start building Windows package') - with open(os.path.join(self.args.build_dir, 'setup/win32/Makefile.version'), 'w') as f: - f.write("VERSION=%s.%s\n" % (VERSION.replace('~', '_').replace('+', ''), TSTAMP)) - with open(os.path.join(self.args.build_dir, 'setup/win32/Makefile.python'), 'w') as f: + with open(os.path.join(self.args.build_dir, 'setup/win32/Makefile.version'), 'w', encoding='utf-8') as f: + win_version = VERSION.replace('~', '_').replace('+', '') + f.write(textwrap.dedent(f""" + VERSION={win_version}.{TSTAMP} + MAJORVERSION={version_info[0]} + MINORVERSION={version_info[1]} + """)) + with open(os.path.join(self.args.build_dir, 'setup/win32/Makefile.python'), 'w', encoding='utf-8') as f: f.write("PYTHON_VERSION=%s\n" % self.args.vm_winxp_python_version) - with open(os.path.join(self.args.build_dir, 'setup/win32/Makefile.servicename'), 'w') as f: + with open(os.path.join(self.args.build_dir, 'setup/win32/Makefile.servicename'), 'w', encoding='utf-8') as f: f.write("SERVICENAME=%s\n" % nt_service_name) remote_build_dir = '/cygdrive/c/odoobuild/server/' diff --git a/setup/win32/Makefile b/setup/win32/Makefile index cf2d0c42922..882234f0c15 100644 --- a/setup/win32/Makefile +++ b/setup/win32/Makefile @@ -5,7 +5,7 @@ include Makefile.servicename SERVER_DIRECTORY=../.. FILES_DIRECTORY=release -MAKENSIS_ARGUMENTS=/DVERSION=$(VERSION) /DSERVICENAME=${SERVICENAME} /DPYTHONVERSION=${PYTHON_VERSION} +MAKENSIS_ARGUMENTS=/DVERSION=$(VERSION) /DMAJOR_VERSION=$(MAJORVERSION) /DMINOR_VERSION=$(MINORVERSION) /DSERVICENAME=${SERVICENAME} /DPYTHONVERSION=${PYTHON_VERSION} LAUNCH_MAKENSIS=/cygdrive/c/tools/cygwin/makensis $(MAKENSIS_ARGUMENTS) setup.nsi WINPY32_DIR=/cygdrive/c/odoobuild/WinPy32/python-${PYTHON_VERSION}