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

Setting p4a.source_dir in buildozer causes AttributeError: module 'build' has no attribute 'parse_args_and_make_package' #2149

Closed
zedr opened this issue Apr 22, 2020 · 9 comments

Comments

@zedr
Copy link

zedr commented Apr 22, 2020

Versions

  • Python: 3.7.5
  • OS: Linux
  • Kivy: 1.11.1
  • Cython: 0.29.16

Description

Setting a custom p4a source dir using a freshly cloned 'develop' branch and then building an APK results in a traceback mentioning an AttributeError:

Traceback (most recent call last):
  File "/usr/lib64/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib64/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/zedr/src/python-for-android/pythonforandroid/toolchain.py", line 1231, in <module>
    main()
  File "/home/zedr/src/python-for-android/pythonforandroid/entrypoints.py", line 18, in main
    ToolchainCL()
  File "/home/zedr/src/python-for-android/pythonforandroid/toolchain.py", line 688, in __init__
    getattr(self, command)(args)
  File "/home/zedr/src/python-for-android/pythonforandroid/toolchain.py", line 155, in wrapper_func
    func(self, args, **kw)
  File "/home/zedr/src/python-for-android/pythonforandroid/toolchain.py", line 1099, in apk
    output, build_args = self._build_package(args, package_type='apk')
  File "/home/zedr/src/python-for-android/pythonforandroid/toolchain.py", line 1000, in _build_package
    build_args = build.parse_args_and_make_package(
AttributeError: module 'build' has no attribute 'parse_args_and_make_package'

The error does not occur if I use the master branch instead.

buildozer.spec

Command:

python3.7 -m pythonforandroid.toolchain apk --debug --bootstrap=sdl2 --dist_name letter_trail --name 'Letter Trail' --version 0.1.0 --package com.zedr.games.letter_trail --minsdk 21 --ndk-api 21 --private /home/zedr/src/trail/.buildozer/android/app --permission INTERNET --permission WAKE_LOCK --android-entrypoint org.kivy.android.PythonActivity --android-apptheme @android:style/Theme.NoTitleBar --orientation portrait --window --wakelock --copy-libs --local-recipes /home/zedr/src/trail/recipes --arch armeabi-v7a --color=always --storage-dir="/home/zedr/src/trail/.buildozer/android/platform/build-armeabi-v7a" --ndk-api=21

Spec file:

# (str) python-for-android git clone directory (if empty, it will be automatically cloned from github)
p4a.source_dir = ~/src/python-for-android
@AndreMiras
Copy link
Member

That's an interesting one. I haven't played with this p4a.source_dir feature much.
Could you share the output of:

cd ~/src/python-for-android
git branch
git log -1

@zedr
Copy link
Author

zedr commented Apr 25, 2020

I'm not able to reproduce it anymore. Weird. Will reopen if it happens again. Thanks for your interest anyway.

@zedr zedr closed this as completed Apr 25, 2020
@Dirk-Sandberg
Copy link

Dirk-Sandberg commented May 9, 2020

I'm seeing this same error after cloning python-for-android and setting p4a.source_dir = ~/src/python-for-android in my buildozer.spec file.

erik@erik-VirtualBox:~/src/python-for-android$ git branch
* develop
erik@erik-VirtualBox:~/src/python-for-android$ git log -1
commit f3e922271593d904878fee26ef9adeb21b0f00e0 (HEAD -> develop, origin/develop, origin/HEAD)
Merge: f29262a1 afa99bb4
Author: Andre Miras <AndreMiras@users.noreply.github.com>
Date:   Sat May 9 16:30:33 2020 +0200

    Merge pull request #2177 from AndreMiras/feature/release_documentation_update
   
    Updates release documentation```


@AndreMiras
Copy link
Member

@Dirk-Sandberg could you share your complete build log?

@Dirk-Sandberg
Copy link

Hmm... now it isn't happening. I was running into another error (not while setting the p4a source dir) related to not having libssl-dev installed. Error was

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

After I apt install libssl-dev, it appears that I've fixed both my errors (??).

@AndreMiras
Copy link
Member

OK thanks for sharing, same pattern as @zedr, the error disappeared the second build 🤔 🤷

@mzakharocsc
Copy link

Hmm... now it isn't happening. I was running into another error (not while setting the p4a source dir) related to not having libssl-dev installed. Error was

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

After I apt install libssl-dev, it appears that I've fixed both my errors (??).

I second this with #2178

@alanverdugo
Copy link

Hello, I get this same error, and I've just updated buildozer with buildozer android update while trying to troubleshoot another issue.

However, my problem didn't fix itself like in the previous comments! Also, I've never set any values for p4a.source_dir = and it used to work perfectly before the update.

My current Buildozer version: Buildozer 1.0.1-dev0

Now, whenever I run buildozer android release I get the following error:

Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/ark/git/gilbert/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 1260, in <module>
    main()
  File "/home/ark/git/gilbert/.buildozer/android/platform/python-for-android/pythonforandroid/entrypoints.py", line 18, in main
    ToolchainCL()
  File "/home/ark/git/gilbert/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 709, in __init__
    getattr(self, command)(args)
  File "/home/ark/git/gilbert/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 155, in wrapper_func
    func(self, args, **kw)
  File "/home/ark/git/gilbert/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 1128, in apk
    output, build_args = self._build_package(args, package_type='apk')
  File "/home/ark/git/gilbert/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 1029, in _build_package
    build_args = build.parse_args_and_make_package(
AttributeError: module 'build' has no attribute 'parse_args_and_make_package'

Is there any way for me to go back to a stable version? It feels like I am breaking more stuff while trying to fix my problems.
Any help would be appreciated! thanks!

@alanverdugo
Copy link

Hello, I get this same error, and I've just updated buildozer with buildozer android update while trying to troubleshoot another issue.

However, my problem didn't fix itself like in the previous comments! Also, I've never set any values for p4a.source_dir = and it used to work perfectly before the update.

My current Buildozer version: Buildozer 1.0.1-dev0

Now, whenever I run buildozer android release I get the following error:

Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/ark/git/gilbert/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 1260, in <module>
    main()
  File "/home/ark/git/gilbert/.buildozer/android/platform/python-for-android/pythonforandroid/entrypoints.py", line 18, in main
    ToolchainCL()
  File "/home/ark/git/gilbert/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 709, in __init__
    getattr(self, command)(args)
  File "/home/ark/git/gilbert/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 155, in wrapper_func
    func(self, args, **kw)
  File "/home/ark/git/gilbert/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 1128, in apk
    output, build_args = self._build_package(args, package_type='apk')
  File "/home/ark/git/gilbert/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 1029, in _build_package
    build_args = build.parse_args_and_make_package(
AttributeError: module 'build' has no attribute 'parse_args_and_make_package'

Is there any way for me to go back to a stable version? It feels like I am breaking more stuff while trying to fix my problems.
Any help would be appreciated! thanks!

Hi, in case anybody is having the same problem: I fixed it by executing buildozer android clean and then buildozer android release again.

The build takes much longer now, and I do not know why it broke, or why this seems to fix it, but at least it is working now.

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

5 participants