File: make_global.py

package info (click to toggle)
pybind11 3.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,448 kB
  • sloc: cpp: 27,239; python: 13,512; ansic: 4,244; makefile: 204; sh: 36
file content (33 lines) | stat: -rwxr-xr-x 928 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
32
33
#!/usr/bin/env -S uv run -q

# /// script
# dependencies = ["tomlkit"]
# ///
from __future__ import annotations

from pathlib import Path

import tomlkit

DIR = Path(__file__).parent.resolve()
PYPROJECT = DIR.parent / "pyproject.toml"


def get_global() -> str:
    pyproject = tomlkit.parse(PYPROJECT.read_text())
    del pyproject["tool"]["scikit-build"]["generate"]
    del pyproject["project"]["entry-points"]
    del pyproject["project"]["scripts"]
    del pyproject["tool"]["scikit-build"]["metadata"]["optional-dependencies"]
    pyproject["project"]["name"] = "pybind11-global"
    pyproject["tool"]["scikit-build"]["experimental"] = True
    pyproject["tool"]["scikit-build"]["wheel"]["install-dir"] = "/data"
    pyproject["tool"]["scikit-build"]["wheel"]["packages"] = []

    result = tomlkit.dumps(pyproject)
    assert isinstance(result, str)
    return result


if __name__ == "__main__":
    print(get_global())