Skip to content

Commit e982301

Browse files
authored
Merge pull request #3048 from kivy/feature/fix_sh_log_too_verbose
🔇 Fix sh logs too verbose
2 parents 230af71 + a85d24e commit e982301

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

pythonforandroid/recipe.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
from urllib.request import urlretrieve
1313
from os import listdir, unlink, environ, curdir, walk
1414
from sys import stdout
15-
from wheel.wheelfile import WheelFile
16-
from wheel.cli.tags import tags as wheel_tags
1715
import time
1816
try:
1917
from urlparse import urlparse
@@ -26,7 +24,7 @@
2624
logger, info, warning, debug, shprint, info_main, error)
2725
from pythonforandroid.util import (
2826
current_directory, ensure_dir, BuildInterruptingException, rmdir, move,
29-
touch)
27+
touch, patch_wheel_setuptools_logging)
3028
from pythonforandroid.util import load_source as import_recipe
3129

3230

@@ -1205,6 +1203,9 @@ def get_wheel_platform_tag(self, arch):
12051203
}[arch.arch]
12061204

12071205
def install_wheel(self, arch, built_wheels):
1206+
with patch_wheel_setuptools_logging():
1207+
from wheel.cli.tags import tags as wheel_tags
1208+
from wheel.wheelfile import WheelFile
12081209
_wheel = built_wheels[0]
12091210
built_wheel_dir = dirname(_wheel)
12101211
# Fix wheel platform tag

pythonforandroid/util.py

+14
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import contextlib
2+
from unittest import mock
23
from fnmatch import fnmatch
34
import logging
45
from os.path import exists, join
@@ -163,3 +164,16 @@ def max_build_tool_version(
163164
"""
164165

165166
return max(build_tools_versions, key=build_tools_version_sort_key)
167+
168+
169+
def patch_wheel_setuptools_logging():
170+
"""
171+
When setuptools is not present and the root logger has no handlers,
172+
Wheels would configure the root logger with DEBUG level, refs:
173+
- https://github.com/pypa/wheel/blob/0.44.0/src/wheel/util.py
174+
- https://github.com/pypa/wheel/blob/0.44.0/src/wheel/_setuptools_logging.py
175+
176+
Both of these conditions are met in our CI, leading to very verbose
177+
and unreadable `sh` logs. Patching it prevents that.
178+
"""
179+
return mock.patch("wheel._setuptools_logging.configure")

0 commit comments

Comments
 (0)