forked from kovidgoyal/calibre
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxwin.py
More file actions
27 lines (21 loc) · 863 Bytes
/
xwin.py
File metadata and controls
27 lines (21 loc) · 863 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env python
# License: GPLv3 Copyright: 2023, Kovid Goyal <kovid at kovidgoyal.net>
import os
import runpy
import shutil
from setup import Command
class XWin(Command):
description = 'Install the Windows headers for cross compilation'
def run(self, opts):
if not shutil.which('msiextract'):
raise SystemExit('No msiextract found in PATH you may need to install msitools')
base = os.path.dirname(self.SRC)
m = runpy.run_path(os.path.join(base, 'setup', 'wincross.py'))
cache_dir = os.path.join(base, '.build-cache', 'xwin')
if os.path.exists(cache_dir):
shutil.rmtree(cache_dir)
os.makedirs(cache_dir)
m['main'](['--dest', cache_dir])
for x in os.listdir(cache_dir):
if x != 'root':
shutil.rmtree(os.path.join(cache_dir, x))