-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsetup.py
More file actions
33 lines (26 loc) · 931 Bytes
/
Copy pathsetup.py
File metadata and controls
33 lines (26 loc) · 931 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
"""bt_api_py 安装脚本(纯 Python 包,元数据在 pyproject.toml)。"""
import shutil
from pathlib import Path
from setuptools import find_packages, setup
from setuptools.command.build_py import build_py
class BuildPyWithoutBytecode(build_py):
"""Remove stale bytecode from the staging directory before wheel assembly."""
def run(self) -> None:
super().run()
build_root = Path(self.build_lib)
for cache_dir in build_root.rglob("__pycache__"):
shutil.rmtree(cache_dir)
for bytecode in build_root.rglob("*.py[co]"):
bytecode.unlink()
setup(
packages=find_packages(include=["bt_api_py", "bt_api_py.*"], exclude=["tests"]),
cmdclass={"build_py": BuildPyWithoutBytecode},
package_data={
"bt_api_py": [
"configs/*.pkl",
"configs/*.toml",
"configs/*.yaml",
"py.typed",
],
},
)