-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsetup.py
More file actions
93 lines (77 loc) · 2.44 KB
/
setup.py
File metadata and controls
93 lines (77 loc) · 2.44 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/usr/bin/env python
"""
setup.py file for GWforge package
"""
from setuptools import setup, find_packages, Command
from setuptools.command.install import install
from setuptools.command.develop import develop
import os
PATCH_MESSAGE = """
============================================================
PyART post-install step required
------------------------------------------------------------
pycbc <= 2.10.0 is incompatible with numpy 2.x.
Run the following command once to patch pycbc in-place:
python scripts/patch_pycbc_numpy2.py
The patch is idempotent and safe to re-run after pycbc
upgrades.
============================================================
"""
def print_patch_notice(command_cls):
class Patched(command_cls):
def run(self):
super().run()
print(PATCH_MESSAGE)
return Patched
def find_files(
dirname,
relpath=None,
extensions=(".py", ".pyc"),
ignore_dirs=None,
ignore_files=None,
):
def find_paths(directory):
items = []
for root, dirs, files in os.walk(directory):
# Exclude specified directories if ignore_dirs is provided
if ignore_dirs is not None:
dirs[:] = [d for d in dirs if d not in ignore_dirs]
for fname in files:
path = os.path.join(root, fname)
# Exclude specified files and extensions if ignore_files is provided
if ignore_files is not None and (
fname in ignore_files
or any(path.endswith(ext) for ext in extensions)
):
continue
items.append(path)
return items
items = find_paths(dirname)
relpath = relpath or dirname
return [os.path.relpath(path, relpath) for path in items]
ignore_dirs = [
".git",
"__pycache__/",
"profile_default/",
".ipynb_checkpoints",
".vscode",
"venv/",
"env/",
"virtualenv/",
]
ignore_files = [".DS_Store", "*.pyc", "Thumbs.db", "*.sqlite", "*.swp", "*.env", ".env"]
setup(
cmdclass={
"install": print_patch_notice(install),
"develop": print_patch_notice(develop),
},
scripts=find_files(
"bin/", relpath="./", ignore_dirs=ignore_dirs, ignore_files=ignore_files
),
packages=find_packages(),
include_package_data=True,
package_data={
"PyART.numerical": ["twopuncts.dummy"],
"PyART.catalogs": ["sacra.info"],
},
)