Some xwin fixes

This commit is contained in:
Kovid Goyal 2023-08-20 21:23:45 +05:30
parent d608e1be54
commit 568f80f210
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 14 additions and 6 deletions

View File

@ -182,7 +182,15 @@ def download(dest_dir, manifest_version=17, manifest_type='release', manifest_pa
manifest = open(manifest_path, 'rb').read()
else:
url = f'https://aka.ms/vs/{manifest_version}/{manifest_type}/channel'
manifest = urlopen(url).read()
print('Downloading top-level manifest from', url)
tm = json.loads(urlopen(url).read())
print("Got toplevel manifest for", (tm["info"]["productDisplayVersion"]))
for item in tm["channelItems"]:
if item.get('type') == "Manifest":
url = item["payloads"][0]["url"]
print('Downloading actual manifest...')
manifest = urlopen(url).read()
pkgs = Packages(manifest, crt_variant, arch)
os.makedirs(dest_dir, exist_ok=True)
total = sum(x.size for x in pkgs.files_to_download)

View File

@ -14,13 +14,13 @@ class XWin(Command):
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.join(os.path.dirname(self.SRC), 'setup')
m = runpy.run_path(os.path.join(base, 'wincross.py'))
cache_dir = os.path.join(base, '.build-cache/xwin')
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])
m['main'](['--dest', cache_dir])
for x in os.listdir(cache_dir):
if x != 'root':
shutil.rmtree(f'{cache_dir}/{x}')
shutil.rmtree(os.path.join(cache_dir, x))