forked from s-watanabe-jhod/garpos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
42 lines (35 loc) · 1.11 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
39
40
41
42
from setuptools import setup,find_namespace_packages,Extension
from setuptools.command.install import install
import platform
from pathlib import Path
import subprocess
class CustomInstallCommand(install):
def find_dir(self, base_path, dir_name):
for path in base_path.rglob("*"):
if path.is_dir() and path.name == dir_name:
return path
return None
def run(self):
install.run(self)
# Define the target directory for cloning
target_dir = Path(__file__).parent / "garpos"
fortran_source = self.find_dir(target_dir, "f90lib")
build_command = "gfortran -shared -fPIC -fopenmp -O3 -o lib_raytrace.so sub_raytrace.f90 lib_raytrace.f90"
subprocess.run(build_command.split(), cwd=fortran_source)
setup(
name="garpos",
version="1.0.2",
python_requires=">=3.7",
packages=find_namespace_packages(),
include_package_data = True,
install_requires=[
"numpy",
"scipy",
"matplotlib",
"pandas",
"scikit-sparse",
],
cmdclass={
"install": CustomInstallCommand
},
)