Skip to content
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

Update bootstrap.py #2137

Merged
merged 2 commits into from
Apr 18, 2020
Merged

Update bootstrap.py #2137

merged 2 commits into from
Apr 18, 2020

Conversation

yingshaoxo
Copy link
Contributor

@yingshaoxo yingshaoxo commented Apr 10, 2020

Try to fix a bug that I meet during compiling.

This is how I met this bug:

Step 1

Follow this tutorial to build an apk, succeeded.

https://yingshaoxo.blogspot.com/2020/03/how-to-use-docker-to-build-kivy-to.html

Step 2

Run p4a clean_dists, then run the compile command again:

p4a apk --private . --package=xyz.yingshaoxo.kivydiary --name "KivyDiary" --version 0.2 --bootstrap=sdl2 --requirements=python3,kivy,jnius --blacklist-requirements=sqlite3,libffi,openssl --orientation=portrait --add-source . --presplash=./data/flash.png --icon=./data/icon.png --permission INTERNET --permission WRITE_EXTERNAL_STORAGE --debug

Step 3

This is the error I got:

[INFO]:    *** PYTHON PACKAGE / PROJECT INSTALL STAGE ***
[INFO]:    No Python modules and no setup.py to process, skipping
[INFO]:    # Creating Android project (sdl2)
[INFO]:    Copying SDL2/gradle build for armeabi-v7a
[DEBUG]:   -> running rm -rf /home/user/.local/share/python-for-android/dists/unnamed_dist_1__armeabi-v7a
[DEBUG]:   -> running cp -r /home/user/.local/share/python-for-android/build/bootstrap_builds/sdl2 /home/user/.local/share/python-for-android/dists/unnamed_dist_1__armeabi-v7a
[INFO]:    -> directory context /home/user/.local/share/python-for-android/dists/unnamed_dist_1__armeabi-v7a
[INFO]:    <- directory context /home/user/host/app
[INFO]:    -> directory context /home/user/.local/share/python-for-android/dists/unnamed_dist_1__armeabi-v7a
[INFO]:    Copying Python distribution
[INFO]:    Copying libs
[DEBUG]:   -> running cp -a libs/armeabi-v7a
[DEBUG]:   	/bin/cp: missing destination file operand after 'libs/armeabi-v7a'
[DEBUG]:   	Try '/bin/cp --help' for more information.
Exception in thread background thread for pid 19790:
Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/home/user/app/venv/lib/python3.6/site-packages/sh.py", line 1540, in wrap
    fn(*args, **kwargs)
  File "/home/user/app/venv/lib/python3.6/site-packages/sh.py", line 2459, in background_thread
    handle_exit_code(exit_code)
  File "/home/user/app/venv/lib/python3.6/site-packages/sh.py", line 2157, in fn
    return self.command.handle_command_exit_code(exit_code)
  File "/home/user/app/venv/lib/python3.6/site-packages/sh.py", line 815, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_1: 

  RAN: /bin/cp -a libs/armeabi-v7a

  STDOUT:
/bin/cp: missing destination file operand after 'libs/armeabi-v7a'
Try '/bin/cp --help' for more information.


  STDERR:


Traceback (most recent call last):
  File "/home/user/app/venv/bin/p4a", line 11, in <module>
    load_entry_point('python-for-android', 'console_scripts', 'p4a')()
  File "/home/user/app/pythonforandroid/entrypoints.py", line 18, in main
    ToolchainCL()
  File "/home/user/app/pythonforandroid/toolchain.py", line 680, in __init__
    getattr(self, args.subparser_name.replace('-', '_'))(args)
  File "/home/user/app/pythonforandroid/toolchain.py", line 154, in wrapper_func
    build_dist_from_args(ctx, dist, args)
  File "/home/user/app/pythonforandroid/toolchain.py", line 216, in build_dist_from_args
    ctx.bootstrap.run_distribute()
  File "/home/user/app/pythonforandroid/bootstraps/sdl2/__init__.py", line 38, in run_distribute
    self.distribute_libs(arch, [self.ctx.get_libs_dir(arch.arch)])
  File "/home/user/app/pythonforandroid/bootstrap.py", line 298, in distribute_libs
    shprint(sh.cp, '-a', *libs, tgt_dir)
  File "/home/user/app/pythonforandroid/logger.py", line 167, in shprint
    for line in output:
  File "/home/user/app/venv/lib/python3.6/site-packages/sh.py", line 863, in next
    self.wait()
  File "/home/user/app/venv/lib/python3.6/site-packages/sh.py", line 792, in wait
    self.handle_command_exit_code(exit_code)
  File "/home/user/app/venv/lib/python3.6/site-packages/sh.py", line 815, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_1: 

  RAN: /bin/cp -a libs/armeabi-v7a

  STDOUT:
/bin/cp: missing destination file operand after 'libs/armeabi-v7a'
Try '/bin/cp --help' for more information.


  STDERR:

But when I modified the bootstrip.py as I did in this pull request. Everything works again.

Try to fix a bug that I meet during compiling.

This is how I met this bug:

### Step 1
Follow this tutorial to build an apk, succeeded.

### Step 2
Run `p4a clean_dists`, then run the compile command again:
```
p4a apk --private . --package=xyz.yingshaoxo.kivydiary --name "KivyDiary" --version 0.2 --bootstrap=sdl2 --requirements=python3,kivy,jnius --blacklist-requirements=sqlite3,libffi,openssl --orientation=portrait --add-source . --presplash=./data/flash.png --icon=./data/icon.png --permission INTERNET --permission WRITE_EXTERNAL_STORAGE --debug
```

### Step 3
This is the error I got:
```
[INFO]:    *** PYTHON PACKAGE / PROJECT INSTALL STAGE ***
[INFO]:    No Python modules and no setup.py to process, skipping
[INFO]:    # Creating Android project (sdl2)
[INFO]:    Copying SDL2/gradle build for armeabi-v7a
[DEBUG]:   -> running rm -rf /home/user/.local/share/python-for-android/dists/unnamed_dist_1__armeabi-v7a
[DEBUG]:   -> running cp -r /home/user/.local/share/python-for-android/build/bootstrap_builds/sdl2 /home/user/.local/share/python-for-android/dists/unnamed_dist_1__armeabi-v7a
[INFO]:    -> directory context /home/user/.local/share/python-for-android/dists/unnamed_dist_1__armeabi-v7a
[INFO]:    <- directory context /home/user/host/app
[INFO]:    -> directory context /home/user/.local/share/python-for-android/dists/unnamed_dist_1__armeabi-v7a
[INFO]:    Copying Python distribution
[INFO]:    Copying libs
[DEBUG]:   -> running cp -a libs/armeabi-v7a
[DEBUG]:   	/bin/cp: missing destination file operand after 'libs/armeabi-v7a'
[DEBUG]:   	Try '/bin/cp --help' for more information.
Exception in thread background thread for pid 19790:
Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/home/user/app/venv/lib/python3.6/site-packages/sh.py", line 1540, in wrap
    fn(*args, **kwargs)
  File "/home/user/app/venv/lib/python3.6/site-packages/sh.py", line 2459, in background_thread
    handle_exit_code(exit_code)
  File "/home/user/app/venv/lib/python3.6/site-packages/sh.py", line 2157, in fn
    return self.command.handle_command_exit_code(exit_code)
  File "/home/user/app/venv/lib/python3.6/site-packages/sh.py", line 815, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_1: 

  RAN: /bin/cp -a libs/armeabi-v7a

  STDOUT:
/bin/cp: missing destination file operand after 'libs/armeabi-v7a'
Try '/bin/cp --help' for more information.


  STDERR:


Traceback (most recent call last):
  File "/home/user/app/venv/bin/p4a", line 11, in <module>
    load_entry_point('python-for-android', 'console_scripts', 'p4a')()
  File "/home/user/app/pythonforandroid/entrypoints.py", line 18, in main
    ToolchainCL()
  File "/home/user/app/pythonforandroid/toolchain.py", line 680, in __init__
    getattr(self, args.subparser_name.replace('-', '_'))(args)
  File "/home/user/app/pythonforandroid/toolchain.py", line 154, in wrapper_func
    build_dist_from_args(ctx, dist, args)
  File "/home/user/app/pythonforandroid/toolchain.py", line 216, in build_dist_from_args
    ctx.bootstrap.run_distribute()
  File "/home/user/app/pythonforandroid/bootstraps/sdl2/__init__.py", line 38, in run_distribute
    self.distribute_libs(arch, [self.ctx.get_libs_dir(arch.arch)])
  File "/home/user/app/pythonforandroid/bootstrap.py", line 298, in distribute_libs
    shprint(sh.cp, '-a', *libs, tgt_dir)
  File "/home/user/app/pythonforandroid/logger.py", line 167, in shprint
    for line in output:
  File "/home/user/app/venv/lib/python3.6/site-packages/sh.py", line 863, in next
    self.wait()
  File "/home/user/app/venv/lib/python3.6/site-packages/sh.py", line 792, in wait
    self.handle_command_exit_code(exit_code)
  File "/home/user/app/venv/lib/python3.6/site-packages/sh.py", line 815, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_1: 

  RAN: /bin/cp -a libs/armeabi-v7a

  STDOUT:
/bin/cp: missing destination file operand after 'libs/armeabi-v7a'
Try '/bin/cp --help' for more information.


  STDERR:
```

____

But when I modified the `bootstrip.py` as I did in this pull request. Everything works again.
@AndreMiras
Copy link
Member

AndreMiras commented Apr 17, 2020

Hi @yingshaoxo thanks for the PR, that sounds like a bug I've introduced recently in #2115
There's a better fix I believe. Let me reproduce it (hopefully this weekend) and comeback with a fix.
Edit: So yes I was able to reproduce and I was initially imagining another fix, but your fix is actually what we need. Thanks!

Copy link
Member

@AndreMiras AndreMiras left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the report/fix, I was able to reproduce.
I've edited the pull request to remove the debug message, I hope that's OK for you.
Will merge when CI is green

@AndreMiras
Copy link
Member

The GitHub actions failed in an interesting way. I've restarted the build and it's still failing:

mkdir -p /home/user/.android/android-ndk-r19b \
&& unzip -q android-ndk-r19b-linux-x86_64.zip -d /home/user/.android \
&& ln -sfn /home/user/.android/android-ndk-r19b /home/user/.android/android-ndk \
&& rm -f android-ndk-r19b-linux-x86_64.zip
Error processing tar file(exit status 1): write /home/user/.android/android-ndk-r19b/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/lib/bfd-plugins/LLVMgold.so: no space left on device
make: *** [docker/build] Error 1
Makefile:61: recipe for target 'docker/build' failed

I hope it's a temporary glitch, I'm merging as this is not related to this PR and Travis build is passing.

@AndreMiras AndreMiras merged commit 265fe7f into kivy:develop Apr 18, 2020
@yingshaoxo
Copy link
Contributor Author

yingshaoxo commented Apr 18, 2020

Thanks for the merging, I hope python-for-android could get updated in the future to catch the update of the software world.

@AndreMiras
Copy link
Member

I hope too and that's up to all of us :)

@yingshaoxo yingshaoxo deleted the patch-2 branch April 19, 2020 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants