Skip to content

Commit 798e9af

Browse files
authored
Merge pull request kivy#1656 from AndreMiras/feature/ticket1654_cffi_unicode_encode_error
Feature/ticket1654 cffi unicode encode error
2 parents d6f27d7 + 9736243 commit 798e9af

File tree

6 files changed

+42
-7
lines changed

6 files changed

+42
-7
lines changed

Dockerfile.py2

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ FROM ubuntu:18.04
1919

2020
ENV ANDROID_HOME="/opt/android"
2121

22+
# configure locale
23+
RUN apt update -qq > /dev/null && apt install -qq --yes --no-install-recommends \
24+
locales && \
25+
locale-gen en_US.UTF-8
26+
ENV LANG="en_US.UTF-8" \
27+
LANGUAGE="en_US.UTF-8" \
28+
LC_ALL="en_US.UTF-8"
29+
2230
RUN apt -y update -qq \
2331
&& apt -y install -qq --no-install-recommends curl unzip ca-certificates \
2432
&& apt -y autoremove

Dockerfile.py3

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# docker build --tag=p4a --file Dockerfile.py3 .
77
#
88
# Run with:
9-
# docker run -it --rm p4apy3 /bin/sh -c '. venv/bin/activate && p4a apk --help'
9+
# docker run -it --rm p4a /bin/sh -c '. venv/bin/activate && p4a apk --help'
1010
#
1111
# Or for interactive shell:
1212
# docker run -it --rm p4a
@@ -19,6 +19,14 @@ FROM ubuntu:18.04
1919

2020
ENV ANDROID_HOME="/opt/android"
2121

22+
# configure locale
23+
RUN apt update -qq > /dev/null && apt install -qq --yes --no-install-recommends \
24+
locales && \
25+
locale-gen en_US.UTF-8
26+
ENV LANG="en_US.UTF-8" \
27+
LANGUAGE="en_US.UTF-8" \
28+
LC_ALL="en_US.UTF-8"
29+
2230
RUN apt -y update -qq \
2331
&& apt -y install -qq --no-install-recommends curl unzip ca-certificates \
2432
&& apt -y autoremove

ci/constants.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,15 @@ class TargetPython(Enum):
6868
'enum34',
6969
# https://github.com/kivy/python-for-android/issues/1399
7070
'libglob',
71-
# cannot find -lcrystax
72-
'cffi', 'pycryptodome', 'pymuk', 'secp256k1',
71+
# Could not fetch URL https://pypi.org/simple/pymuk/: 404 Client Error
72+
'pymuk',
73+
# build_dir = glob.glob('build/lib.*')[0]
74+
# IndexError: list index out of range
75+
'secp256k1',
7376
# https://github.com/kivy/python-for-android/issues/1404
7477
'cryptography',
7578
# https://github.com/kivy/python-for-android/issues/1294
7679
'ffmpeg', 'ffpyplayer',
77-
# https://github.com/kivy/python-for-android/pull/1307 ?
78-
'gevent',
7980
'icu',
8081
# https://github.com/kivy/python-for-android/issues/1354
8182
'kivent_core', 'kivent_cymunk', 'kivent_particles', 'kivent_polygen',

pythonforandroid/recipes/gevent/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55

66
class GeventRecipe(CythonRecipe):
7-
version = '1.3.7'
7+
version = '1.4.0'
88
url = 'https://pypi.python.org/packages/source/g/gevent/gevent-{version}.tar.gz'
99
depends = ['librt', 'greenlet']
1010
patches = ["cross_compiling.patch"]

pythonforandroid/recipes/pycryptodome/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33

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

tests/test_logger.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import unittest
2+
from mock import MagicMock
3+
from pythonforandroid import logger
4+
5+
6+
class TestShprint(unittest.TestCase):
7+
8+
def test_unicode_encode(self):
9+
"""
10+
Makes sure `shprint()` can handle unicode command output.
11+
Running the test with PYTHONIOENCODING=ASCII env would fail, refs:
12+
https://github.com/kivy/python-for-android/issues/1654
13+
"""
14+
expected_command_output = ["foo\xa0bar"]
15+
command = MagicMock()
16+
command.return_value = expected_command_output
17+
output = logger.shprint(command, 'a1', k1='k1')
18+
self.assertEqual(output, expected_command_output)

0 commit comments

Comments
 (0)