mirror of OpenBSD xenocara tree
github.com/openbsd/xenocara
openbsd
1#!/usr/bin/env python3
2
3import base64
4import pathlib
5import requests
6import subprocess
7
8def error(msg: str) -> None:
9 print('\033[31m' + msg + '\033[0m')
10
11if __name__ == '__main__':
12 git_toplevel = subprocess.check_output(['git', 'rev-parse', '--show-toplevel'],
13 stderr=subprocess.DEVNULL).decode("ascii").strip()
14 if not pathlib.Path(git_toplevel).resolve() == pathlib.Path('.').resolve():
15 error('Please run this script from the root folder ({})'.format(git_toplevel))
16 exit(1)
17
18 file = 'include/renderdoc_app.h'
19 url = 'https://raw.githubusercontent.com/baldurk/renderdoc/v1.1/renderdoc/api/app/renderdoc_app.h'
20
21 print('Syncing {}...'.format(file), end=' ', flush=True)
22 req = requests.get(url)
23
24 if not req.ok:
25 error('Failed to retrieve file: {} {}'.format(req.status_code, req.reason))
26 exit(1)
27
28 with open(file, 'wb') as f:
29 f.write(req.content)
30
31 print('Done')