Skip to content

Commit

Permalink
Let Setup do the setting up.
Browse files Browse the repository at this point in the history
Use modern Python build tools.

Remove unnecessary prep from IOS too

Removed py3 special case for tox

Add ios version

Non-editable installs

More

Copy edits
  • Loading branch information
Julian-O committed Sep 10, 2023
1 parent 4033c90 commit b240482
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 45 deletions.
18 changes: 4 additions & 14 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on: [push, pull_request]
env:
PYTHONFORANDROID_PREREQUISITES_INSTALL_INTERACTIVE: 0

name: Android
name: Android Integration
jobs:
Integration:
strategy:
Expand All @@ -20,29 +20,19 @@ jobs:
- uses: actions/checkout@v2
- name: Setup environment
run: |
pip install -e .
pip install Cython==0.29.36
pip install .
- run: buildozer --help
- run: buildozer init
- name: SDK, NDK and p4a download
run: |
sed -i.bak "s/# android.accept_sdk_license = False/android.accept_sdk_license = True/" buildozer.spec
sed -i.bak "s/#p4a.branch = master/p4a.branch = develop/" buildozer.spec
buildozer android p4a -- --help
# Install OS specific dependencies
- name: Install Linux dependencies
if: matrix.os == 'ubuntu-latest'
run: sudo apt -y install automake
- name: Install macOS dependencies
if: matrix.os == 'macOS-latest'
run: |
brew install automake
sudo ln -sfn /usr/local/opt/openssl /usr/local/ssl
- name: buildozer android debug
- name: Debug Build
run: |
touch main.py
buildozer android debug
- name: buildozer android release (aab)
- name: Release Build (aab)
run: |
touch main.py
export BUILDOZER_ALLOW_ORG_TEST_DOMAIN=1
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ jobs:
run: |
source .ci/osx_ci.sh
arm64_set_path_and_python_version ${{ matrix.python }}
pip install -e .
pip install Cython==0.29.36 cookiecutter pbxproj
pip install .[ios]
- name: Check buildozer installation
run: |
source .ci/osx_ci.sh
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pypi-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: 3.x
- name: Install dependencies
- name: Install build dependencies
run: |
python -m pip install --upgrade setuptools wheel twine
python -m pip install --upgrade setuptools wheel twine build
- name: Build
run: |
python setup.py sdist bdist_wheel
python -m build
twine check dist/*
- name: Publish package
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,6 @@ WORKDIR ${WORK_DIR}
COPY --chown=user:user . ${SRC_DIR}

# installs buildozer and dependencies
RUN pip3 install --user --upgrade Cython==0.29.36 wheel pip virtualenv ${SRC_DIR}
RUN pip3 install --user --upgrade Cython<3.0 wheel pip ${SRC_DIR}

ENTRYPOINT ["buildozer"]
32 changes: 18 additions & 14 deletions docs/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,37 @@
Installation
============

Buildozer is tested on Python 3.8 and above but may work on
earlier versions, back to Python 3.3.
Depending the platform you want to target, you might need more tools installed.
Buildozer tries to give you hints or tries to install few things for
Depending the platform you want to target, you might need a few dependencies installed.
Buildozer tries to give you hints and tries to install few things for
you, but it doesn't cover every situation.

First, install the buildozer project with::
Buildozer is tested on Python 3.8 and above.

pip3 install --user --upgrade buildozer

Targeting Android
-----------------

Android on Ubuntu 20.04 and 22.04 (64bit)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

(expected to work as well in later version, but only regularly tested in the latest LTS)
(Buildozer is expected to work in later versions of Ubuntu, but it is only regularly tested on the latest LTS version
of Ubuntu.)

::

sudo apt update
sudo apt install -y git zip unzip openjdk-17-jdk python3-pip autoconf libtool pkg-config zlib1g-dev libncurses5-dev libncursesw5-dev libtinfo5 cmake libffi-dev libssl-dev
pip3 install --user --upgrade Cython==0.29.33 virtualenv # the --user should be removed if you do this in a venv

# add the following line at the end of your ~/.bashrc file
export PATH=$PATH:~/.local/bin/
If openjdk-17 is not compatible with other installed programs, for Buildozer the minimum compatible openjdk version is 11.

Then install the buildozer project with::

pip3 install --user --upgrade buildozer


Android on Windows 10 or 11
~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand All @@ -40,6 +42,10 @@ These instructions were tested with WSL 1 and Ubuntu 18.04 LTS, and WSL2 with Ub

After installing WSL and Ubuntu on your Windows machine, open Ubuntu, run the commands listed in the previous section, and restart your WSL terminal to enable the path change.

Install the buildozer project with::

pip3 install --user --upgrade buildozer

Copy your Kivy project directory from the Windows partition to the WSL partition, and follow the Quickstart Instructions. **Do not** change to the project directory on the Windows partition and build there, this may give unexpected and obscure fails.

For debugging, WSL does not have direct access to USB. Copy the .apk file to the Windows partition and run ADB (Android Debug Bridge) from a Windows prompt. ADB is part of Android Studio, if you do not have this installed you can install just the platform tools which also contain ADB.
Expand All @@ -51,7 +57,7 @@ For debugging, WSL does not have direct access to USB. Copy the .apk file to the
Before Using Buildozer
~~~~~~~~~~~~~~~~~~~~~~

If you wish, clone your code to a new folder, where the build process will run.
If you wish, clone your code to a new folder where the build process will run.

You don't need to create a virtualenv for your code requirements. But just add these requirements to a configuration file called buildozer.spec as you will see in the following sections.

Expand All @@ -62,7 +68,7 @@ Android on macOS

::

python3 -m pip install --user --upgrade Cython==0.29.33 virtualenv # the --user should be removed if you do this in a venv
python3 -m pip install --user --upgrade buildozer # the --user should be removed if you do this in a venv


TroubleShooting
Expand Down Expand Up @@ -97,16 +103,14 @@ Targeting IOS

Install XCode and command line tools (through the AppStore)


Install homebrew (https://brew.sh)

::

brew install pkg-config sdl2 sdl2_image sdl2_ttf sdl2_mixer gstreamer autoconf automake


Install pip and virtualenv
Install Buildozer and its ios dependencies

::

python3 -m pip install --user --upgrade pip virtualenv kivy-ios
python3 -m pip install --user --upgrade buildozer[ios]
22 changes: 17 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
sys.exit(1)



def find_version(*file_paths):
# Open in Latin-1 so that we avoid encoding errors.
# Use codecs.open for Python 2 compatibility
Expand Down Expand Up @@ -61,20 +60,33 @@ def find_version(*file_paths):
license='MIT',
packages=[
'buildozer', 'buildozer.targets', 'buildozer.libs', 'buildozer.scripts'
],
],
package_data={'buildozer': ['default.spec']},
include_package_data=True,
install_requires=['pexpect', 'virtualenv', 'sh'],
install_requires=[
'pexpect',
# Cython is required by both kivy-ios and python-for-android.
# However, python-for-android does not include it in its dependencies
# and kivy-ios's dependencies are not always checked, so it is included
# here.
# Restricted version because python-for-android's recipes can't handle
# later versions.
'cython<3.0'
],
extras_require={
'test': ['pytest'],
'docs': ['sphinx'],
'ios': ['kivy-ios'],
},
classifiers=[
'Development Status :: 5 - Production/Stable',
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Topic :: Software Development :: Build Tools',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',

],
entry_points={
'console_scripts': [
Expand Down
9 changes: 3 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
[tox]
envlist = pep8,py3
envlist = pep8

[testenv]
deps =
pytest
py3: coverage
commands = pytest tests/

[testenv:py3]
# for py3 env we will get code coverage
coverage
commands =
pytest tests/
coverage run --branch --source=buildozer -m pytest {posargs:tests/}
coverage report -m

Expand Down

0 comments on commit b240482

Please sign in to comment.