-
Notifications
You must be signed in to change notification settings - Fork 669
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace Makefiles with build.py in specs/*. (#3679)
- Loading branch information
Showing
11 changed files
with
61 additions
and
252 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#! /usr/bin/env python3 | ||
# Usage: | ||
# build-idl.py latest/2.0/webgl2.idl | ||
import os | ||
import pathlib | ||
import subprocess | ||
import sys | ||
|
||
OUT_IDL = pathlib.Path(sys.argv[1]) | ||
INDEX_HTML = OUT_IDL.parent / 'index.html' | ||
assert INDEX_HTML.exists(), INDEX_HTML | ||
|
||
BASE_DIR = pathlib.Path(__file__).parent.parent | ||
assert (BASE_DIR / '.git').exists(), BASE_DIR / '.git' | ||
|
||
# - | ||
# Extract the idl from index.html. | ||
|
||
PYTHONPATH_LIBS = [ | ||
BASE_DIR / 'resources/html5lib-1.1/src/html5lib', | ||
BASE_DIR / 'resources/webencodings-0.5.1/src/webencodings', | ||
] | ||
for lib in PYTHONPATH_LIBS: | ||
assert lib.exists(), lib | ||
PYTHONPATH = os.pathsep.join([str(lib.parent) for lib in PYTHONPATH_LIBS]) | ||
|
||
ENV = os.environ | ||
ENV['PYTHONPATH'] = PYTHONPATH | ||
|
||
args = [sys.executable, BASE_DIR / 'specs/extract-idl.py', INDEX_HTML] | ||
print(f'Running {args}...') | ||
p = subprocess.run(args, env=ENV, stdout=subprocess.PIPE, text=True) | ||
p.check_returncode() | ||
idl = p.stdout | ||
assert '\r' not in idl | ||
|
||
idl_file_data = '''\ | ||
// AUTOGENERATED FILE -- DO NOT EDIT -- SEE Makefile | ||
// | ||
// WebGL IDL definitions scraped from the Khronos specification: | ||
// https://www.khronos.org/registry/webgl/specs/latest/ | ||
''' + idl | ||
|
||
print(f'Writing "{OUT_IDL}"...') | ||
OUT_IDL.write_bytes(idl_file_data.encode()) |
0
specs/latest/1.0/extract-idl.py → specs/extract-idl.py
100755 → 100644
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#! /usr/bin/env python3 | ||
# Usage: build.py (no args) | ||
import pathlib | ||
import subprocess | ||
import sys | ||
|
||
THIS_DIR = pathlib.Path(__file__).parent | ||
BASE_DIR = THIS_DIR.parent.parent.parent | ||
assert (BASE_DIR / '.git').exists(), BASE_DIR / '.git' | ||
|
||
subprocess.run([sys.executable, BASE_DIR / 'specs/build-idl.py', THIS_DIR / 'webgl.idl'], check=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,11 @@ | ||
#! /usr/bin/env python3 | ||
import os | ||
# Usage: build.py (no args) | ||
import pathlib | ||
import subprocess | ||
import sys | ||
|
||
DIR = pathlib.Path(__file__).parent | ||
THIS_DIR = pathlib.Path(__file__).parent | ||
BASE_DIR = THIS_DIR.parent.parent.parent | ||
assert (BASE_DIR / '.git').exists(), BASE_DIR / '.git' | ||
|
||
# - | ||
# Extract the idl from index.html. | ||
|
||
RESOURCES = DIR.parent.parent.parent / 'resources' | ||
assert RESOURCES.exists(), RESOURCES | ||
PYTHONPATH_LIBS = [ | ||
RESOURCES / 'html5lib-1.1/src/html5lib', | ||
RESOURCES / 'webencodings-0.5.1/src/webencodings', | ||
] | ||
for lib in PYTHONPATH_LIBS: | ||
assert lib.exists(), lib | ||
PYTHONPATH = os.pathsep.join([str(lib.parent) for lib in PYTHONPATH_LIBS]) | ||
|
||
ENV = os.environ | ||
ENV['PYTHONPATH'] = PYTHONPATH | ||
|
||
args = [sys.executable, 'extract-idl.py', 'index.html'] | ||
print(f'Running {args}...') | ||
p = subprocess.run([sys.executable, 'extract-idl.py', 'index.html'], cwd=DIR, env=ENV, stdout=subprocess.PIPE, text=True) | ||
p.check_returncode() | ||
idl = p.stdout | ||
assert '\r' not in idl | ||
|
||
idl_file_data = '''\ | ||
// AUTOGENERATED FILE -- DO NOT EDIT -- SEE Makefile | ||
// | ||
// WebGL IDL definitions scraped from the Khronos specification: | ||
// https://www.khronos.org/registry/webgl/specs/latest/ | ||
''' + idl | ||
|
||
out_file = DIR / 'webgl2.idl' | ||
print(f'Writing "{out_file}"...') | ||
out_file.write_bytes(idl_file_data.encode()) | ||
subprocess.run([sys.executable, BASE_DIR / 'specs/build-idl.py', THIS_DIR / 'webgl2.idl'], check=True) |
This file was deleted.
Oops, something went wrong.