mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-04 14:14:16 -04:00
26 lines
872 B
Python
26 lines
872 B
Python
#!/usr/bin/env python
|
|
# License: GPLv3 Copyright: 2023, Kovid Goyal <kovid at kovidgoyal.net>
|
|
|
|
|
|
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])
|
|
shutil.rmtree(f'{cache_dir}/dl')
|
|
shutil.rmtree(f'{cache_dir}/unpack')
|