forked from moble/quaternion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
89 lines (78 loc) · 2.57 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
#!/usr/bin/env python
"""\
This package creates a quaternion type in python, and further enables numpy to
create and manipulate arrays of quaternions. The usual algebraic operations
(addition and multiplication) are available, along with numerous properties
like norm and various types of distance measures between two quaternions.
There are also additional functions like "squad" and "slerp" interpolation, and
conversions to and from axis-angle, matrix, and Euler-angle representations of
rotations. The core of the code is written in C for speed.
"""
from sys import platform
from setuptools import Extension, setup
import numpy as np
# Set this first for easier replacement
version = "2020.9.5.14.42.2"
if "win" in platform.lower() and not "darwin" in platform.lower():
extra_compile_args = ["/O2"]
else:
extra_compile_args = ["-O3", "-w"]
extensions = [
Extension(
name="quaternion.numpy_quaternion", # This is the name of the object file that will be compiled
sources=[
"src/quaternion.c",
"src/numpy_quaternion.c"
],
depends=[
"src/quaternion.c",
"src/quaternion.h",
"src/numpy_quaternion.c"
],
include_dirs=[
np.get_include(),
"src"
],
extra_compile_args=extra_compile_args,
),
]
setup_metadata = dict(
name="numpy-quaternion", # Uploaded to pypi under this name
packages=["quaternion"], # This is the actual package name, as used in python
package_dir = {'': 'src'}, # Remove `src/` from the package name
url="https://github.com/moble/quaternion",
author="Michael Boyle",
author_email="[email protected]",
description="Add a quaternion dtype to NumPy",
long_description=__doc__,
ext_modules=extensions,
install_requires=[
"numpy>=1.13",
"scipy",
# See also :environment_marker specs below
],
extras_require={
":python_version < '3.6' and platform_python_implementation != 'PyPy'": [
"numba<0.49.0",
"llvmlite<0.32.0",
],
":python_version >= '3.6' and platform_python_implementation != 'PyPy'": [
"numba",
],
"docs": [
"mkdocs",
"mktheapidocs[plugin]",
"pymdown-extensions",
],
"testing": [
"pytest",
"pytest-cov",
]
},
version=version,
)
def build(setup_kwargs):
# For possible poetry support
setup_kwargs.update({"ext_modules": extensions})
if __name__ == "__main__":
setup(**setup_metadata)