8000 Merge branch 'master' of https://github.com/kivy/python-for-android i… · opacam/python-for-android@eeae510 · GitHub
[go: up one dir, main page]

Skip to content

Commit eeae510

Browse files
author
Pol Canelles
committed
Merge branch 'master' of https://github.com/kivy/python-for-android into update-python-base
# Solved Conflicts: # pythonforandroid/recipes/python2/__init__.py
2 parents a336684 + 1a5ae1d commit eeae510

File tree

30 files changed

+625
-304
lines changed

30 files changed

+625
-304
lines changed

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Broad goals of the revamp project include:
2626
multiple graphics backends or non-Kivy projects)
2727
- ✓ Support python3 (it finally works!)
2828
- (WIP) Support some kind of binary distribution, including on windows (semi-implemented, just needs finishing)
29-
- ✓ Be a standalone Pypi module (not on pypi yet but setup.py works)
29+
- ✓ Be a standalone PyPI module (now available on PyPI!)
3030
- ✓ Support multiple architectures (full multiarch builds not complete, but arm and x86 with different config both work now)
3131

3232
We are currently working to stabilise all parts of the toolchain and
@@ -43,9 +43,13 @@ branch.
4343

4444
Follow the
4545
[quickstart instructions](https://python-for-android.readthedocs.org/en/latest/quickstart/)
46-
to install and begin creating APK.
46+
to install and begin creating APKs.
4747

48-
Quick instructions to start would be:
48+
Quick instructions to start would be::
49+
50+
pip install python-for-android
51+
52+
or to test the master branch::
4953

5054
pip install git+https://github.com/kivy/python-for-android.git
5155

doc/Makefile

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

44
# You can set these variables from the command line.
55
SPHINXOPTS =
6-
SPHINXBUILD = sphinx-build2
6+
SPHINXBUILD = sphinx-build
77
PAPER =
88
BUILDDIR = build
99

doc/source/apis.rst

Lines changed: 33 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -3,42 +3,36 @@ Accessing Android APIs
33
======================
44

55
When writing an Android application you may want to access the normal
6-
Android APIs, which are available in Java. It is by calling these that
7-
you would normally accomplish everything from vibration, to opening
8-
other applications, to accessing sensor data, to controlling settings
9-
like screen orientation and wakelocks.
10-
11-
These APIs can be accessed from Python to perform all of these tasks
12-
and many more. This is made possible by the `Pyjnius
13-
<http://pyjnius.readthedocs.org/en/latest/>`_ module, a Python
14-
library for automatically wrapping Java and making it callable from
15-
Python code. This is fairly simple to use, though not very Pythonic
16-
and inherits Java's verbosity. For this reason the Kivy organisation
17-
also created `Plyer <https://plyer.readthedocs.org/en/latest/>`_,
18-
which further wraps specific APIs in a Pythonic and cross-platform
19-
way - so in fact you can call the same code in Python but have it do
20-
the right thing also on platforms other than Android.
21-
22-
These are both independent projects whose documentation is linked
23-
above, and you can check this to learn about all the things they can
24-
do. The following sections give some simple introductory examples,
25-
along with explanation of how to include these modules in your APKs.
6+
Android Java APIs, in order to control your application's appearance
7+
(fullscreen, orientation etc.), interact with other apps or use
8+
hardware like vibration and sensors.
9+
10+
You can access these with `Pyjnius
11+
<http://pyjnius.readthedocs.org/en/latest/>`_, a Python library for
12+
automatically wrapping Java and making it callable from Python
13+
code. Pyjnius is fairly simple to use, but not very Pythonic and it
14+
inherits Java's verbosity. For this reason the Kivy organisation also
15+
created `Plyer <https://plyer.readthedocs.org/en/latest/>`_, which
16+
further wraps specific APIs in a Pythonic and cross-platform way; you
17+
can call the same code in Python but have it do the right thing also
18+
on platforms other than Android.
19+
20+
Pyjnius and Plyer are independent projects whose documentation is
21+
linked above. See below for some simple introductory examples, and
22+
explanation of how to include these modules in your APKs.
2623

2724

2825
Using Pyjnius
2926
-------------
3027

31-
Pyjnius lets you call the Android API directly from Python; this let's
32-
you do almost everything you can (and probably would) do in a Java
33-
app. Pyjnius is works by dynamically wrapping Java classes, so you
34-
don't have to wait for any particular feature to be pre-supported.
28+
Pyjnius lets you call the Android API directly from Python Pyjnius is
29+
works by dynamically wrapping Java classes, so you don't have to wait
30+
for any particular feature to be pre-supported.
3531

36-
You can include Pyjnius in your APKs by adding the `pyjnius` or
37-
`pyjniussdl2` recipes to your build requirements (the former works
38-
with Pygame/SDL1, the latter with SDL2, the need to make this choice
39-
will be removed later when pyjnius internally supports multiple
40-
Android backends). It is automatically included in any APK containing
41-
Kivy, in which case you don't need to specify it manually.
32+
You can include Pyjnius in your APKs by adding `pyjnius` to your build
33+
requirements, e.g. :code:`--requirements=flask,pyjnius`. It is
34+
automatically included in any APK containing Kivy, in which case you
35+
don't need to specify it manually.
4236

4337
The basic mechanism of Pyjnius is the `autoclass` command, which wraps
4438
a Java class. For instance, here is the code to vibrate your device::
@@ -87,17 +81,16 @@ You can check the `Pyjnius documentation <Pyjnius_>`_ for further details.
8781
Using Plyer
8882
-----------
8983

90-
Plyer aims to provide a much less verbose, Pythonic wrapper to
91-
platform-specific APIs. Android is a supported platform, but it also
92-
supports iOS and desktop operating systems, with the idea that the
93-
same Plyer code would do the right thing on any of them, though Plyer
94-
is a work in progress and not all platforms support all Plyer calls
95-
yet. This is the disadvantage of Plyer, it does not support all APIs
96-
yet, but you can always Pyjnius to call anything that is currently
97-
missing.
84+
Plyer provides a much less verbose, Pythonic wrapper to
85+
platform-specific APIs. It supports Android as well as iOS and desktop
86+
operating systems, though plyer is a work in progress and not all
87+
platforms support all Plyer calls yet.
88+
89+
Plyer does not support all APIs yet, but you can always Pyjnius to
90+
call anything that is currently missing.
9891

9992
You can include Plyer in your APKs by adding the `Plyer` recipe to
100-
your build requirements. It is not included automatically.
93+
your build requirements, e.g. :code:`--requirements=plyer`.
10194

10295
You should check the `Plyer documentation <Plyer_>`_ for details of all supported
10396
facades (platform APIs), but as an example the following is how you
@@ -106,8 +99,4 @@ would achieve vibration as described in the Pyjnius section above::
10699
from plyer.vibrator import vibrate
107100
vibrate(10) # in Plyer, the argument is in seconds
108101

109-
This is obviously *much* less verbose!
110-
111-
.. warning:: At the time of writing, the Plyer recipe is not yet
112-
ported, and Plyer doesn't support SDL2. These issues will
113-
be fixed soon.
102+
This is obviously *much* less verbose than with Pyjnius!

doc/source/bootstraps.rst

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,16 @@
22
Bootstraps
33
==========
44

5+
This page is about creating new bootstrap backends. For build options
6+
of existing bootstraps (i.e. with SDL2, Pygame, Webview etc.), see
7+
:ref:`build options <bootstrap_build_options>`.
8+
59
python-for-android (p4a) supports multiple *bootstraps*. These fulfill a
610
similar role to recipes, but instead of describing how to compile a
711
specific module they describe how a full Android project may be put
812
together from a combination of individual recipes and other
913
components such as Android source code and various build files.
1014

11-
If you do not want to modify p4a, you don't need to worry about
12-
bootstraps, just make sure you specify what modules you want to use
13-
(or specify an existing bootstrap manually), and p4a will
14-
automatically build everything appropriately. The existing choices are
15-
explained on the :ref:`build options <bootstrap_build_options>` page.
16-
1715
This page describes the basics of how bootstraps work so that you can
1816
create and use your own if you like, making it easy to build new kinds
1917
of Python project for Android.

doc/source/index.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ Contents
2828

2929
quickstart
3030
buildoptions
31-
installation
3231
commands
3332
recipes
3433
bootstraps
34+
services
3535
apis
3636
troubleshooting
3737
contribute
@@ -44,4 +44,3 @@ Indices and tables
4444
* :ref:`genindex`
4545
* :ref:`modindex`
4646
* :ref:`search`
47-

0 commit comments

Comments
 (0)
0