File: renderdoc-update.py

package info (click to toggle)
mesa 25.2.8-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 312,152 kB
  • sloc: ansic: 2,185,354; xml: 1,028,239; cpp: 512,236; python: 76,148; asm: 38,329; yacc: 12,198; lisp: 4,114; lex: 3,429; sh: 855; makefile: 237
file content (31 lines) | stat: -rwxr-xr-x 978 bytes parent folder | download | duplicates (5)
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
28
29
30
31
#!/usr/bin/env python3

import base64
import pathlib
import requests
import subprocess

def error(msg: str) -> None:
    print('\033[31m' + msg + '\033[0m')

if __name__ == '__main__':
    git_toplevel = subprocess.check_output(['git', 'rev-parse', '--show-toplevel'],
                                           stderr=subprocess.DEVNULL).decode("ascii").strip()
    if not pathlib.Path(git_toplevel).resolve() == pathlib.Path('.').resolve():
        error('Please run this script from the root folder ({})'.format(git_toplevel))
        exit(1)

    file = 'include/renderdoc_app.h'
    url = 'https://raw.githubusercontent.com/baldurk/renderdoc/v1.1/renderdoc/api/app/renderdoc_app.h'

    print('Syncing {}...'.format(file), end=' ', flush=True)
    req = requests.get(url)

    if not req.ok:
        error('Failed to retrieve file: {} {}'.format(req.status_code, req.reason))
        exit(1)

    with open(file, 'wb') as f:
        f.write(req.content)

    print('Done')