Skip to content

Commit 6890bcf

Browse files
committed
More default Python version cleanups
1 parent 72cf543 commit 6890bcf

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

product/gradle-plugin/src/main/python/chaquopy_monkey.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import os
22
import sys
33
import types
4+
from importlib import import_module
45

56

67
# We want to cause a quick and comprehensible failure when a package attempts to build
@@ -59,7 +60,16 @@ def disable_native_distutils():
5960
from distutils import ccompiler
6061
from distutils.unixccompiler import UnixCCompiler
6162

62-
ccompiler.get_default_compiler = lambda *args, **kwargs: "disabled"
63+
# In newer versions of Setuptools, ccompiler imports all of its symbols from
64+
# elsewhere.
65+
compiler_mods = [ccompiler]
66+
original_mod_name = ccompiler.get_default_compiler.__module__
67+
if original_mod_name != ccompiler.__name__:
68+
compiler_mods.append(import_module(original_mod_name))
69+
70+
for mod in compiler_mods:
71+
mod.get_default_compiler = lambda *args, **kwargs: "disabled"
72+
6373
ccompiler.compiler_class["disabled"] = (
6474
"disabledcompiler", "DisabledCompiler",
6575
"Compiler disabled ({})".format(CHAQUOPY_NATIVE_ERROR))

product/gradle-plugin/src/test/integration/test_gradle_plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,7 @@ def test_download_wheel(self):
10121012
# Our current version of pip shows the full URL for custom indexes, but only
10131013
# the filename for PyPI.
10141014
CHAQUO_URL = (r"https://chaquo.com/pypi-13.1/murmurhash/"
1015-
r"murmurhash-0.28.0-7-cp38-cp38-android_16_x86.whl")
1015+
r"murmurhash-0.28.0-7-cp310-cp310-android_16_x86.whl")
10161016
PYPI_URL = "six-1.14.0-py2.py3-none-any.whl"
10171017

10181018
common_reqs = (["murmurhash/" + name for name in

0 commit comments

Comments
 (0)