-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hostpython3 unpack error #2247
Comments
I think your download simply got corrupted, delete that file and try again |
Thank AndreMiras‘ answer. |
I tried to modify
And then catch an other error:
When unpacking from the
def unpack(self, arch):
info_main('Unpacking {} for {}'.format(self.name, arch))
build_dir = self.get_build_container_dir(arch)
user_dir = environ.get('P4A_{}_DIR'.format(self.name.lower()))
debug("==>>unpack name:{}, user_dir:{}".format(self.name.lower(), user_dir))
debug("==>>unpack build_dir:{}".format(build_dir))
if user_dir is not None:
info('P4A_{}_DIR exists, symlinking instead'.format(
self.name.lower()))
if exists(self.get_build_dir(arch)):
debug('==>>exist build dir:{}'.format(self.name.lower(), user_dir))
return
shprint(sh.rm, '-rf', build_dir)
shprint(sh.mkdir, '-p', build_dir)
shprint(sh.rmdir, build_dir)
ensure_dir(build_dir)
shprint(sh.cp, '-a', user_dir, self.get_build_dir(arch))
return
if self.url is None:
info('Skipping {} unpack as no URL is set'.format(self.name))
return
filename = shprint(
sh.basename, self.versioned_url).stdout[:-1].decode('utf-8')
ma = match(u'^(.+)#md5=([0-9a-f]{32})$', filename)
if ma: # fragmented URL?
filename = ma.group(1)
with current_directory(build_dir):
directory_name = self.get_build_dir(arch)
debug("unpack directory_name:{}".format(directory_name))
if not exists(directory_name) or not isdir(directory_name):
extraction_filename = join(
self.ctx.packages_path, self.name, filename)
debug("==>>extraction_file:{}".format(extraction_filename))
if isfile(extraction_filename):
if extraction_filename.endswith('.zip'):
try:
sh.unzip(extraction_filename)
except (sh.ErrorReturnCode_1, sh.ErrorReturnCode_2):
# return code 1 means unzipping had
# warnings but did complete,
# apparently happens sometimes with
# github zips
pass
import zipfile
fileh = zipfile.ZipFile(extraction_filename, 'r')
root_directory = fileh.filelist[0].filename.split('/')[0]
if root_directory != basename(directory_name):
shprint(sh.mv, root_directory, directory_name)
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]
if root_directory != basename(directory_name):
shprint(sh.mv, root_directory, directory_name)
else:
raise Exception(
'Could not extract {} download, it must be .zip, '
'.tar.gz or .tar.bz2 or .tar.xz'.format(extraction_filename))
elif isdir(extraction_filename):
mkdir(directory_name)
for entry in listdir(extraction_filename):
if entry not in ('.git',):
shprint(sh.cp, '-Rv',
join(extraction_filename, entry),
directory_name)
else:
raise Exception(
'Given path is neither a file nor a directory: {}'
.format(extraction_filename))
else:
info('{} is already unpacked, skipping'.format(self.name)) Is this a bug of p4a? Wath should i do? |
Nice that you tried. I would say in this case the best is to try from the shell and also give some info about the file that was downloaded by p4a. So you can do multiple things to help understanding what's going on. First is to check what file is this if it's not a tar archive. file /home/kivy/test/.buildozer/android/platform/build-armeabi-v7a/packages/hostpython3/Python-3.8.1.tgz If it says text, then you can inspect it directory with a text editor. And share the info here or try to debug further yourself until it all makes sense. In the mean time when you see that type of bug, you can also try to reproduce entirely from the shell, meaning downloading yourself and running the tar command. In the same way you should provide as much as info as possible to help debugging. So for instance trying to download from the shell and then extract and again if it doesn't work inspect the file with wget https://www.python.org/ftp/python/3.8.1/Python-3.8.1.tgz
file Python-3.8.1.tgz
tar --version
tar xf Python-3.8.1.tgz The more info we get the better we can help debugging. Also don't be afraid to dig further yourself, specially if it's an issue that we cannot reproduce ourselves. So dig into it, put some breakpoints, make hot fix/workaround to the code until the problem get more clear |
Thanks AndreMiras. |
In addition, some web site access in here is restricted, such as I don't know why, maybe the proxy config are not effective. |
1.Modify cd /home/kivy/Download
rm /home/kivy/test/.buildozer/android/platform/build-armeabi-v7a/packages/hostpython3/*
rm -rf /home/kivy/test/.buildozer/android/platform/build-armeabi-v7a/packages/hostpython3/*
cp Python-3.6.9.tgz /home/kivy/test/.buildozer/android/platform/build-armeabi-v7a/packages/hostpython3/Python-3.6.9.tgz
cp Python-3.6.9.tgz /home/kivy/test/.buildozer/android/platform/build-armeabi-v7a/packages/hostpython3/.mark-Python-3.6.9.tgz
rm -rf /home/kivy/test/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/hostpython3/
buildozer android debug output log:
|
Yes don't try with Python 3.6 as we no longer test against it. Stick to 3.8.1 which is the default p4a one. |
Test log kivy@kivy:~/Downloads$ mkdir test_tar
kivy@kivy:~/Downloads$ cd test_tar/
kivy@kivy:~/Downloads/test_tar$ wget https://www.python.org/ftp/python/3.8.1/Python-3.8.1.tgz
--2020-06-29 08:07:50-- https://www.python.org/ftp/python/3.8.1/Python-3.8.1.tgz
Connecting to 10.110.142.25:1080... connected.
^C
kivy@kivy:~/Downloads/test_tar$ wget -c https://www.python.org/ftp/python/3.8.1/Python-3.8.1.tgz
--2020-06-29 08:08:20-- https://www.python.org/ftp/python/3.8.1/Python-3.8.1.tgz
Connecting to 10.110.142.25:1080... connected.
Proxy request sent, awaiting response... 200 OK
Length: 23978360 (23M) [application/octet-stream]
Saving to: ‘Python-3.8.1.tgz’
Python-3.8.1.tgz 100%[=====================================>] 22.87M 2.26MB/s in 10s
2020-06-29 08:08:31 (2.23 MB/s) - ‘Python-3.8.1.tgz’ saved [23978360/23978360]
kivy@kivy:~/Downloads/test_tar$ file Python-3.8.1.tgz
Python-3.8.1.tgz: gzip compressed data, last modified: Wed Dec 18 19:06:27 2019, max compression, from Unix
kivy@kivy:~/Downloads/test_tar$ tar --version
tar (GNU tar) 1.29
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by John Gilmore and Jay Fenlason.
kivy@kivy:~/Downloads/test_tar$ tar xf Python-3.8.1.tgz
kivy@kivy:~/Downloads/test_tar$ ll
total 23432
drwxr-xr-x 3 kivy kivy 4096 6月 29 08:09 ./
drwxr-xr-x 4 kivy kivy 4096 6月 29 08:07 ../
drwxr-xr-x 17 kivy kivy 4096 12月 19 2019 Python-3.8.1/
-rw-r--r-- 1 kivy kivy 23978360 12月 19 2019 Python-3.8.1.tgz After adding the Wath do i need to do to increase the download speed in buidozer command. |
change .spce file to:
run
But i can found it in the shell:
Cython version 0.29.20 kivy@kivy:~/test/.buildozer/android/platform/python-for-android$ pip3 list | grep Cython
Cython 0.29.20 |
👋 We use the issue tracker exclusively for bug reports and feature requests. However, this issue appears to be a support request. Please use our support channels to get help with the project. If you're having trouble installing or using python-for-android, maybe you could be interested in our quickstart guide. Let us know if this comment was made in error, and we'll be happy to reopen the issue. |
Versions
Description
My ubuntu host comes with python version 3.6.9, and I also specified 3.6.9 in the
.spec
file. Why should download python3.8.1 when buidozer running? And the error is reported during unpackbuildozer.spec
Command:
Spec file:
Logs
The text was updated successfully, but these errors were encountered: