mirror of
https://github.com/pybind/pybind11.git
synced 2026-06-29 10:57:03 +00:00
* chore: use scikit-build-core for the build Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> * fix: support tests job Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> * refactor: use tomlkit instead of manual parsing Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> * tests: add tests for output Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> * chore: remove more unused files Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> * fix: restore global pin Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> * fix: test and fix pinning Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> --------- Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
35 lines
977 B
Python
35 lines
977 B
Python
# This file will be replaced in the wheel with a hard-coded version. This only
|
|
# exists to allow running directly from source without installing (not
|
|
# recommended, but supported).
|
|
|
|
from __future__ import annotations
|
|
|
|
import re
|
|
from pathlib import Path
|
|
|
|
DIR = Path(__file__).parent.resolve()
|
|
|
|
input_file = DIR.parent / "include/pybind11/detail/common.h"
|
|
regex = re.compile(
|
|
r"""
|
|
\#define \s+ PYBIND11_VERSION_MAJOR \s+ (?P<major>\d+) .*?
|
|
\#define \s+ PYBIND11_VERSION_MINOR \s+ (?P<minor>\d+) .*?
|
|
\#define \s+ PYBIND11_VERSION_PATCH \s+ (?P<patch>\S+)
|
|
""",
|
|
re.MULTILINE | re.DOTALL | re.VERBOSE,
|
|
)
|
|
|
|
match = regex.search(input_file.read_text(encoding="utf-8"))
|
|
assert match, "Unable to find version in pybind11/detail/common.h"
|
|
__version__ = "{major}.{minor}.{patch}".format(**match.groupdict())
|
|
|
|
|
|
def _to_int(s: str) -> int | str:
|
|
try:
|
|
return int(s)
|
|
except ValueError:
|
|
return s
|
|
|
|
|
|
version_info = tuple(_to_int(s) for s in __version__.split("."))
|