Skip to content

Commit

Permalink
exclude build.py, ffi and include
Browse files Browse the repository at this point in the history
  • Loading branch information
Tester authored and Tester committed Dec 27, 2023
1 parent 5caae8f commit af5bbc2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
3 changes: 0 additions & 3 deletions MANIFEST.in

This file was deleted.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ test = [
[tool.setuptools]
packages = ["curl_cffi", "curl_cffi.requests"]
# package-data = { curl_cffi = ["libcurl/*/*"] }
# include-package-data = true
exclude-package-data = { curl_cffi = ["include/*", "ffi/*"] }


[build-system]
Expand Down
18 changes: 17 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import fnmatch

from setuptools import setup
from setuptools.command.build_py import build_py
from wheel.bdist_wheel import bdist_wheel


Expand All @@ -13,8 +16,21 @@ def get_tag(self):
return python, abi, plat


excluded = ['curl_cffi/build.py', 'curl_cffi\\build.py']


class excluded_build_py(build_py):
def find_package_modules(self, package, package_dir):
modules = super().find_package_modules(package, package_dir)
return [
(pkg, mod, file)
for (pkg, mod, file) in modules
if not any(fnmatch.fnmatchcase(file, pat=pattern) for pattern in excluded)
]


setup(
# this option is only valid in setup.py
cffi_modules=["curl_cffi/build.py:ffibuilder"],
cmdclass={"bdist_wheel": bdist_wheel_abi3}, # type: ignore
cmdclass={"bdist_wheel": bdist_wheel_abi3, 'build_py': excluded_build_py}, # type: ignore
)

0 comments on commit af5bbc2

Please sign in to comment.