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

Problems in patching files during building for android_new #416

Closed
khalakhelo opened this issue Nov 3, 2016 · 1 comment
Closed

Problems in patching files during building for android_new #416

khalakhelo opened this issue Nov 3, 2016 · 1 comment

Comments

@khalakhelo
Copy link

I had so many issues trying to build kivy apps using Buildozer, managed to pass them, but here is one I failed to pass.
The building process halts with error in patching files in python2 recipe.
Here is the error output:

[INFO]:    Applying patches for python2[armeabi-v7a]
[INFO]:    Applying patch patches/Python-2.7.2-xcompile.patch
[INFO]:    -> running patch -t -d /home/k/kivy-examples/android/compass/.buildozer/android/platform/build/build/...(and 163 more)
           working: No file to patch.  Skipping patch.     [INFO]:    STDOUT (last 10 lines of 31):                                        
	Perhaps you used the wrong -p or --strip option?	
The text leading up to this was:	
--------------------------	
|diff -urN Python-2.7.2/setup.py ltib/rpm/BUILD/Python-2.7.2/setup.py	
|--- Python-2.7.2/setup.py	2011-06-11 11:46:28.000000000 -0400	
|+++ ltib/rpm/BUILD/Python-2.7.2/setup.py	2011-11-14 12:13:02.175758583 -0500	
--------------------------	
No file to patch.  Skipping patch.	
6 out of 6 hunks ignored	
patching file Lib/plat-linux3/regen
[INFO]:    STDERR:
	
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/local/lib/python2.7/dist-packages/python_for_android-0.4-py2.7.egg/pythonforandroid/toolchain.py", line 837, in <module>
    main()
  File "/usr/local/lib/python2.7/dist-packages/python_for_android-0.4-py2.7.egg/pythonforandroid/toolchain.py", line 834, in main
    ToolchainCL()
  File "/usr/local/lib/python2.7/dist-packages/python_for_android-0.4-py2.7.egg/pythonforandroid/toolchain.py", line 489, in __init__
    getattr(self, args.subparser_name.replace('-', '_'))(args)
  File "/usr/local/lib/python2.7/dist-packages/python_for_android-0.4-py2.7.egg/pythonforandroid/toolchain.py", line 147, in wrapper_func
    build_dist_from_args(ctx, dist, args)
  File "/usr/local/lib/python2.7/dist-packages/python_for_android-0.4-py2.7.egg/pythonforandroid/toolchain.py", line 190, in build_dist_from_args
    build_recipes(build_order, python_modules, ctx)
  File "/usr/local/lib/python2.7/dist-packages/python_for_android-0.4-py2.7.egg/pythonforandroid/build.py", line 555, in build_recipes
    recipe.apply_patches(arch)
  File "/usr/local/lib/python2.7/dist-packages/python_for_android-0.4-py2.7.egg/pythonforandroid/recipe.py", line 508, in apply_patches
    arch.arch)
  File "/usr/local/lib/python2.7/dist-packages/python_for_android-0.4-py2.7.egg/pythonforandroid/recipe.py", line 228, in apply_patch
    "-i", filename, _tail=10)
  File "/usr/local/lib/python2.7/dist-packages/python_for_android-0.4-py2.7.egg/pythonforandroid/logger.py", line 173, in shprint
    for line in output:
  File "/home/k/.local/lib/python2.7/site-packages/sh.py", line 565, in next
    self.wait()
  File "/home/k/.local/lib/python2.7/site-packages/sh.py", line 500, in wait
    self.handle_command_exit_code(exit_code)
  File "/home/k/.local/lib/python2.7/site-packages/sh.py", line 516, in handle_command_exit_code
    raise exc(self.ran, self.process.stdout, self.process.stderr)
sh.ErrorReturnCode_1: 

  RAN: '/usr/bin/patch -t -d /home/k/kivy-examples/android/compass/.buildozer/android/platform/build/build/other_builds/python2/armeabi-v7a/python2 -p1 -i /media/k/VMs/Android/python-for-android-master/pythonforandroid/recipes/python2/patches/Python-2.7.2-xcompile.patch'

  STDOUT:
can't find file to patch at input line 4
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff -urN Python-2.7.2/configure ltib/rpm/BUILD/Python-2.7.2/configure
|--- Python-2.7.2/configure	2011-06-11 11:46:28.000000000 -0400
|+++ ltib/rpm/BUILD/Python-2.7.2/configure	2011-11-14 12:10:41.011373524 -0500
--------------------------
No file to patch.  Skipping patch.
2 out of 2 hunks ignored
can't find file to patch at input line 25
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff -urN Python-2.7.2/Makefile.pre.in ltib/rpm/BUILD/Python-2.7.2/Makefile.pre.in
|--- Python-2.7.2/Makefile.pre.in	2011-06-11 11:46:26.000000000 -0400
|+++ ltib/rpm/BUILD/Python-2.7.2/Makefile.pre.in	2011-11-14 12:10:41.013373444 -0500
--------------------------
No file to patch.  Skipping patch.
6 out of 6 hunks ignored
can't find file to patch at input line 110
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff -urN Python-2.7.2/setup.py ltib/rpm/BUILD/Python-2.7.2/setup.py
|--- Python-2.7.2/setup.py	2011-06-11 11:46:28.000000000 -0400
|+++ ltib/rpm/BUILD/Python-2.7.2/setup.py	2011-11-14 12:13:02.175758583 -0500
--------------------------
No file to patch.  Skipping patch.
6 out of 6 hunks ignored
patching file Lib/plat-linux3/regen


  STDERR:

# Command failed: python -m pythonforandroid.toolchain create --dist_name=compass --bootstrap=sdl2 --requirements=kivy,plyer,hostpython2 --arch armeabi-v7a --copy-libs --local-recipes /media/k/VMs/Android/python-for-android-master/pythonforandroid/recipes --color=always --storage-dir=/home/k/kivy-examples/android/compass/.buildozer/android/platform/build
# 
# Buildozer failed to execute the last command
# The error might be hidden in the log above this error
# Please read the full log, and search for it before
# raising an issue with buildozer itself.
# In case of a bug report, please add a full log with log_level = 2

Before that, the first run with a clean local .buildozer directory (I mean in the project directory), I get a minor error, I think, in building recipes:

[INFO]:    # Prebuilding recipes
[INFO]:    Prebuilding hostpython2 for armeabi-v7a
[INFO]:    -> running cp /usr/local/lib/python2.7/dist-packages/python_for_android-0.4-py2.7.egg/pythonforandroi...(and 164 more)
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/local/lib/python2.7/dist-packages/python_for_android-0.4-py2.7.egg/pythonforandroid/toolchain.py", line 837, in <module>
    main()
  File "/usr/local/lib/python2.7/dist-packages/python_for_android-0.4-py2.7.egg/pythonforandroid/toolchain.py", line 834, in main
    ToolchainCL()
  File "/usr/local/lib/python2.7/dist-packages/python_for_android-0.4-py2.7.egg/pythonforandroid/toolchain.py", line 489, in __init__
    getattr(self, args.subparser_name.replace('-', '_'))(args)
  File "/usr/local/lib/python2.7/dist-packages/python_for_android-0.4-py2.7.egg/pythonforandroid/toolchain.py", line 147, in wrapper_func
    build_dist_from_args(ctx, dist, args)
  File "/usr/local/lib/python2.7/dist-packages/python_for_android-0.4-py2.7.egg/pythonforandroid/toolchain.py", line 190, in build_dist_from_args
    build_recipes(build_order, python_modules, ctx)
  File "/usr/local/lib/python2.7/dist-packages/python_for_android-0.4-py2.7.egg/pythonforandroid/build.py", line 554, in build_recipes
    recipe.prebuild_arch(arch)
  File "/media/k/VMs/Android/python-for-android-master/pythonforandroid/recipes/hostpython2/__init__.py", line 26, in prebuild_arch
    join(self.get_build_dir(), 'Modules', 'Setup'))
  File "/usr/local/lib/python2.7/dist-packages/python_for_android-0.4-py2.7.egg/pythonforandroid/logger.py", line 173, in shprint
    for line in output:
  File "/home/k/.local/lib/python2.7/site-packages/sh.py", line 565, in next
    self.wait()
  File "/home/k/.local/lib/python2.7/site-packages/sh.py", line 500, in wait
    self.handle_command_exit_code(exit_code)
  File "/home/k/.local/lib/python2.7/site-packages/sh.py", line 516, in handle_command_exit_code
    raise exc(self.ran, self.process.stdout, self.process.stderr)
sh.ErrorReturnCode_1: 

  RAN: '/bin/cp /usr/local/lib/python2.7/dist-packages/python_for_android-0.4-py2.7.egg/pythonforandroid/recipes/hostpython2/Setup /home/k/kivy-examples/android/compass/.buildozer/android/platform/build/build/other_builds/hostpython2/desktop/hostpython2/Modules/Setup'

  STDOUT:
/bin/cp: cannot create regular file '/home/k/kivy-examples/android/compass/.buildozer/android/platform/build/build/other_builds/hostpython2/desktop/hostpython2/Modules/Setup': No such file or directory


  STDERR:

# Command failed: python -m pythonforandroid.toolchain create --dist_name=compass --bootstrap=sdl2 --requirements=kivy,plyer,hostpython2 --arch armeabi-v7a --copy-libs --local-recipes /media/k/VMs/Android/python-for-android-master/pythonforandroid/recipes --color=always --storage-dir=/home/k/kivy-examples/android/compass/.buildozer/android/platform/build
# 
# Buildozer failed to execute the last command
# The error might be hidden in the log above this error
# Please read the full log, and search for it before
# raising an issue with buildozer itself.
# In case of a bug report, please add a full log with log_level = 2

Which I fix with a simple
mkdir -p /home/k/kivy-examples/android/compass/.buildozer/android/platform/build/build/other_builds/hostpython2/desktop/hostpython2/Modules/
I don't know if this is ok or not, since hostpython2 actually doesn't have a subdirectory named Modules. Its Setup file is just there.

This build is for Nik Klever's Compass app found in kivy-examples/android/. But I haven't been successful in building any app anyway, even my simplest ones that I was able to run under Kivy Launcher.

Here is buildozer.spec file (sorry GitHub doesn't let me attach it properly):

[app]

title = Compass

package.name = compass

package.domain = org.test

source.dir = .

source.include_exts = py,png,jpg,kv,atlas

version = 0.1

requirements = kivy, plyer, hostpython2


requirements.source.kivy = ../../kivy
requirements.source.kivy = /media/k/VMs/Android/python-for-android-master/pythonforandroid/recipes/kivy/
requirements.source.plyer = 
requirements.source.python2 = /media/k/VMs/Android/python-for-android-master/pythonforandroid/recipes/python2/
### requirements.source.python2 = /media/k/VMs/Android/Python-2.7.2/
requirements.source.hostpython2 = /media/k/VMs/Android/python-for-android-master/pythonforandroid/recipes/hostpython2/
### requirements.source.hostpython2 = /media/k/VMs/Android/Python-2.7.2/

requirements.source.sdl2_image = /media/k/VMs/Android/python-for-android-master/pythonforandroid/recipes/sdl2_image/
requirements.source.sdl2_mixer = /media/k/VMs/Android/python-for-android-master/pythonforandroid/recipes/sdl2_mixer/
requirements.source.sdl2_ttf = /media/k/VMs/Android/python-for-android-master/pythonforandroid/recipes/sdl2_ttf/
requirements.source.sdl2 = /media/k/VMs/Android/python-for-android-master/pythonforandroid/recipes/sdl2/
requirements.source.six = /media/k/VMs/Android/python-for-android-master/pythonforandroid/recipes/six/
requirements.source.pyjnius = /media/k/VMs/Android/python-for-android-master/pythonforandroid/recipes/pyjnius


orientation = portrait

fullscreen = 0

android.api = 14

android.minapi = 14

android.sdk = 24.4.1

android.ndk = r13

android.ndk_path = /media/k/VMs/Android/android-ndk-r13/

android.sdk_path = /media/k/VMs/Android/android-sdk_r24.4.1/

android.ant_path = /media/k/VMs/Android/apache-ant-1.9.7/

android.p4a_dir = /media/k/VMs/Android/python-for-android-master/pythonforandroid/

p4a.local_recipes = /media/k/VMs/Android/python-for-android-master/pythonforandroid/recipes/

android.skip_update = True

[buildozer]
log_level = 2
warn_on_root = 1
@khalakhelo
Copy link
Author

I believe I have committed two mistakes due to misunderstanding from my part.
First, I have referred to pythonforandroid/recipes/*/ directories in requirements sources sections, not the original packages. Of course it makes no sense at all, it was my lack of grasping.
Second, I assumed that parsing buildozer.spec file would skip any part after '#' even after a statement in the same line, like in python code and shell script, which actually wasn't the case. I had commented inline in requirements section (I omitted in my post since I thought they have no effect), but moving the commented requirement to another line let me build successfully.
Hence I am closing this false-issue, since it was only my fault, and I would like to apologize for anyone who spent a minute trying to find out the issue.

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

No branches or pull requests

1 participant