-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
34 lines (28 loc) · 1015 Bytes
/
setup.py
File metadata and controls
34 lines (28 loc) · 1015 Bytes
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
"""Set up the project."""
from __future__ import annotations
# Standard library
import sys
from pathlib import Path
# Third-party
from setuptools import find_packages
from skbuild import setup
# Obtain version and root of currently active Python environment for cmake
curr_python_version: str = f"{sys.version_info.major}.{sys.version_info.minor}"
curr_python_root: str = str(Path(sys.executable).parent.parent) # remove `bin/python`
# Arguments passed to cmake by scikit-build
cmake_args: list[str] = [
f"-DCMAKE_PREFIX_PATH={curr_python_root}",
f"-DCMAKE_PYTHON_VERSION={curr_python_version}",
]
if sys.argv[1] == "develop":
# `packages=find_packages("src")` is broken for projects with subpackages,
# so only list top-level package(s) during development install
# src: https://github.com/scikit-build/scikit-build/issues/546
packages = ["atmcirclib"]
else:
packages = find_packages("src")
setup(
packages=packages,
package_dir={"": "src"},
cmake_args=cmake_args,
)