buildozer
buildozer copied to clipboard
unzip-silent-owerwrite-true
in non-ineractive mode unzipping android ndk failed as no confirm for overwrite nor skip duplicate paths
Hi @Ratgor !
When that is happening? (the overwriting) Do you have a log to attach?
I plan to replace this line of code with the new buildops library that uses Python's ZipFile rather than bash's unzip.
sorry for the late reply, the issue still exists
with the latest version of buildozer, I still need the fix (actually two fixes) to build anything on Windows or via WSL on Ubuntu (latest try)
some logs below, and the fixes code
prepare image for builds
12:53:44 subprocess INFO: Executing command: docker run --rm --mount type=bind,source="/mnt/c/MyFiles/.../kivy_buider/build_android_work",destination=/home/user/hostcwd --mount type=bind,source="/mnt/c/MyFiles/.../kivy_buider/.buildozer",destination=/home/user/.buildozer --name build-android-container buildozer-image --version 12:53:44 subprocess INFO: Buildozer 1.5.1.dev0 12:53:45 subprocess INFO: 12:53:45 subprocess INFO: Subprocess run finished OK.
run the image
12:53:45 subprocess INFO: Executing command: docker run --mount type=bind,source="/mnt/c/MyFiles/.../kivy_buider/build_android_work",destination=/home/user/hostcwd --mount type=bind,source="/mnt/c/MyFiles/.../kivy_buider/.buildozer",destination=/home/user/.buildozer --name build-android-container buildozer-image android debug <...> 12:54:29 subprocess INFO: # Android SDK is missing, downloading 12:54:29 subprocess INFO: # Downloading https://dl.google.com/android/repository/commandlinetools-linux-6514223_latest.zip # Unpacking Android SDKO: - Download 1.21% 12:54:50 subprocess INFO: # Extracting commandlinetools-linux-6514223_latest.zip to /home/user/.buildozer/android/platform/android-sdk 12:54:50 subprocess INFO: # Run 'unzip -q -o /home/user/.buildozer/android/platform/android-sdk/commandlinetools-linux-6514223_latest.zip' ... 12:54:50 subprocess INFO: # Cwd /home/user/.buildozer/android/platform/android-sdk 12:54:50 subprocess INFO: # Android SDK tools base installation done. 12:54:50 subprocess INFO: # Recommended android's NDK version by p4a is: 25b 12:54:50 subprocess INFO: # Android NDK is missing, downloading 12:54:50 subprocess INFO: # Downloading https://dl.google.com/android/repository/android-ndk-r25-linux.zip
And, that's it. The process hangs waiting user input to confirm unpacking. It is not interactive in my case.
To cope with that I'm using the next fix (the latest version, the PR code is outdated) :
uni_file_patcher(file_path=cfg.cwd/'buildozer/buildozer/buildops.py', replace_map=[
(142, # <-- the line number, followed by current code and the replacement
""" ["unzip", "-q", join(cwd, archive)], cwd=cwd, env=env\n""",
""" ["unzip", "-q", "-o", join(cwd, archive)], cwd=cwd, env=env\n""")
])
One more fix, similar issue. Not so clean, just to know it is needed in my case too.
uni_file_patcher(file_path=cfg.cwd/'buildozer/buildozer/__init__.py', replace_map=[
(718,
""" if sys.stdin.readline().lower()[0] == 'y':\n""",
"""\n if 'distclean' in sys.argv and '--yes' in sys.argv:
buildozer_dir_parts = list(os.path.split(self.global_buildozer_dir))
#buildozer_dir = os.path.abspath(os.path.join(*buildozer_dir_parts[:-1],'hostcwd',buildozer_dir_parts[-1]))
buildozer_dir = os.path.abspath(self.global_buildozer_dir)
self.info(f'[Patched] Clean the global build directory ({buildozer_dir} exists {exists(buildozer_dir)})')
if exists(buildozer_dir):
rmtree(buildozer_dir)
return
\n if ('distclean' in sys.argv and '--yes' in sys.argv) \\
or sys.stdin.readline().lower()[0] == 'y':\n"""),
(719,
""" self.logger.info('Clean the global build directory')\n""",
""" self.logger.info(f'Clean the global build directory """
"""({self.global_buildozer_dir} exists {exists(self.global_buildozer_dir)})')\n""")
])
Julian-O commented on Jul 30, 2023: I plan to replace this line of code with the new buildops library that uses Python's ZipFile rather than bash's unzip.
I think it would be a nice solution (instead of the first my fix)