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

Feature/ticket1654 cffi unicode encode error #1656

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Dockerfile.py2
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ FROM ubuntu:18.04

ENV ANDROID_HOME="/opt/android"

# configure locale
RUN apt update -qq > /dev/null && apt install -qq --yes --no-install-recommends \
locales && \
locale-gen en_US.UTF-8
ENV LANG="en_US.UTF-8" \
LANGUAGE="en_US.UTF-8" \
LC_ALL="en_US.UTF-8"

RUN apt -y update -qq \
&& apt -y install -qq --no-install-recommends curl unzip ca-certificates \
&& apt -y autoremove
Expand Down
10 changes: 9 additions & 1 deletion Dockerfile.py3
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# docker build --tag=p4a --file Dockerfile.py3 .
#
# Run with:
# docker run -it --rm p4apy3 /bin/sh -c '. venv/bin/activate && p4a apk --help'
# docker run -it --rm p4a /bin/sh -c '. venv/bin/activate && p4a apk --help'
#
# Or for interactive shell:
# docker run -it --rm p4a
Expand All @@ -19,6 +19,14 @@ FROM ubuntu:18.04

ENV ANDROID_HOME="/opt/android"

# configure locale
RUN apt update -qq > /dev/null && apt install -qq --yes --no-install-recommends \
locales && \
locale-gen en_US.UTF-8
ENV LANG="en_US.UTF-8" \
LANGUAGE="en_US.UTF-8" \
LC_ALL="en_US.UTF-8"

RUN apt -y update -qq \
&& apt -y install -qq --no-install-recommends curl unzip ca-certificates \
&& apt -y autoremove
Expand Down
9 changes: 5 additions & 4 deletions ci/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,15 @@ class TargetPython(Enum):
'enum34',
# https://github.com/kivy/python-for-android/issues/1399
'libglob',
# cannot find -lcrystax
'cffi', 'pycryptodome', 'pymuk', 'secp256k1',
# Could not fetch URL https://pypi.org/simple/pymuk/: 404 Client Error
'pymuk',
# build_dir = glob.glob('build/lib.*')[0]
# IndexError: list index out of range
'secp256k1',
# https://github.com/kivy/python-for-android/issues/1404
'cryptography',
# https://github.com/kivy/python-for-android/issues/1294
'ffmpeg', 'ffpyplayer',
# https://github.com/kivy/python-for-android/pull/1307 ?
'gevent',
'icu',
# https://github.com/kivy/python-for-android/issues/1354
'kivent_core', 'kivent_cymunk', 'kivent_particles', 'kivent_polygen',
Expand Down
2 changes: 1 addition & 1 deletion pythonforandroid/recipes/gevent/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


class GeventRecipe(CythonRecipe):
version = '1.3.7'
version = '1.4.0'
url = 'https://pypi.python.org/packages/source/g/gevent/gevent-{version}.tar.gz'
depends = ['librt', 'greenlet']
patches = ["cross_compiling.patch"]
Expand Down
2 changes: 1 addition & 1 deletion pythonforandroid/recipes/pycryptodome/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


class PycryptodomeRecipe(PythonRecipe):
version = '3.4.6'
version = '3.7.3'
url = 'https://github.com/Legrandin/pycryptodome/archive/v{version}.tar.gz'
depends = ['setuptools', 'cffi']

Expand Down
18 changes: 18 additions & 0 deletions tests/test_logger.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import unittest
from mock import MagicMock
from pythonforandroid import logger


class TestShprint(unittest.TestCase):

def test_unicode_encode(self):
"""
Makes sure `shprint()` can handle unicode command output.
Running the test with PYTHONIOENCODING=ASCII env would fail, refs:
https://github.com/kivy/python-for-android/issues/1654
"""
expected_command_output = ["foo\xa0bar"]
command = MagicMock()
command.return_value = expected_command_output
output = logger.shprint(command, 'a1', k1='k1')
self.assertEqual(output, expected_command_output)