-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
executable file
·61 lines (53 loc) · 1.62 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
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import platform
import sys
from setuptools import Extension, setup
from ska_helpers.setup_helper import duplicate_package_info
from testr.setup_helper import cmdclass
os_name = platform.system()
if os_name == "Windows":
compile_args = ["/EHs", "/D_CRT_SECURE_NO_DEPRECATE"]
else:
compile_args = [
"-Wno-switch-enum",
"-Wno-switch",
"-Wno-switch-default",
"-Wno-deprecated",
"-Wno-parentheses",
]
if os_name == "Darwin":
compile_args += ["-stdlib=libc++"]
extensions = [
Extension(
"chandra_time._axTime3",
["chandra_time/_axTime3.pyx"],
extra_compile_args=compile_args,
)
]
name = "chandra_time"
namespace = "Chandra.Time"
packages = ["chandra_time", "chandra_time.tests"]
package_dir = {name: name}
duplicate_package_info(packages, name, namespace)
duplicate_package_info(package_dir, name, namespace)
# Special case here to allow `python setup.py --version` to run without
# requiring cython and numpy to be installed.
if "--version" in sys.argv[1:]:
ext_modules = None
else:
from Cython.Build import cythonize
ext_modules = cythonize(extensions, language_level="3")
setup(
name=name,
author="Tom Aldcroft",
description="Convert between various time formats relevant to Chandra",
author_email="[email protected]",
use_scm_version=True,
setup_requires=["setuptools_scm", "setuptools_scm_git_archive"],
zip_safe=False,
packages=packages,
package_dir=package_dir,
ext_modules=ext_modules,
tests_require=["pytest"],
cmdclass=cmdclass,
)