mirror of
https://github.com/kovidgoyal/kitty.git
synced 2024-09-11 14:45:31 +03:00
Follow PEP 0394 and use /usr/bin/env python so that the python in the users venv is respected. Not that the kitty python files are meant to be executed standalone anyway, but, whatever. Fixes #6810
48 lines
1.1 KiB
Python
Executable File
48 lines
1.1 KiB
Python
Executable File
#!/usr/bin/env python
|
|
# vim:fileencoding=utf-8
|
|
# License: GPL v3 Copyright: 2017, Kovid Goyal <kovid at kovidgoyal.net>
|
|
|
|
import os
|
|
import re
|
|
import shlex
|
|
import shutil
|
|
import subprocess
|
|
|
|
cmdline = (
|
|
'glad --out-path {dest} --api gl:core=3.1 '
|
|
' --extensions GL_ARB_texture_storage,GL_ARB_copy_image,GL_ARB_multisample,GL_ARB_robustness,GL_ARB_instanced_arrays,GL_KHR_debug '
|
|
'c --header-only --debug'
|
|
)
|
|
|
|
|
|
def clean(x):
|
|
if os.path.exists(x):
|
|
shutil.rmtree(x)
|
|
|
|
|
|
def regenerate():
|
|
clean('out')
|
|
|
|
subprocess.check_call(
|
|
shlex.split(cmdline.format(dest='out'))
|
|
)
|
|
|
|
|
|
def strip_trailing_whitespace(c):
|
|
return re.sub(r'\s+$', '', c, flags=re.MULTILINE) + '\n'
|
|
|
|
|
|
def export():
|
|
with open('out/include/glad/gl.h', 'r', encoding='utf-8') as source:
|
|
data = source.read()
|
|
data = strip_trailing_whitespace(data)
|
|
|
|
with open('../kitty/gl-wrapper.h', 'w', encoding='utf-8') as dest:
|
|
dest.write(data)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
os.chdir(os.path.dirname(os.path.abspath(__file__)))
|
|
regenerate()
|
|
export()
|