-
Notifications
You must be signed in to change notification settings - Fork 86
/
Copy pathsetup.py
65 lines (54 loc) · 1.78 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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from sys import platform
from setuptools import Extension, setup
from pathlib import Path
import numpy as np
# Set this first for easier replacement
version = "2024.0.3"
# read the contents of the README file into the PyPI description
this_directory = Path(__file__).parent
long_description = (this_directory / "README.md").read_text()
# Set appropriate optimization flags
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",
"src/npy_2_compat.h"
],
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=long_description,
long_description_content_type="text/markdown",
ext_modules=extensions,
version=version,
)
def build(setup_kwargs):
# For possible poetry support
setup_kwargs.update({"ext_modules": extensions})
if __name__ == "__main__":
setup(**setup_metadata)