File tree 1 file changed +20
-3
lines changed
1 file changed +20
-3
lines changed Original file line number Diff line number Diff line change 5
5
from distutils .command .build_ext import build_ext
6
6
from typing import Any
7
7
8
+ try :
9
+ from setuptools import Extension
10
+ except ImportError :
11
+ from distutils .core import Extension
12
+
13
+
14
+ TO_CYTHONIZE = ["src/bleak_esphome/backend/scanner.py" ]
15
+
16
+ EXTENSIONS = [
17
+ Extension (
18
+ ext .removeprefix ("src/" ).removesuffix (".py" ).replace ("/" , "." ),
19
+ [ext ],
20
+ language = "c" ,
21
+ extra_compile_args = ["-O3" , "-g0" ],
22
+ )
23
+ for ext in TO_CYTHONIZE
24
+ ]
25
+
26
+
8
27
_LOGGER = logging .getLogger (__name__ )
9
28
10
29
@@ -30,9 +49,7 @@ def build(setup_kwargs: Any) -> None:
30
49
setup_kwargs .update (
31
50
{
32
51
"ext_modules" : cythonize (
33
- [
34
- "src/bleak_esphome/backend/scanner.py" ,
35
- ],
52
+ EXTENSIONS ,
36
53
compiler_directives = {"language_level" : "3" }, # Python 3
37
54
),
38
55
"cmdclass" : {"build_ext" : BuildExt },
You can’t perform that action at this time.
0 commit comments