-
Notifications
You must be signed in to change notification settings - Fork 4
/
setup.py
79 lines (57 loc) · 1.96 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
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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from setuptools import setup
import os
# from sys import platform
# from setuptools.command.install import install
from distutils.command.build import build
from distutils.command.clean import clean
from subprocess import call
# from multiprocessing import cpu_count
class GsetcBuild(build):
def run(self):
# build gsetc
build_path = os.path.abspath(self.build_temp)
print(build_path)
target_files = ["src/gsetc.x", "src/gsetc_omp.x"]
cmd_build = ["make", "-f", "Makefile", "all"]
# cmd_install = ["make", "-f", "Makefile", "install"]
def compile():
call(cmd_build)
# def install():
# call(cmd_install)
self.execute(compile, [], "Compiling gsetc and gsetc_omp")
# self.execute(install, [], "Installing gsetc and gsetc_omp")
# if not self.dry_run:
# for target in target_files:
# self.copy_file(target, os.path.join(build_path, "bin"))
# run original build code
build.run(self)
class GsetcClean(clean):
def run(self):
# run original build code
clean.run(self)
# build gsetc
# build_path = os.path.abspath(self.build_temp)
cmd = ["make", "-f", "Makefile", "clean"]
def compile():
call(cmd)
self.execute(compile, [], "Cleaning gsetc")
def main():
setup(
name="pfsspecsim",
version="0.1",
description="PFS ETC and spectral simulator",
author="Kiyoto Yabe",
author_email="[email protected]",
url="",
install_requires=["scipy", "matplotlib"],
zip_safe=False,
include_package_data=True,
license="", # temporarily set to an empty string as installation failed.
package_dir={"": "python"},
packages=["pfsspecsim"],
cmdclass={"build": GsetcBuild, "clean": GsetcClean},
)
if __name__ == "__main__":
main()