-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
38 lines (35 loc) · 1.12 KB
/
setup.py
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
37
38
from setuptools import setup, find_packages
from setuptools_rust import Binding, RustExtension
from pathlib import Path
import toml
def get_version() -> str:
# this makes the python version match the cargo version :)
version = {}
# the Cargo.toml and setup.py file are in the same directory,
# so we can use the __file__ variable to get the path to the Cargo.toml file.
cargo_toml_path = Path(__file__).parent / "Cargo.toml"
# Open the toml file and retrieve the [package].version value.
with open(cargo_toml_path, "r") as f:
cargo_toml = toml.load(f)
version = cargo_toml["package"]["version"]
return version
setup(
name="delta2-lidar",
version=get_version(),
packages=["delta2_lidar"],
package_dir={
"": "./py-src/",
"delta2_lidar": "./py-src/delta2_lidar",
},
package_data={'delta2_lidar':['*.pyi']},
zip_safe=False,
rust_extensions=[
RustExtension(
"delta2_lidar.delta2_lidar_py",
path="Cargo.toml",
binding=Binding.PyO3,
py_limited_api=True
)
],
include_package_data=True,
)