FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-zeroconf/build_ext.py at master · python-zeroconf/python-zeroconf · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
python-zeroconf
/
python-zeroconf
Public
Notifications
You must be signed in to change notification settings
Fork
230
Star
734
Code
Issues
46
Pull requests
8
Discussions
Actions
Projects
Wiki
Security and quality
5
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
python-zeroconf
/
build_ext.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
75 lines (65 loc) · 2.13 KB
Breadcrumbs
python-zeroconf
/
build_ext.py
Copy path
File metadata and controls
75 lines (65 loc) · 2.13 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
"""Build optional cython modules."""
import
logging
import
os
from
distutils
.
command
.
build_ext
import
build_ext
from
typing
import
Any
try
:
from
setuptools
import
Extension
except
ImportError
:
from
distutils
.
core
import
Extension
_LOGGER
=
logging
.
getLogger
(
__name__
)
TO_CYTHONIZE
=
[
"src/zeroconf/_dns.py"
,
"src/zeroconf/_cache.py"
,
"src/zeroconf/_history.py"
,
"src/zeroconf/_record_update.py"
,
"src/zeroconf/_listener.py"
,
"src/zeroconf/_protocol/incoming.py"
,
"src/zeroconf/_protocol/outgoing.py"
,
"src/zeroconf/_handlers/answers.py"
,
"src/zeroconf/_handlers/record_manager.py"
,
"src/zeroconf/_handlers/multicast_outgoing_queue.py"
,
"src/zeroconf/_handlers/query_handler.py"
,
"src/zeroconf/_services/__init__.py"
,
"src/zeroconf/_services/browser.py"
,
"src/zeroconf/_services/info.py"
,
"src/zeroconf/_services/registry.py"
,
"src/zeroconf/_updates.py"
,
"src/zeroconf/_utils/ipaddress.py"
,
"src/zeroconf/_utils/time.py"
,
]
EXTENSIONS
=
[
Extension
(
ext
.
removeprefix
(
"src/"
).
removesuffix
(
".py"
).
replace
(
"/"
,
"."
),
[
ext
],
language
=
"c"
,
extra_compile_args
=
[
"-O3"
,
"-g0"
],
)
for
ext
in
TO_CYTHONIZE
]
class
BuildExt
(
build_ext
):
def
build_extensions
(
self
)
->
None
:
if
self
.
parallel
is
None
:
# type: ignore[has-type]
self
.
parallel
=
os
.
cpu_count
()
or
1
try
:
super
().
build_extensions
()
except
Exception
:
_LOGGER
.
info
(
"Failed to build cython extensions"
)
def
build
(
setup_kwargs
:
Any
)
->
None
:
if
os
.
environ
.
get
(
"SKIP_CYTHON"
):
return
try
:
from
Cython
.
Build
import
cythonize
# noqa: PLC0415
setup_kwargs
.
update
(
{
"ext_modules"
:
cythonize
(
EXTENSIONS
,
compiler_directives
=
{
"language_level"
:
"3"
},
# Python 3
),
"cmdclass"
: {
"build_ext"
:
BuildExt
},
}
)
setup_kwargs
[
"exclude_package_data"
]
=
{
pkg
: [
"*.c"
]
for
pkg
in
setup_kwargs
[
"packages"
]}
except
Exception
:
if
os
.
environ
.
get
(
"REQUIRE_CYTHON"
):
raise
Back
|
FazBrowse Home
|
New Git URL