Skip to content

Commit e0dfdc3

Browse files
authored
Merge branch 'master' into enhance-rebuild-recipes
2 parents c4424cf + db53ef6 commit e0dfdc3

File tree

199 files changed

+8185
-3649
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

199 files changed

+8185
-3649
lines changed

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ services:
66
- docker
77

88
before_install:
9-
- sudo apt update -qq
10-
- sudo apt install -qq --no-install-recommends python2.7 python3
9+
- travis_retry sudo apt update -qq
10+
- travis_retry sudo apt install -qq --no-install-recommends python2.7 python3
1111
- sudo pip install tox>=2.0
1212
# https://github.com/travis-ci/travis-ci/issues/6069#issuecomment-266546552
1313
- git remote set-branches --add origin master
@@ -31,5 +31,5 @@ before_script:
3131
- tox
3232

3333
script:
34-
- docker build --tag=p4a --file Dockerfile.py2 .
34+
- docker build --tag=p4a --file Dockerfile.py3 .
3535
- docker run p4a /bin/sh -c "$COMMAND"

Dockerfile.py2

Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
# - python-for-android dependencies
44
#
55
# Build with:
6-
# docker build --tag=p4a --file Dockerfile.py2 .
6+
# docker build --tag=p4apy2 --file Dockerfile.py2 .
77
#
88
# Run with:
9-
# docker run -it --rm p4a /bin/sh -c '. venv/bin/activate && p4a apk --help'
9+
# docker run -it --rm p4apy2 /bin/sh -c '. venv/bin/activate && p4a apk --help'
1010
#
1111
# Or for interactive shell:
12-
# docker run -it --rm p4a
12+
# docker run -it --rm p4apy2
1313
#
1414
# Note:
1515
# Use 'docker run' without '--rm' flag for keeping the container and use
@@ -19,11 +19,23 @@ 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 \
23-
&& apt -y install -qq --no-install-recommends curl unzip \
24-
&& apt -y autoremove \
25-
&& apt -y clean
31+
&& apt -y install -qq --no-install-recommends curl unzip ca-certificates \
32+
&& apt -y autoremove
2633

34+
# retry helper script, refs:
35+
# https://github.com/kivy/python-for-android/issues/1306
36+
ENV RETRY="retry -t 3 --"
37+
RUN curl https://raw.githubusercontent.com/kadwanev/retry/1.0.1/retry \
38+
--output /usr/local/bin/retry && chmod +x /usr/local/bin/retry
2739

2840
ENV ANDROID_NDK_HOME="${ANDROID_HOME}/android-ndk"
2941
ENV ANDROID_NDK_VERSION="17c"
@@ -34,7 +46,7 @@ ENV ANDROID_NDK_ARCHIVE="android-ndk-r${ANDROID_NDK_VERSION}-linux-x86_64.zip"
3446
ENV ANDROID_NDK_DL_URL="https://dl.google.com/android/repository/${ANDROID_NDK_ARCHIVE}"
3547

3648
# download and install Android NDK
37-
RUN curl --location --progress-bar --insecure \
49+
RUN ${RETRY} curl --location --progress-bar --insecure \
3850
"${ANDROID_NDK_DL_URL}" \
3951
--output "${ANDROID_NDK_ARCHIVE}" \
4052
&& mkdir --parents "${ANDROID_NDK_HOME_V}" \
@@ -47,11 +59,12 @@ ENV ANDROID_SDK_HOME="${ANDROID_HOME}/android-sdk"
4759

4860
# get the latest version from https://developer.android.com/studio/index.html
4961
ENV ANDROID_SDK_TOOLS_VERSION="3859397"
62+
ENV ANDROID_SDK_BUILD_TOOLS_VERSION="26.0.2"
5063
ENV ANDROID_SDK_TOOLS_ARCHIVE="sdk-tools-linux-${ANDROID_SDK_TOOLS_VERSION}.zip"
5164
ENV ANDROID_SDK_TOOLS_DL_URL="https://dl.google.com/android/repository/${ANDROID_SDK_TOOLS_ARCHIVE}"
5265

5366
# download and install Android SDK
54-
RUN curl --location --progress-bar --insecure \
67+
RUN ${RETRY} curl --location --progress-bar --insecure \
5568
"${ANDROID_SDK_TOOLS_DL_URL}" \
5669
--output "${ANDROID_SDK_TOOLS_ARCHIVE}" \
5770
&& mkdir --parents "${ANDROID_SDK_HOME}" \
@@ -64,16 +77,14 @@ RUN mkdir --parents "${ANDROID_SDK_HOME}/.android/" \
6477
> "${ANDROID_SDK_HOME}/.android/repositories.cfg"
6578

6679
# accept Android licenses (JDK necessary!)
67-
RUN apt -y update -qq \
68-
&& apt -y install -qq --no-install-recommends openjdk-8-jdk \
69-
&& apt -y autoremove \
70-
&& apt -y clean
71-
RUN yes | "${ANDROID_SDK_HOME}/tools/bin/sdkmanager" --licenses > /dev/null
80+
RUN ${RETRY} apt -y install -qq --no-install-recommends openjdk-8-jdk \
81+
&& apt -y autoremove
82+
RUN yes | "${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "build-tools;${ANDROID_SDK_BUILD_TOOLS_VERSION}" > /dev/null
7283

7384
# download platforms, API, build tools
7485
RUN "${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "platforms;android-19" && \
7586
"${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "platforms;android-27" && \
76-
"${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "build-tools;26.0.2" && \
87+
"${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "build-tools;${ANDROID_SDK_BUILD_TOOLS_VERSION}" && \
7788
chmod +x "${ANDROID_SDK_HOME}/tools/bin/avdmanager"
7889

7990

@@ -83,27 +94,23 @@ ENV WORK_DIR="${HOME_DIR}" \
8394
PATH="${HOME_DIR}/.local/bin:${PATH}"
8495

8596
# install system dependencies
86-
RUN apt -y update -qq \
87-
&& apt -y install -qq --no-install-recommends \
97+
RUN ${RETRY} apt -y install -qq --no-install-recommends \
8898
python virtualenv python-pip wget lbzip2 patch sudo \
89-
&& apt -y autoremove \
90-
&& apt -y clean
99+
&& apt -y autoremove
91100

92101
# build dependencies
93102
# https://buildozer.readthedocs.io/en/latest/installation.html#android-on-ubuntu-16-04-64bit
94103
RUN dpkg --add-architecture i386 \
95-
&& apt -y update -qq \
96-
&& apt -y install -qq --no-install-recommends \
104+
&& ${RETRY} apt -y update -qq \
105+
&& ${RETRY} apt -y install -qq --no-install-recommends \
97106
build-essential ccache git python2.7 python2.7-dev \
98107
libncurses5:i386 libstdc++6:i386 libgtk2.0-0:i386 \
99108
libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 \
100109
zip zlib1g-dev zlib1g:i386 \
101-
&& apt -y autoremove \
102-
&& apt -y clean
110+
&& apt -y autoremove
103111

104112
# specific recipes dependencies (e.g. libffi requires autoreconf binary)
105-
RUN apt -y update -qq \
106-
&& apt -y install -qq --no-install-recommends \
113+
RUN ${RETRY} apt -y install -qq --no-install-recommends \
107114
libffi-dev autoconf automake cmake gettext libltdl-dev libtool pkg-config \
108115
&& apt -y autoremove \
109116
&& apt -y clean
@@ -120,10 +127,8 @@ RUN echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
120127
RUN pip install --upgrade cython==0.28.6
121128

122129
WORKDIR ${WORK_DIR}
123-
COPY . ${WORK_DIR}
124-
125-
# user needs ownership/write access to these directories
126-
RUN chown --recursive ${USER} ${WORK_DIR} ${ANDROID_SDK_HOME}
130+
COPY --chown=user:user . ${WORK_DIR}
131+
RUN chown --recursive ${USER} ${ANDROID_SDK_HOME}
127132
USER ${USER}
128133

129134
# install python-for-android from current branch

Dockerfile.py3

Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
# - python-for-android dependencies
44
#
55
# Build with:
6-
# docker build --tag=p4apy3 .
6+
# 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:
12-
# docker run -it --rm p4apy3
12+
# docker run -it --rm p4a
1313
#
1414
# Note:
1515
# Use 'docker run' without '--rm' flag for keeping the container and use
@@ -19,11 +19,23 @@ 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 \
23-
&& apt -y install -qq --no-install-recommends curl unzip \
24-
&& apt -y autoremove \
25-
&& apt -y clean
31+
&& apt -y install -qq --no-install-recommends curl unzip ca-certificates \
32+
&& apt -y autoremove
2633

34+
# retry helper script, refs:
35+
# https://github.com/kivy/python-for-android/issues/1306
36+
ENV RETRY="retry -t 3 --"
37+
RUN curl https://raw.githubusercontent.com/kadwanev/retry/1.0.1/retry \
38+
--output /usr/local/bin/retry && chmod +x /usr/local/bin/retry
2739

2840
ENV ANDROID_NDK_HOME="${ANDROID_HOME}/android-ndk"
2941
ENV ANDROID_NDK_VERSION="17c"
@@ -34,7 +46,7 @@ ENV ANDROID_NDK_ARCHIVE="android-ndk-r${ANDROID_NDK_VERSION}-linux-x86_64.zip"
3446
ENV ANDROID_NDK_DL_URL="https://dl.google.com/android/repository/${ANDROID_NDK_ARCHIVE}"
3547

3648
# download and install Android NDK
37-
RUN curl --location --progress-bar --insecure \
49+
RUN ${RETRY} curl --location --progress-bar --insecure \
3850
"${ANDROID_NDK_DL_URL}" \
3951
--output "${ANDROID_NDK_ARCHIVE}" \
4052
&& mkdir --parents "${ANDROID_NDK_HOME_V}" \
@@ -47,11 +59,12 @@ ENV ANDROID_SDK_HOME="${ANDROID_HOME}/android-sdk"
4759

4860
# get the latest version from https://developer.android.com/studio/index.html
4961
ENV ANDROID_SDK_TOOLS_VERSION="3859397"
62+
ENV ANDROID_SDK_BUILD_TOOLS_VERSION="26.0.2"
5063
ENV ANDROID_SDK_TOOLS_ARCHIVE="sdk-tools-linux-${ANDROID_SDK_TOOLS_VERSION}.zip"
5164
ENV ANDROID_SDK_TOOLS_DL_URL="https://dl.google.com/android/repository/${ANDROID_SDK_TOOLS_ARCHIVE}"
5265

5366
# download and install Android SDK
54-
RUN curl --location --progress-bar --insecure \
67+
RUN ${RETRY} curl --location --progress-bar --insecure \
5568
"${ANDROID_SDK_TOOLS_DL_URL}" \
5669
--output "${ANDROID_SDK_TOOLS_ARCHIVE}" \
5770
&& mkdir --parents "${ANDROID_SDK_HOME}" \
@@ -64,16 +77,14 @@ RUN mkdir --parents "${ANDROID_SDK_HOME}/.android/" \
6477
> "${ANDROID_SDK_HOME}/.android/repositories.cfg"
6578

6679
# accept Android licenses (JDK necessary!)
67-
RUN apt -y update -qq \
68-
&& apt -y install -qq --no-install-recommends openjdk-8-jdk \
69-
&& apt -y autoremove \
70-
&& apt -y clean
71-
RUN yes | "${ANDROID_SDK_HOME}/tools/bin/sdkmanager" --licenses > /dev/null
80+
RUN ${RETRY} apt -y install -qq --no-install-recommends openjdk-8-jdk \
81+
&& apt -y autoremove
82+
RUN yes | "${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "build-tools;${ANDROID_SDK_BUILD_TOOLS_VERSION}" > /dev/null
7283

7384
# download platforms, API, build tools
7485
RUN "${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "platforms;android-19" && \
7586
"${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "platforms;android-27" && \
76-
"${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "build-tools;26.0.2" && \
87+
"${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "build-tools;${ANDROID_SDK_BUILD_TOOLS_VERSION}" && \
7788
chmod +x "${ANDROID_SDK_HOME}/tools/bin/avdmanager"
7889

7990

@@ -83,27 +94,23 @@ ENV WORK_DIR="${HOME_DIR}" \
8394
PATH="${HOME_DIR}/.local/bin:${PATH}"
8495

8596
# install system dependencies
86-
RUN apt -y update -qq \
87-
&& apt -y install -qq --no-install-recommends \
97+
RUN ${RETRY} apt -y install -qq --no-install-recommends \
8898
python3 virtualenv python3-pip wget lbzip2 patch sudo \
89-
&& apt -y autoremove \
90-
&& apt -y clean
99+
&& apt -y autoremove
91100

92101
# build dependencies
93102
# https://buildozer.readthedocs.io/en/latest/installation.html#android-on-ubuntu-16-04-64bit
94103
RUN dpkg --add-architecture i386 \
95-
&& apt -y update -qq \
96-
&& apt -y install -qq --no-install-recommends \
104+
&& ${RETRY} apt -y update -qq \
105+
&& ${RETRY} apt -y install -qq --no-install-recommends \
97106
build-essential ccache git python3 python3-dev \
98107
libncurses5:i386 libstdc++6:i386 libgtk2.0-0:i386 \
99108
libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 \
100109
zip zlib1g-dev zlib1g:i386 \
101-
&& apt -y autoremove \
102-
&& apt -y clean
110+
&& apt -y autoremove
103111

104112
# specific recipes dependencies (e.g. libffi requires autoreconf binary)
105-
RUN apt -y update -qq \
106-
&& apt -y install -qq --no-install-recommends \
113+
RUN ${RETRY} apt -y install -qq --no-install-recommends \
107114
libffi-dev autoconf automake cmake gettext libltdl-dev libtool pkg-config \
108115
&& apt -y autoremove \
109116
&& apt -y clean
@@ -120,10 +127,8 @@ RUN echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
120127
RUN pip3 install --upgrade cython==0.28.6
121128

122129
WORKDIR ${WORK_DIR}
123-
COPY . ${WORK_DIR}
124-
125-
# user needs ownership/write access to these directories
126-
RUN chown --recursive ${USER} ${WORK_DIR} ${ANDROID_SDK_HOME}
130+
COPY --chown=user:user . ${WORK_DIR}
131+
RUN chown --recursive ${USER} ${ANDROID_SDK_HOME}
127132
USER ${USER}
128133

129134
# install python-for-android from current branch

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ prune doc/build
77
recursive-include pythonforandroid *.py *.tmpl biglink liblink
88
recursive-include pythonforandroid/recipes *.py *.patch *.c *.pyx Setup *.h
99

10-
recursive-include pythonforandroid/bootstraps *.properties *.xml *.java *.tmpl *.txt *.png *.aidl *.py *.sh *.c *.h *.html
10+
recursive-include pythonforandroid/bootstraps *.properties *.xml *.java *.tmpl *.txt *.png *.aidl *.py *.sh *.c *.h *.html *.patch
1111

1212
prune .git
1313
prune pythonforandroid/bootstraps/pygame/build/libs

0 commit comments

Comments
 (0)