-
Notifications
You must be signed in to change notification settings - Fork 55
/
setup.py
100 lines (87 loc) · 2.83 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import os
import sys
from glob import glob
from setuptools import Extension, find_packages, setup
from setuptools.command.build_ext import build_ext
from setuptools.command.develop import develop
# Read current code version
VersionPath = os.path.join(os.path.abspath(os.path.dirname(__file__)), "VERSION")
VERSION = open(VersionPath, "r").read().split("\n")[0].strip()
class BuildExt(build_ext):
"""A custom build extension for adding compiler-specific options."""
def build_extensions(self):
ct = self.compiler.compiler_type # msvc or unix
for ext in self.extensions:
if ct == "msvc":
ext.extra_compile_args = ["/EHsc"]
else:
ext.extra_compile_args = [
"-Wno-unused-variable",
"-Wno-missing-braces",
"-Wno-strict-prototypes",
"-Wno-sign-compare",
"-Wno-comment",
]
build_ext.build_extensions(self)
class Develop(develop):
"""Custom develop command that clears build cache before install."""
def run(self):
# c = clean(self.distribution)
# c.all = True
# c.finalize_options()
# c.run()
develop.run(self)
macros = [
("VPLANET_PYTHON_INTERFACE", 1),
(
"VPLANET_VERSION",
'"{}"'.format(VERSION),
),
]
if sys.platform.startswith("win"):
macros += [("VPLANET_ON_WINDOWS", 1)]
ext_modules = [
Extension(
"vplanet.vplanet_core",
glob("src/*.c"),
include_dirs=["src"],
language="c",
define_macros=macros,
)
]
cmdclass = {"build_ext": BuildExt, "develop": Develop}
# Vplanet suite of tools
vplanet_suite = [
"vplot>=1.0.5",
"vspace>=2.3.2",
"bigplanet>=3.0.1",
"multiplanet>=2.0.3",
]
setup(
name="vplanet",
author="Rory Barnes",
author_email="[email protected]",
url="https://github.com/VirtualPlanetaryLaboratory/vplanet",
version=VERSION,
description="The virtual planet simulator",
long_description=open("README.md", "r").read(),
long_description_content_type="text/markdown",
license="MIT",
packages=["vplanet"],
# install_requires=vplanet_suite + ["astropy>=3.0", "numpy", "tqdm", "pre-commit"],
install_requires=vplanet_suite + ["astropy>=3.0", "numpy", "tqdm", "seaborn"],
python_requires=">=3.6",
# use_scm_version={
# "write_to": os.path.join("vplanet", "vplanet_version.py"),
# "write_to_template": '__version__ = "{version}"\n',
# },
ext_modules=ext_modules,
cmdclass=cmdclass,
include_package_data=True,
# package_data={'': ['VERSION']},
package_data={'': ['src/*.[ch]']},
data_files=[('', ['VERSION'])],
zip_safe=False,
entry_points={"console_scripts": ["vplanet=vplanet.wrapper:_entry_point"]},
)
# sub.call(["pre-commit", "install"])