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

AKP build fails (android.py line 524) #738

Closed
suizokukan opened this issue Oct 31, 2018 · 1 comment
Closed

AKP build fails (android.py line 524) #738

suizokukan opened this issue Oct 31, 2018 · 1 comment

Comments

@suizokukan
Copy link

First of all, thank you very much for the incredible amount work behind kivy !



python=3.6 / Ubuntu 18.04.1 LTS / kivy=1.10.1/ cython=0.25.2


I installed Kivy and Buildozer using this script of my own, following all instructions given here, here, and here.

I tried to compile the Pong example using this buildozer.spec file (please note the lines requirements = python3crystax==3.6,kivy and log_level = 2)

Here is the result of the command $ buildozer android debug logcat , the last lines being :

Cloning into 'python-for-android-new-toolchain'...
Traceback (most recent call last):
  File "/usr/local/bin/buildozer", line 11, in <module>
    load_entry_point('buildozer==0.35', 'console_scripts', 'buildozer')()

[...]

  File "/usr/local/lib/python2.7/dist-packages/buildozer/targets/android.py", line 524, in _install_p4a
    deps = re.findall("^install_reqs = (\[[^\]]*\])", setup, re.DOTALL | re.MULTILINE)[0]
IndexError: list index out of range

The problematic lines in android.py are:

[523]                setup = fd.read()
[524]                deps = re.findall("^install_reqs = (\[[^\]]*\])", setup, re.DOTALL | re.MULTILINE)[0]
[525]                deps = ast.literal_eval(deps)

These lines had already been fixed, see this issue and the fix #724.

In the setup file read by setup=fd.read() (namely /home/sui/Desktop/kivypong/.buildozer/android/platform/python-for-android-new-toolchain/setup.py), the interesting lines (=relative to the regex) are:

if os.name == 'nt':
    install_reqs = ['appdirs', 'colorama>=0.3.3', 'jinja2',
                        'six']
else:
    # don't use sh after 1.12.5, we have performance issues
    # https://github.com/amoffat/sh/issues/378
    install_reqs = ['appdirs', 'colorama>=0.3.3', 'sh>=1.10,<1.12.5', 'jinja2',
                        'six']

I'm not an expert but it seems to me that ^install_reqs = (\[[^\]]*\]) can't catch the string install_reqs = ['appdirs', 'colorama>=0.3.3', 'sh>=1.10,<1.12.5', 'jinja2', 'six'] .
I don't understand the logic behind this line of code so I can't go further.

By example, I don't understand the meaning of [0] in
[524] deps = re.findall("^install_reqs = (\[[^\]]*\])", setup, re.DOTALL | re.MULTILINE)[0]
since there are 2 lists of dependencies, the first one being only for NT system.

By the way, if I replace the regex used in re.findall() by install_reqs = (\[[^\]]*\]) (no more ^), I get two lists of dependencies (the first one for NT system, the second for the other systems), namely :
["['appdirs', 'colorama>=0.3.3', 'jinja2',\n 'six']", "['appdirs', 'colorama>=0.3.3', 'sh>=1.10,<1.12.5', 'jinja2',\n 'six']"] . I don't know how ast works so I can't tell if this result would is ok for ast or not. A new call $ buildozer android debug logcat with such a modification leads to the expected message:
Run "pip install -q --user 'appdirs' 'colorama>=0.3.3' 'jinja2' 'six'
... i.e. the dependencies expected for a NT system. Logically, the build fails some seconds later on my Ubuntu system with the message:
ERROR: The sh Python module could not be found, please install version 1.10 or higher

Finally, I bypassed those lines by installing manually the required depencies (namely, 'appdirs', 'colorama>=0.3.3', 'sh>=1.10,<1.12.5', 'jinja2', 'six') and by writing in android.py :

                setup = fd.read()
                deps = []
                #deps = re.findall("^install_reqs = (\[[^\]]*\])", setup, re.DOTALL | re.MULTILINE)[0]
                #deps = ast.literal_eval(deps)

... and the $ buildozer android debug logcat goes on and produces an AKP file. I don't know if the content of this file is ok - I have presently not enough time to launch it.

I hope this will help !

@suizokukan suizokukan changed the title AKP build fails (android.py ligne 524) AKP build fails (android.py line 524) Oct 31, 2018
@tito
Copy link
Member

tito commented Oct 31, 2018

Search on the bugtracker for closed issue, and try master. It has already been fixed :)

@tito tito closed this as completed Oct 31, 2018
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

2 participants