Skip to content

Commit ee7a632

Browse files
committed
Monkey patch distutils looking for setup.cfg
Tested on Python 3.7 (has distutils as part of stdlib) and 3.12a7 (has distutils buried inside setuptools).
1 parent 67827a8 commit ee7a632

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

setup.py

+23
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,29 @@
2727
define_macros = []
2828
libraries = []
2929

30+
##
31+
## Workaround for https://github.com/pypa/cibuildwheel/issues/1487
32+
##
33+
34+
patch = False
35+
try:
36+
import distutils.dist
37+
if hasattr(distutils.dist.Distribution, "find_config_files"):
38+
patch = True
39+
except Exception:
40+
pass
41+
42+
if patch:
43+
44+
def monkey_patched_find_config_files(self):
45+
res = orig_find_local_files(self)
46+
if os.path.isfile("setup.apsw"):
47+
res.append("setup.apsw")
48+
return res
49+
50+
orig_find_local_files = distutils.dist.Distribution.find_config_files
51+
distutils.dist.Distribution.find_config_files = monkey_patched_find_config_files
52+
3053
##
3154
## End of customizations
3255
##

0 commit comments

Comments
 (0)