From 151a741f5fc441afa7f75b55e3502531d9efc5a1 Mon Sep 17 00:00:00 2001 From: Andre Miras Date: Sun, 11 Aug 2024 22:13:04 +0200 Subject: [PATCH] :arrow_up: Bump sh module to v2, refs #2746 --- pythonforandroid/build.py | 6 +++--- pythonforandroid/recipe.py | 3 +-- pythonforandroid/recipes/python3/__init__.py | 2 +- setup.py | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/pythonforandroid/build.py b/pythonforandroid/build.py index 0cc26db264..05e4e1db7f 100644 --- a/pythonforandroid/build.py +++ b/pythonforandroid/build.py @@ -29,14 +29,14 @@ def get_targets(sdk_dir): if exists(join(sdk_dir, 'cmdline-tools', 'latest', 'bin', 'avdmanager')): avdmanager = sh.Command(join(sdk_dir, 'cmdline-tools', 'latest', 'bin', 'avdmanager')) - targets = avdmanager('list', 'target').stdout.decode('utf-8').split('\n') + targets = avdmanager('list', 'target').split('\n') elif exists(join(sdk_dir, 'tools', 'bin', 'avdmanager')): avdmanager = sh.Command(join(sdk_dir, 'tools', 'bin', 'avdmanager')) - targets = avdmanager('list', 'target').stdout.decode('utf-8').split('\n') + targets = avdmanager('list', 'target').split('\n') elif exists(join(sdk_dir, 'tools', 'android')): android = sh.Command(join(sdk_dir, 'tools', 'android')) - targets = android('list').stdout.decode('utf-8').split('\n') + targets = android('list').split('\n') else: raise BuildInterruptingException( 'Could not find `android` or `sdkmanager` binaries in Android SDK', diff --git a/pythonforandroid/recipe.py b/pythonforandroid/recipe.py index c4131c53e6..62d07cb1bf 100644 --- a/pythonforandroid/recipe.py +++ b/pythonforandroid/recipe.py @@ -469,8 +469,7 @@ def unpack(self, arch): elif extraction_filename.endswith( ('.tar.gz', '.tgz', '.tar.bz2', '.tbz2', '.tar.xz', '.txz')): sh.tar('xf', extraction_filename) - root_directory = sh.tar('tf', extraction_filename).stdout.decode( - 'utf-8').split('\n')[0].split('/')[0] + root_directory = sh.tar('tf', extraction_filename).split('\n')[0].split('/')[0] if root_directory != basename(directory_name): move(root_directory, directory_name) else: diff --git a/pythonforandroid/recipes/python3/__init__.py b/pythonforandroid/recipes/python3/__init__.py index 3a9575148a..2334db6add 100644 --- a/pythonforandroid/recipes/python3/__init__.py +++ b/pythonforandroid/recipes/python3/__init__.py @@ -320,7 +320,7 @@ def build_arch(self, arch): android_build = sh.Command( join(recipe_build_dir, - 'config.guess'))().stdout.strip().decode('utf-8') + 'config.guess'))().strip() with current_directory(build_dir): if not exists('config.status'): diff --git a/setup.py b/setup.py index 4a628df905..c9cebd2314 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ # https://github.com/kivy/buildozer/issues/722 install_reqs = [ 'appdirs', 'colorama>=0.3.3', 'jinja2', - 'sh>=1.10, <2.0; sys_platform!="win32"', + 'sh>=2, <3.0; sys_platform!="win32"', 'build', 'toml', 'packaging', 'setuptools', 'wheel~=0.43.0' ] # (build and toml are used by pythonpackage.py)