-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathsetup.py
More file actions
61 lines (47 loc) · 1.75 KB
/
setup.py
File metadata and controls
61 lines (47 loc) · 1.75 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Compatibility shim for legacy setuptools workflows.
The canonical build configuration now lives in ``pyproject.toml``.
This file only keeps custom non-package data discovery so ``python -m build``
and older ``setuptools`` entrypoints produce distributions with the runtime
resources that PyMeshGen still expects.
"""
from __future__ import annotations
from pathlib import Path
from setuptools import setup
PROJECT_ROOT = Path(__file__).parent.resolve()
DATA_DIRS = (
"config",
"config/input",
"docs",
"docs/design",
"docs/images",
"3rd_party/meshio/src",
"3rd_party/triangle",
)
def _collect_data_files() -> list[tuple[str, list[str]]]:
data_files: list[tuple[str, list[str]]] = []
for relative_dir in DATA_DIRS:
source_dir = PROJECT_ROOT / relative_dir
if not source_dir.exists():
continue
files = [
str(path.relative_to(PROJECT_ROOT))
for path in source_dir.rglob("*")
if path.is_file()
]
if files:
data_files.append((relative_dir, files))
meshio_license = PROJECT_ROOT / "3rd_party/meshio/LICENSE.txt"
if meshio_license.exists():
data_files.append(("3rd_party/meshio", [str(meshio_license.relative_to(PROJECT_ROOT))]))
top_level_files = []
for relative_file in ("LICENSE.txt", "VERSION", "README.md", "README_zh.md", "README_PACKAGING.md"):
file_path = PROJECT_ROOT / relative_file
if file_path.exists():
top_level_files.append(str(file_path.relative_to(PROJECT_ROOT)))
if top_level_files:
data_files.append((".", top_level_files))
return data_files
if __name__ == "__main__":
setup(data_files=_collect_data_files())