Exclude .c files from wheel builds (#589)

This commit is contained in:
J. Nick Koston 2023-10-17 18:56:30 -10:00 committed by GitHub
parent f31b250fe2
commit 55677be917
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 7 deletions

View File

@ -1,3 +1,4 @@
include LICENSE include LICENSE
include requirements.txt include requirements.txt
include aioesphomeapi/py.typed include aioesphomeapi/py.typed
global-exclude *.c

View File

@ -31,9 +31,17 @@ GITHUB_URL = "https://github.com/{}".format(GITHUB_PATH)
DOWNLOAD_URL = "{}/archive/{}.zip".format(GITHUB_URL, VERSION) DOWNLOAD_URL = "{}/archive/{}.zip".format(GITHUB_URL, VERSION)
MODULES_TO_CYTHONIZE = [
"aioesphomeapi/connection.py",
"aioesphomeapi/_frame_helper/plain_text.py",
"aioesphomeapi/_frame_helper/noise.py",
"aioesphomeapi/_frame_helper/base.py",
]
with open(os.path.join(here, "requirements.txt")) as requirements_txt: with open(os.path.join(here, "requirements.txt")) as requirements_txt:
REQUIRES = requirements_txt.read().splitlines() REQUIRES = requirements_txt.read().splitlines()
pkgs = find_packages(exclude=["tests", "tests.*"])
setup_kwargs = { setup_kwargs = {
"name": PROJECT_PACKAGE_NAME, "name": PROJECT_PACKAGE_NAME,
@ -45,7 +53,8 @@ setup_kwargs = {
"description": "Python API for interacting with ESPHome devices.", "description": "Python API for interacting with ESPHome devices.",
"long_description": long_description, "long_description": long_description,
"license": PROJECT_LICENSE, "license": PROJECT_LICENSE,
"packages": find_packages(exclude=["tests", "tests.*"]), "packages": pkgs,
"exclude_package_data": {pkg: ["*.c"] for pkg in pkgs},
"include_package_data": True, "include_package_data": True,
"zip_safe": False, "zip_safe": False,
"install_requires": REQUIRES, "install_requires": REQUIRES,
@ -71,12 +80,7 @@ def cythonize_if_available(setup_kwargs):
setup_kwargs.update( setup_kwargs.update(
dict( dict(
ext_modules=cythonize( ext_modules=cythonize(
[ MODULES_TO_CYTHONIZE,
"aioesphomeapi/connection.py",
"aioesphomeapi/_frame_helper/plain_text.py",
"aioesphomeapi/_frame_helper/noise.py",
"aioesphomeapi/_frame_helper/base.py",
],
compiler_directives={"language_level": "3"}, # Python 3 compiler_directives={"language_level": "3"}, # Python 3
), ),
cmdclass=dict(build_ext=OptionalBuildExt), cmdclass=dict(build_ext=OptionalBuildExt),