Skip to content

Commit bb9f067

Browse files
authored
Merge pull request #1457 from AndreMiras/feature/ci_improvements
Various CI improvements
2 parents 83eedc3 + 19d2de0 commit bb9f067

File tree

6 files changed

+30
-37
lines changed

6 files changed

+30
-37
lines changed

.travis.yml

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

88
before_install:
99
- sudo apt update -qq
10-
- sudo apt install -qq python2.7 python3
10+
- 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

Dockerfile

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
# Dockerfile with:
2-
# - Android build environment
3-
# - python-for-android dependencies
2+
# - Android build environment
3+
# - python-for-android dependencies
44
# Build with:
55
# docker build --tag=p4a .
66
# Run with:
77
# docker run p4a /bin/sh -c '. venv/bin/activate && p4a apk --help'
88
# Or for interactive shell:
99
# docker run -it --rm p4a
10-
#
11-
# TODO:
12-
# - delete archives to keep small the container small
13-
# - setup caching (for apt, pip, ndk, sdk and p4a recipes downloads)
1410
FROM ubuntu:18.04
1511

1612

@@ -27,35 +23,39 @@ ENV ANDROID_SDK_TOOLS_VERSION="3859397"
2723

2824
ENV ANDROID_HOME="/opt/android"
2925
ENV ANDROID_NDK_HOME="${ANDROID_HOME}/android-ndk" \
30-
CRYSTAX_NDK_HOME="${ANDROID_HOME}/crystax-ndk" \
31-
ANDROID_SDK_HOME="${ANDROID_HOME}/android-sdk"
26+
CRYSTAX_NDK_HOME="${ANDROID_HOME}/crystax-ndk" \
27+
ANDROID_SDK_HOME="${ANDROID_HOME}/android-sdk"
3228
ENV ANDROID_NDK_HOME_V="${ANDROID_NDK_HOME}-r${ANDROID_NDK_VERSION}" \
33-
CRYSTAX_NDK_HOME_V="${CRYSTAX_NDK_HOME}-${CRYSTAX_NDK_VERSION}"
29+
CRYSTAX_NDK_HOME_V="${CRYSTAX_NDK_HOME}-${CRYSTAX_NDK_VERSION}"
3430
ENV ANDROID_NDK_ARCHIVE="android-ndk-r${ANDROID_NDK_VERSION}-linux-x86_64.zip" \
35-
CRYSTAX_NDK_ARCHIVE="crystax-ndk-${CRYSTAX_NDK_VERSION}-linux-x86.tar.xz" \
36-
ANDROID_SDK_TOOLS_ARCHIVE="sdk-tools-linux-${ANDROID_SDK_TOOLS_VERSION}.zip"
31+
CRYSTAX_NDK_ARCHIVE="crystax-ndk-${CRYSTAX_NDK_VERSION}-linux-x86.tar.xz" \
32+
ANDROID_SDK_TOOLS_ARCHIVE="sdk-tools-linux-${ANDROID_SDK_TOOLS_VERSION}.zip"
3733
ENV ANDROID_NDK_DL_URL="https://dl.google.com/android/repository/${ANDROID_NDK_ARCHIVE}" \
38-
CRYSTAX_NDK_DL_URL="https://eu.crystax.net/download/${CRYSTAX_NDK_ARCHIVE}" \
39-
ANDROID_SDK_TOOLS_DL_URL="https://dl.google.com/android/repository/${ANDROID_SDK_TOOLS_ARCHIVE}"
34+
CRYSTAX_NDK_DL_URL="https://eu.crystax.net/download/${CRYSTAX_NDK_ARCHIVE}" \
35+
ANDROID_SDK_TOOLS_DL_URL="https://dl.google.com/android/repository/${ANDROID_SDK_TOOLS_ARCHIVE}"
4036

4137
# install system dependencies
4238
RUN apt update -qq && apt install -qq --yes --no-install-recommends \
43-
python virtualenv python-pip wget curl lbzip2 patch bsdtar sudo && \
39+
python virtualenv python-pip wget curl lbzip2 patch bsdtar sudo && \
4440
rm -rf /var/lib/apt/lists/*
4541

4642
# build dependencies
4743
# https://buildozer.readthedocs.io/en/latest/installation.html#android-on-ubuntu-16-04-64bit
48-
RUN dpkg --add-architecture i386 && apt update -qq && apt install -qq --yes --no-install-recommends \
49-
build-essential ccache git libncurses5:i386 libstdc++6:i386 libgtk2.0-0:i386 \
50-
libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 python2.7 python2.7-dev \
51-
openjdk-8-jdk unzip zlib1g-dev zlib1g:i386 && \
44+
RUN dpkg --add-architecture i386 && apt update -qq && apt install -qq --yes --no-install-recommends \
45+
build-essential ccache git libncurses5:i386 libstdc++6:i386 libgtk2.0-0:i386 \
46+
libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 python2.7 python2.7-dev \
47+
openjdk-8-jdk unzip zlib1g-dev zlib1g:i386
48+
49+
# specific recipes dependencies (e.g. libffi requires autoreconf binary)
50+
RUN apt install -qq --yes --no-install-recommends \
51+
autoconf automake cmake gettext libltdl-dev libtool pkg-config && \
5252
rm -rf /var/lib/apt/lists/*
5353

5454
# download and install Android NDK
5555
RUN curl --location --progress-bar "${ANDROID_NDK_DL_URL}" --output "${ANDROID_NDK_ARCHIVE}" && \
5656
mkdir --parents "${ANDROID_NDK_HOME_V}" && \
5757
unzip -q "${ANDROID_NDK_ARCHIVE}" -d "${ANDROID_HOME}" && \
58-
ln -sfn "${ANDROID_NDK_HOME_V}" "${ANDROID_NDK_HOME}" && \
58+
ln -sfn "${ANDROID_NDK_HOME_V}" "${ANDROID_NDK_HOME}" && \
5959
rm -rf "${ANDROID_NDK_ARCHIVE}"
6060

6161
# download and install CrystaX NDK
@@ -70,7 +70,7 @@ RUN curl --location --progress-bar "${CRYSTAX_NDK_DL_URL}" --output "${CRYSTAX_N
7070
--exclude=crystax-ndk-${CRYSTAX_NDK_VERSION}/toolchains/llvm-* \
7171
--exclude=crystax-ndk-${CRYSTAX_NDK_VERSION}/toolchains/aarch64-* \
7272
--exclude=crystax-ndk-${CRYSTAX_NDK_VERSION}/toolchains/mips64el-* && \
73-
ln -sfn "${CRYSTAX_NDK_HOME_V}" "${CRYSTAX_NDK_HOME}" && \
73+
ln -sfn "${CRYSTAX_NDK_HOME_V}" "${CRYSTAX_NDK_HOME}" && \
7474
rm -rf "${CRYSTAX_NDK_ARCHIVE}"
7575

7676
# download and install Android SDK
@@ -81,7 +81,7 @@ RUN curl --location --progress-bar "${ANDROID_SDK_TOOLS_DL_URL}" --output "${AND
8181

8282
# update Android SDK, install Android API, Build Tools...
8383
RUN mkdir --parents "${ANDROID_SDK_HOME}/.android/" && \
84-
echo '### User Sources for Android SDK Manager' > "${ANDROID_SDK_HOME}/.android/repositories.cfg"
84+
echo '### User Sources for Android SDK Manager' > "${ANDROID_SDK_HOME}/.android/repositories.cfg"
8585
RUN yes | "${ANDROID_SDK_HOME}/tools/bin/sdkmanager" --licenses
8686
RUN "${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "platforms;android-19" && \
8787
"${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "platforms;android-27" && \
@@ -93,7 +93,7 @@ RUN useradd --create-home --shell /bin/bash ${USER}
9393
# with sudo access and no password
9494
RUN usermod -append --groups sudo ${USER}
9595
RUN echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
96-
RUN pip install --quiet --upgrade cython==0.21
96+
RUN pip install --quiet --upgrade Cython==0.28.6
9797
WORKDIR ${WORK_DIR}
9898
COPY . ${WORK_DIR}
9999
# user needs ownership/write access to these directories

ci/constants.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,25 +29,15 @@ class TargetPython(Enum):
2929
# https://github.com/kivy/python-for-android/issues/1354
3030
'kivent_core', 'kivent_cymunk', 'kivent_particles', 'kivent_polygen',
3131
'kiwisolver',
32-
# system dependencies autoconf, libtool
33-
'libexpat',
34-
'libgeos',
3532
# https://github.com/kivy/python-for-android/issues/1399
3633
'libglob',
37-
# system dependencies cmake and compile error
3834
'libmysqlclient',
3935
'libsecp256k1',
4036
'libtribler',
41-
# system dependencies gettext, pkg-config
42-
'libzbar',
4337
'ndghttpsclient',
4438
'm2crypto',
4539
'netifaces',
4640
'Pillow',
47-
# requires autoconf system dependency on host
48-
# https://api.travis-ci.org/v3/job/450538715/log.txt
49-
'protobuf_cpp',
50-
'cffi',
5141
# https://github.com/kivy/python-for-android/issues/1405
5242
'psycopg2',
5343
'pygame',
@@ -93,8 +83,6 @@ class TargetPython(Enum):
9383
'icu',
9484
# https://github.com/kivy/python-for-android/issues/1354
9585
'kivent_core', 'kivent_cymunk', 'kivent_particles', 'kivent_polygen',
96-
# system dependencies autoconf, libtool
97-
'libexpat',
9886
# https://github.com/kivy/python-for-android/issues/1405
9987
'libpq', 'psycopg2',
10088
'netifaces',

pythonforandroid/recipe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,7 @@ def install_python_package(self, arch, name=None, env=None, is_dir=True):
789789
hostpython = sh.Command(self.hostpython_location)
790790

791791
if (self.ctx.python_recipe.from_crystax or
792-
self.ctx.python_recipe.name == 'python3'):
792+
self.ctx.python_recipe.name == 'python3'):
793793
hpenv = env.copy()
794794
shprint(hostpython, 'setup.py', 'install', '-O2',
795795
'--root={}'.format(self.ctx.get_python_install_dir()),

pythonforandroid/recipes/libffi/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66

77

88
class LibffiRecipe(Recipe):
9+
"""
10+
Requires additional system dependencies on Ubuntu:
11+
- `automake` for the `aclocal` binary
12+
- `autoconf` for the `autoreconf` binary
13+
- `libltdl-dev` which defines the `LT_SYS_SYMBOL_USCORE` macro
14+
"""
915
name = 'libffi'
1016
version = 'v3.2.1'
1117
url = 'https://github.com/atgreen/libffi/archive/{version}.zip'

tox.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ commands = flake8 pythonforandroid/ tests/ ci/
1717
ignore =
1818
E123, E124, E126,
1919
E226,
20-
E129,
2120
E402, E501, E722,
2221
F812, F841, W503,
2322
W504

0 commit comments

Comments
 (0)