1
0
mirror of https://gitlab.com/openlp/packaging.git synced 2024-12-22 13:02:50 +00:00

Make the windows builder more bit-aware

This commit is contained in:
Tomas Groth 2019-03-05 20:55:59 +01:00
parent b049edfb48
commit f95a43be24

View File

@ -110,6 +110,7 @@ Portable App Builds
import os import os
import glob import glob
import sys
from distutils import dir_util from distutils import dir_util
from shutil import copy, move, rmtree from shutil import copy, move, rmtree
@ -267,6 +268,8 @@ class WindowsBuilder(Builder):
super().setup_system_paths() super().setup_system_paths()
self.python_root = os.path.dirname(self.python) self.python_root = os.path.dirname(self.python)
self.site_packages = os.path.join(self.python_root, 'Lib', 'site-packages') self.site_packages = os.path.join(self.python_root, 'Lib', 'site-packages')
# Default program_files to 'Program Files (x86)' - the folder for 32-bit programs on 64-bit systems, if that
# does not exists the host system is 32-bit so fallback to 'Program Files'.
self.program_files = os.getenv('PROGRAMFILES(x86)') self.program_files = os.getenv('PROGRAMFILES(x86)')
if not self.program_files: if not self.program_files:
self.program_files = os.getenv('PROGRAMFILES') self.program_files = os.getenv('PROGRAMFILES')
@ -331,8 +334,11 @@ class WindowsBuilder(Builder):
Return a list of any extra parameters we wish to use Return a list of any extra parameters we wish to use
""" """
parameters = [] parameters = []
# Detect python instance bit size
arch = 'x86' if sys.maxsize == 0x7fffffff else 'x64'
dll_path = '{pf}\\Windows Kits\\10\\Redist\\ucrt\\DLLs\\{arch}\\*.dll'.format(pf=self.program_files, arch=arch)
# Finds the UCRT DDLs available from the Windows 10 SDK # Finds the UCRT DDLs available from the Windows 10 SDK
for binary in glob.glob('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\ucrt\\DLLs\\x64\\*.dll'): for binary in glob.glob(dll_path):
parameters.append('--add-binary') parameters.append('--add-binary')
parameters.append(binary + ";.") parameters.append(binary + ";.")
return parameters return parameters