-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
79 lines (68 loc) · 1.97 KB
/
setup.py
File metadata and controls
79 lines (68 loc) · 1.97 KB
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
"""
Setup script for building Cython extensions.
This is called automatically by setuptools during pip install.
"""
import os
from setuptools import Extension, setup # type: ignore
# Check if Cython is available
try:
from Cython.Build import cythonize
USE_CYTHON = True
except ImportError:
USE_CYTHON = False
def get_extensions():
"""Get list of Cython extensions to build."""
if not USE_CYTHON:
return []
parsers_dir = os.path.join("arepy_ui", "markup", "parsers")
core_dir = os.path.join("arepy_ui", "core")
colorpicker_dir = os.path.join("arepy_ui", "components", "colorpicker")
extensions = [
# Markup parsers
Extension(
"arepy_ui.markup.parsers.css_parser",
[os.path.join(parsers_dir, "css_parser.pyx")],
language="c",
),
Extension(
"arepy_ui.markup.parsers.aui_parser",
[os.path.join(parsers_dir, "aui_parser.pyx")],
language="c",
),
# Core types and layout
Extension(
"arepy_ui.core.types",
[os.path.join(core_dir, "types.pyx")],
language="c",
),
Extension(
"arepy_ui.core.easing",
[os.path.join(core_dir, "easing.pyx")],
language="c",
),
Extension(
"arepy_ui.core.layout",
[os.path.join(core_dir, "layout.pyx")],
language="c",
),
# ColorPicker HSV operations
Extension(
"arepy_ui.components.colorpicker._hsv",
[os.path.join(colorpicker_dir, "_hsv.pyx")],
language="c",
),
]
return cythonize(
extensions,
compiler_directives={
"language_level": 3,
"boundscheck": False,
"wraparound": False,
},
quiet=True,
)
# Only run setup if called directly or during build
if __name__ == "__main__":
setup(
ext_modules=get_extensions(),
)