1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-13 07:47:14 +03:00

Build: Enforce win32 only at top-level, and clean up how error is raised

* Repeating the same test is just un-necessary, bad past-Ath.
* Use `raise AssertionError(...)`.

I'd move some of this stuff into functions, but it wouldn't actually
aid readability.
This commit is contained in:
Athanasius 2022-09-24 10:59:44 +01:00
parent 9347f12723
commit 26c2bd720f
No known key found for this signature in database
GPG Key ID: 8C392035DD80FD62

View File

@ -22,12 +22,12 @@ if sys.version_info[0:2] != (3, 10):
raise AssertionError(f'Unexpected python version {sys.version}')
if sys.platform == 'win32':
assert platform.architecture()[0] == '32bit', 'Assumes a Python built for 32bit'
assert platform.architecture()[0] == '32bit', 'A Python 32bit build is required'
import py2exe # noqa: F401 # Yes, this *is* used
dist_dir = 'dist.win32'
else:
assert False, f'Unsupported platform {sys.platform}'
raise AssertionError(f'Unsupported platform {sys.platform}')
###########################################################################
###########################################################################
@ -76,8 +76,6 @@ PLUGINS = [
'plugins/inara.py',
]
# Ensure this fails on non-win32
if sys.platform == 'win32':
OPTIONS = {
'py2exe': {
'dist_dir': dist_dir,
@ -129,9 +127,6 @@ if sys.platform == 'win32':
]),
('plugins', PLUGINS),
]
else:
raise AssertionError('Unsupported platform')
###########################################################################
###########################################################################
@ -172,8 +167,6 @@ freeze(
# Build installer(s)
###########################################################################
package_filename = None
# Ensure this fails on non-win32
if sys.platform == 'win32':
template_file = pathlib.Path('wix/template.wxs')
components_file = pathlib.Path('wix/components.wxs')
final_wxs_file = pathlib.Path('EDMarketConnector.wxs')
@ -301,7 +294,4 @@ if sys.platform == 'win32':
os.system(rf'cscript /nologo "{SDKPATH}\WiLangId.vbs" {gettempdir()}\{appname}_{lcid}.msi Product {lcid}')
os.system(rf'"{SDKPATH}\MsiTran.Exe" -g {gettempdir()}\{appname}_1033.msi {gettempdir()}\{appname}_{lcid}.msi {gettempdir()}\{lcid}.mst') # noqa: E501 # Not going to get shorter
os.system(rf'cscript /nologo "{SDKPATH}\WiSubStg.vbs" {package_filename} {gettempdir()}\{lcid}.mst {lcid}')
else:
raise AssertionError('Unsupported platform')
###########################################################################