File: renderdoc-update.py

package info (click to toggle)
mesa 25.3.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 322,588 kB
  • sloc: ansic: 2,212,221; xml: 1,032,268; cpp: 519,763; python: 81,993; asm: 40,568; yacc: 11,976; lisp: 5,067; lex: 3,452; sh: 1,035; makefile: 224
file content (31 lines) | stat: -rwxr-xr-x 988 bytes parent folder | download
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/refs/tags/v1.5/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')