mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Command to automatically install the Windows SDK
This commit is contained in:
parent
c895aab7ac
commit
bf6db247a2
@ -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'
|
||||
|
@ -20,7 +20,7 @@ __all__ = [
|
||||
'upload_user_manual', 'upload_demo', 'reupload',
|
||||
'stage1', 'stage2', 'stage3', 'stage4', 'stage5', 'publish', 'publish_betas',
|
||||
'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
|
||||
@ -101,6 +101,10 @@ upload_to_server = UploadToServer()
|
||||
upload_installers = UploadInstallers()
|
||||
reupload = ReUpload()
|
||||
|
||||
|
||||
from setup.xwin import XWin
|
||||
xwin = XWin()
|
||||
|
||||
commands = {}
|
||||
for x in __all__:
|
||||
commands[x] = locals()[x]
|
||||
|
29
setup/xwin.py
Normal file
29
setup/xwin.py
Normal 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')
|
Loading…
x
Reference in New Issue
Block a user