File: parse-stable-abi.py

package info (click to toggle)
rust-python3-dll-a 0.2.10-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 540 kB
  • sloc: python: 13; makefile: 4
file content (22 lines) | stat: -rwxr-xr-x 652 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env python3
# Parses Python Stable ABI symbol definitions from the manifest in the CPython repository located at https://github.com/python/cpython/blob/main/Misc/stable_abi.toml
# and produces a definition file following the format described at https://docs.microsoft.com/en-us/cpp/build/reference/module-definition-dot-def-files.
import sys
import tomli

stable_abi = tomli.load(sys.stdin.buffer)

print("LIBRARY python3.dll")
print("EXPORTS")

count = 0

for function in stable_abi["function"].keys():
    print(function)
    count += 1

for data in stable_abi["data"].keys():
    print(f"{data} DATA")
    count += 1

assert count >= 859