Command to automatically install the Windows SDK

This commit is contained in:
Kovid Goyal 2023-01-26 20:33:49 +05:30
parent c895aab7ac
commit bf6db247a2
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 35 additions and 2 deletions

View File

@ -1 +1 @@
to_vm_excludes '/imgsrc /build /dist /manual /format_docs /translations /.build-cache /tags /Changelog* *.so *.pyd' to_vm_excludes '/imgsrc /build /dist /manual /format_docs /translations /.build-cache /.cache /tags /Changelog* *.so *.pyd'

View File

@ -20,7 +20,7 @@ __all__ = [
'upload_user_manual', 'upload_demo', 'reupload', 'upload_user_manual', 'upload_demo', 'reupload',
'stage1', 'stage2', 'stage3', 'stage4', 'stage5', 'publish', 'publish_betas', 'stage1', 'stage2', 'stage3', 'stage4', 'stage5', 'publish', 'publish_betas',
'linux', 'linux64', 'linuxarm64', 'win', 'win64', 'osx', 'build_dep', 'linux', 'linux64', 'linuxarm64', 'win', 'win64', 'osx', 'build_dep',
'export_packages', 'hyphenation', 'liberation_fonts', 'stylelint' 'export_packages', 'hyphenation', 'liberation_fonts', 'stylelint', 'xwin',
] ]
from setup.installers import Linux, Win, OSX, Linux64, LinuxArm64, Win64, ExtDev, BuildDep, ExportPackages from setup.installers import Linux, Win, OSX, Linux64, LinuxArm64, Win64, ExtDev, BuildDep, ExportPackages
@ -101,6 +101,10 @@ upload_to_server = UploadToServer()
upload_installers = UploadInstallers() upload_installers = UploadInstallers()
reupload = ReUpload() reupload = ReUpload()
from setup.xwin import XWin
xwin = XWin()
commands = {} commands = {}
for x in __all__: for x in __all__:
commands[x] = locals()[x] commands[x] = locals()[x]

29
setup/xwin.py Normal file
View File

@ -0,0 +1,29 @@
#!/usr/bin/env python
# License: GPLv3 Copyright: 2023, Kovid Goyal <kovid at kovidgoyal.net>
import os
import shutil
from setup import Command
class XWin(Command):
description = 'Install the Windows headers for cross compilation'
def run(self, opts):
import subprocess
cache_dir = '.build-cache/xwin'
output_dir = cache_dir + '/splat'
cmd = f'xwin --include-atl --accept-license --cache-dir {cache_dir}'.split()
for step in 'download unpack'.split():
try:
subprocess.check_call(cmd + [step])
except FileNotFoundError:
raise SystemExit('xwin not found install it from https://github.com/Jake-Shadle/xwin/releases')
subprocess.check_call(cmd + ['splat', '--output', output_dir])
base = f'{output_dir}/sdk/include/um'
for casefix in 'Ole2.h OleCtl.h OAIdl.h OCIdl.h'.split():
os.link(f'{base}/{casefix.lower()}', f'{base}/{casefix}')
shutil.rmtree(f'{cache_dir}/dl')
shutil.rmtree(f'{cache_dir}/unpack')