feat: reduce size of wheels (#398)
Compile with -g0 to reduce the binary size
This commit is contained in:
40
build_ext.py
40
build_ext.py
@@ -3,6 +3,34 @@
|
|||||||
import os
|
import os
|
||||||
from distutils.command.build_ext import build_ext
|
from distutils.command.build_ext import build_ext
|
||||||
|
|
||||||
|
try:
|
||||||
|
from setuptools import Extension
|
||||||
|
except ImportError:
|
||||||
|
from distutils.core import Extension
|
||||||
|
|
||||||
|
|
||||||
|
TO_CYTHONIZE = [
|
||||||
|
"src/dbus_fast/aio/message_reader.py",
|
||||||
|
"src/dbus_fast/message.py",
|
||||||
|
"src/dbus_fast/message_bus.py",
|
||||||
|
"src/dbus_fast/service.py",
|
||||||
|
"src/dbus_fast/signature.py",
|
||||||
|
"src/dbus_fast/unpack.py",
|
||||||
|
"src/dbus_fast/_private/address.py",
|
||||||
|
"src/dbus_fast/_private/marshaller.py",
|
||||||
|
"src/dbus_fast/_private/unmarshaller.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):
|
class BuildExt(build_ext):
|
||||||
def build_extensions(self):
|
def build_extensions(self):
|
||||||
@@ -21,17 +49,7 @@ def build(setup_kwargs):
|
|||||||
setup_kwargs.update(
|
setup_kwargs.update(
|
||||||
dict(
|
dict(
|
||||||
ext_modules=cythonize(
|
ext_modules=cythonize(
|
||||||
[
|
TO_CYTHONIZE,
|
||||||
"src/dbus_fast/aio/message_reader.py",
|
|
||||||
"src/dbus_fast/message.py",
|
|
||||||
"src/dbus_fast/message_bus.py",
|
|
||||||
"src/dbus_fast/service.py",
|
|
||||||
"src/dbus_fast/signature.py",
|
|
||||||
"src/dbus_fast/unpack.py",
|
|
||||||
"src/dbus_fast/_private/address.py",
|
|
||||||
"src/dbus_fast/_private/marshaller.py",
|
|
||||||
"src/dbus_fast/_private/unmarshaller.py",
|
|
||||||
],
|
|
||||||
compiler_directives={"language_level": "3"}, # Python 3
|
compiler_directives={"language_level": "3"}, # Python 3
|
||||||
),
|
),
|
||||||
cmdclass=dict(build_ext=BuildExt),
|
cmdclass=dict(build_ext=BuildExt),
|
||||||
|
|||||||
Reference in New Issue
Block a user