Spaces:
Running
Running
File size: 1,184 Bytes
ef8334d | 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 34 35 36 | import os
from pathlib import Path
import shlex
import shutil
import sysconfig
from setuptools import Extension, setup
# A relocated Python may name the compiler from its original build machine.
# Honor explicit compiler overrides and fall back to the host's C++ compiler.
if os.name == "posix":
for variable, fallback in (("CC", "cc"), ("CXX", "c++")):
configured = shlex.split(sysconfig.get_config_var(variable) or "")
if configured and not shutil.which(configured[0]) and shutil.which(fallback):
os.environ.setdefault(variable, fallback)
headers = Path(__file__).resolve().parent.parent / "include"
setup(
name="sincekit",
version="0.1.0",
description="Latest-state changefeed for independent consumer cursors",
python_requires=">=3.9",
py_modules=["sincekit"],
ext_modules=[
Extension(
"_sincekit",
sources=["binding.cpp"],
include_dirs=[str(headers)],
depends=[str(headers / name) for name in ("sincekit.h", "sincekit_batch.h")],
extra_compile_args=["/std:c++17"] if os.name == "nt" else ["-std=c++17"],
language="c++",
)
],
)
|