Skip to content

Rebase Python3 Branch #323

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 85 commits into from
Mar 4, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
b1ba8dc
Introduce method `get_keyboard_height` that returns current softkeyboard
akshayaurora Feb 12, 2014
df55cf7
Listen to chnages in the gloabal layout for figuring out when the
akshayaurora Feb 26, 2014
db9c2f8
fix service handling
kived Mar 14, 2014
9ab3ee0
sdlsurfaceview: fix npot usage on some device in splashscreen.
tito Apr 8, 2014
ec8d54b
use $CYTHON="cython -t" for all recipes that used cython. This doesnt…
tito Apr 12, 2014
b0633e1
added recipe for kivent
Kovak Apr 14, 2014
3514a81
heartbleed fix
cbenhagen Apr 27, 2014
a5b9435
Merge pull request #230 from cbenhagen/patch-1
tito Apr 29, 2014
ce48650
Merge pull request #224 from inclement/pep8
tito Apr 29, 2014
1b55914
Merge pull request #205 from kivy/keyboard_height
tito May 3, 2014
1dce664
Update examples.rst
trivedigaurav May 20, 2014
98e58da
Merge pull request #240 from trivedigaurav/patch-1
akshayaurora May 21, 2014
b19558f
Added psutil recipe
devpack May 26, 2014
2180e80
Merge pull request #243 from devpack/psutil-recipe
tito May 27, 2014
612ae26
Changed a tiny grammatical error
May 28, 2014
8889330
Fixed a tiny misspelling.
May 28, 2014
db5a7bb
fix pycrypto recipe; add recipe for apsw
Jun 3, 2014
a9d424f
Merge pull request #248 from wjanssen/master
akshayaurora Jun 9, 2014
a5a6b41
Merge pull request #246 from metalgeek/patch-2
inclement Jun 13, 2014
7e8387d
Merge pull request #245 from metalgeek/patch-1
inclement Jun 13, 2014
08b959e
changed script to work with env variable.
knappador Jun 18, 2014
aa38c6b
use shell as default for argparse. modified template to not use
knappador Jun 18, 2014
e06ea42
android: fix broadcast context
tito Jun 19, 2014
80eb744
Merge branch 'master' of github.com:kivy/python-for-android
tito Jun 19, 2014
162edb2
added polygon recipe
chozabu Jul 3, 2014
aab6001
Merge branch 'master' of github.com:chozabu/python-for-android
chozabu Jul 3, 2014
71af4d8
Fix spelling
trivedigaurav Jul 15, 2014
6f37a92
added libswift recipe
lfdversluis Jul 16, 2014
ae125f3
Added M2Crypto recipe
lfdversluis Jul 16, 2014
09c73e0
added Netifaces recipe
lfdversluis Jul 16, 2014
68a6d6c
added swift recipe
lfdversluis Jul 16, 2014
5a56c8c
Updated twisted to 14.0.0
lfdversluis Jul 16, 2014
3c669dc
Merge pull request #253 from trivedigaurav/patch-2
akshayaurora Jul 16, 2014
19aa462
skip biglink for jb 4.3
kived Aug 1, 2014
22afe4c
Add LinuxMint
mariogrip Aug 2, 2014
05cb347
Merge pull request #259 from mariogrip/patch-1
akshayaurora Aug 3, 2014
7606331
add libcopy for jb 4.3
kived Aug 18, 2014
2442091
android/sound: fix audio volume not implemented. Closes kivy/kivy#1869
tito Aug 23, 2014
5619ec2
added support for setting resources to add in strings.xml
excessivedemon Sep 3, 2014
7c6e1f5
Fix long filename support.
tito Sep 9, 2014
388b956
osx: try to fix _scproxy file when python-for-android is build on osx
tito Sep 9, 2014
22ad4d8
osx: specific fixes for osx and virtualenv
tito Sep 9, 2014
2e25a1b
Merge pull request #266 from excessivedemon/master
tito Sep 9, 2014
172f651
Merge pull request #252 from chozabu/master
tito Sep 9, 2014
50ec3b4
Merge pull request #254 from lfdversluis/master
tito Sep 9, 2014
766a8f6
Merge pull request #250 from knappador/fix_ANDROIDAPI
tito Sep 9, 2014
b65f355
Merge pull request #218 from kived/service-fix
tito Sep 9, 2014
a101685
rename option to copylibs and clean up
kived Sep 15, 2014
7a60a3a
fix help
kived Sep 15, 2014
ce41723
Merge pull request #258 from kived/jb-dlopen
kived Sep 15, 2014
3345c66
move parts of get_keyboard_height to global
chozabu Sep 23, 2014
6bd5837
Merge pull request #272 from chozabu/inputpull3
akshayaurora Sep 23, 2014
6a1b55f
make private service work (but only if there is no public folder)
kived Sep 24, 2014
acb84c4
Merge pull request #273 from kived/service-private
kived Sep 24, 2014
a1fbc82
fix django compilation. closes #231
tito Sep 30, 2014
730d560
Add support for NDK r10
rakesh-sankar Oct 1, 2014
51d961e
Merge pull request #274 from rakesh-sankar/master
tito Oct 5, 2014
473003e
fix twisted recipe
kived Oct 13, 2014
1f7f23f
Update toolchain.rst
Oct 14, 2014
ca6b48c
Update prerequisites.rst
Oct 14, 2014
2de18e6
Update usage.rst
Oct 14, 2014
e842e17
Added protobuf recipe
minou Oct 18, 2014
fc3def4
Add a storm/psycopg2 recipe
romaia Nov 1, 2014
067373b
add recipe for cprotobuf
yihuang Nov 5, 2014
c672cfc
Autodetect cython2 version
rdoursenaud Nov 6, 2014
e597be8
Merge pull request #296 from EMATech/cython-detect
tshirtman Nov 6, 2014
f0740c4
Fixes for #297
tito Nov 12, 2014
f1db05f
Merge pull request #298 from kivy/fix-297
tito Nov 12, 2014
9cbc78c
Merge pull request #295 from yihuang/master
tito Nov 15, 2014
e308111
Merge pull request #292 from romaia/storm
tito Nov 15, 2014
591724f
Merge pull request #287 from minou/master
tito Nov 15, 2014
31cacb0
Merge pull request #285 from jdruiter/patch-3
tito Nov 15, 2014
2f77865
Merge pull request #284 from jdruiter/patch-2
tito Nov 15, 2014
629ec1c
Merge pull request #283 from jdruiter/patch-1
tito Nov 15, 2014
ea42975
Merge pull request #282 from kived/twisted-fixes
tito Nov 15, 2014
1321842
Documentation grammar and spelling fixes
mivade Nov 27, 2014
03f3321
Merge pull request #303 from mivade/master
akshayaurora Nov 27, 2014
59b9095
provide api versions in android package
kived Dec 2, 2014
4e25e7f
Merge pull request #304 from kived/api_version
tito Dec 6, 2014
6c758d4
libyaml + pyyaml
mmariani Dec 27, 2014
f859330
actually raise an error if virtualenv or pip are missing
mmariani Dec 30, 2014
499dc48
Merge pull request #313 from mmariani/pyyaml
tito Dec 30, 2014
6c27ac9
Merge pull request #314 from mmariani/check-virtualenv-pip
tito Dec 30, 2014
462c12f
Made build.py compatible with python3
inclement Apr 7, 2014
8940bd9
Added Cast str to int in AndroidManifest.tmpl.xml to resolve this iss…
FeralBytes Feb 2, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 66 additions & 14 deletions distribute.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ if [ "X$VIRTUALENV_NAME" == "X" ]; then
VIRTUALENV_NAME="$(which virtualenv)"
fi

# Resolve Cython path
CYTHON="$(which cython2)"
if [ "X$CYTHON" == "X" ]; then
CYTHON="$(which cython)"
fi

# Paths
ROOT_PATH="$(dirname $($PYTHON -c 'from __future__ import print_function; import os,sys;print(os.path.realpath(sys.argv[1]))' $0))"
RECIPES_PATH="$ROOT_PATH/recipes"
Expand All @@ -54,13 +60,16 @@ JNI_PATH="$SRC_PATH/jni"
DIST_PATH="$ROOT_PATH/dist/default"
SITEPACKAGES_PATH="$BUILD_PATH/python-install/lib/python2.7/site-packages/"
HOSTPYTHON="$BUILD_PATH/python-install/bin/python.host"
CYTHON+=" -t"

# Tools
export LIBLINK_PATH="$BUILD_PATH/objects"
export LIBLINK="$ROOT_PATH/src/tools/liblink"
export BIGLINK="$ROOT_PATH/src/tools/biglink"
export PIP=$PIP_NAME
export VIRTUALENV=$VIRTUALENV_NAME
export PIP=${PIP_NAME:-pip}
export VIRTUALENV=${VIRTUALENV_NAME:-virtualenv}

export COPYLIBS=0

MD5SUM=$(which md5sum)
if [ "X$MD5SUM" == "X" ]; then
Expand Down Expand Up @@ -146,7 +155,7 @@ function get_directory() {
}

function push_arm() {
info "Entering in ARM enviromnent"
info "Entering in ARM environment"

# save for pop
export OLD_PATH=$PATH
Expand Down Expand Up @@ -189,8 +198,11 @@ function push_arm() {
export TOOLCHAIN_PREFIX=arm-linux-androideabi
export TOOLCHAIN_VERSION=4.4.3
elif [ "X${ANDROIDNDKVER:0:2}" == "Xr9" ]; then
export TOOLCHAIN_PREFIX=arm-linux-androideabi
export TOOLCHAIN_VERSION=4.8
export TOOLCHAIN_PREFIX=arm-linux-androideabi
export TOOLCHAIN_VERSION=4.8
elif [ "X${ANDROIDNDKVER:0:3}" == "Xr10" ]; then
export TOOLCHAIN_PREFIX=arm-linux-androideabi
export TOOLCHAIN_VERSION=4.9
else
echo "Error: Please report issue to enable support for newer ndk."
exit 1
Expand All @@ -216,6 +228,10 @@ function push_arm() {
export LD="$TOOLCHAIN_PREFIX-ld"
export STRIP="$TOOLCHAIN_PREFIX-strip --strip-unneeded"
export MAKE="make -j5"
export READELF="$TOOLCHAIN_PREFIX-readelf"

# This will need to be updated to support Python versions other than 2.7
export BUILDLIB_PATH="$BUILD_hostpython/build/lib.linux-`uname -m`-2.7/"

# Use ccache ?
which ccache &>/dev/null
Expand Down Expand Up @@ -252,6 +268,10 @@ function usage() {
echo " -f Restart from scratch (remove the current build)"
echo " -x display expanded values (execute 'set -x')"
echo
echo "Advanced:"
echo " -C Copy libraries instead of using biglink"
echo " (may not work before Android 4.3)"
echo
echo "For developers:"
echo " -u 'mod1 mod2' Modules to update (if already compiled)"
echo
Expand Down Expand Up @@ -279,7 +299,7 @@ function check_build_deps() {
DIST=$(lsb_release -is)
info "Check build dependencies for $DIST"
case $DIST in
Debian|Ubuntu)
Debian|Ubuntu|LinuxMint)
check_pkg_deb_installed "build-essential zlib1g-dev cython"
;;
*)
Expand Down Expand Up @@ -344,6 +364,15 @@ function run_prepare() {
fi
done

if [ "$COPYLIBS" == "1" ]; then
info "Library files will be copied to the distribution (no biglink)"
error "NOTICE: This option is still beta!"
error "\tIf you encounter an error 'Failed to locate needed libraries!' and"
error "\tthe libraries listed are not supposed to be provided by your app or"
error "\tits dependencies, please submit a bug report at"
error "\thttps://github.com/kivy/python-for-android/issues"
fi

info "Distribution will be located at $DIST_PATH"
if [ -e "$DIST_PATH" ]; then
error "The distribution $DIST_PATH already exist"
Expand Down Expand Up @@ -526,6 +555,10 @@ function run_get_packages() {
try mkdir -p $BUILD_PATH/$module
fi

if [ ! -d "$PACKAGES_PATH/$module" ]; then
try mkdir -p "$PACKAGES_PATH/$module"
fi

if [ "X$url" == "X" ]; then
debug "No package for $module"
continue
Expand All @@ -535,7 +568,7 @@ function run_get_packages() {
marker_filename=".mark-$filename"
do_download=1

cd $PACKAGES_PATH
cd "$PACKAGES_PATH/$module"

# check if the file is already present
if [ -f $filename ]; then
Expand Down Expand Up @@ -605,7 +638,7 @@ function run_get_packages() {
fi

# decompress
pfilename=$PACKAGES_PATH/$filename
pfilename=$PACKAGES_PATH/$module/$filename
info "Extract $pfilename"
case $pfilename in
*.tar.gz|*.tgz )
Expand Down Expand Up @@ -704,7 +737,7 @@ function run_pymodules_install() {
debug "We want to install: $PYMODULES"

debug "Check if $VIRTUALENV and $PIP are present"
for tool in $VIRTUALENV $PIP; do
for tool in "$VIRTUALENV" "$PIP"; do
which $tool &>/dev/null
if [ $? -ne 0 ]; then
error "Tool $tool is missing"
Expand All @@ -719,10 +752,13 @@ function run_pymodules_install() {
fi

debug "Create a requirement file for pure-python modules"
try echo "$PYMODULES" | try sed 's/\ /\n/g' > requirements.txt
try echo "" > requirements.txt
for mod in $PYMODULES; do
echo $mod >> requirements.txt
done

debug "Install pure-python modules via pip in venv"
try bash -c "source venv/bin/activate && env CC=/bin/false CXX=/bin/false $PIP install --target '$SITEPACKAGES_PATH' --download-cache '$PACKAGES_PATH' -r requirements.txt"
try bash -c "source venv/bin/activate && env CC=/bin/false CXX=/bin/false pip install --target '$SITEPACKAGES_PATH' --download-cache '$PACKAGES_PATH' -r requirements.txt"

}

Expand Down Expand Up @@ -759,7 +795,14 @@ function run_distribute() {
debug "Fill private directory"
try cp -a python-install/lib private/
try mkdir -p private/include/python2.7
try mv libs/$ARCH/libpymodules.so private/

if [ "$COPYLIBS" == "1" ]; then
if [ -s "libs/$ARCH/copylibs" ]; then
try sh -c "cat libs/$ARCH/copylibs | xargs -d'\n' cp -t private/"
fi
else
try mv libs/$ARCH/libpymodules.so private/
fi
try cp python-install/include/python2.7/pyconfig.h private/include/python2.7/

debug "Reduce private directory from unwanted files"
Expand All @@ -786,7 +829,11 @@ function run_distribute() {

function run_biglink() {
push_arm
try $BIGLINK $LIBS_PATH/libpymodules.so $LIBLINK_PATH
if [ "$COPYLIBS" == "0" ]; then
try $BIGLINK $LIBS_PATH/libpymodules.so $LIBLINK_PATH
else
try $BIGLINK $LIBS_PATH/copylibs $LIBLINK_PATH
fi
pop_arm
}

Expand Down Expand Up @@ -828,11 +875,16 @@ function arm_deduplicate() {


# Do the build
while getopts ":hvlfxm:u:d:s" opt; do
while getopts ":hCvlfxm:u:d:s" opt; do
case $opt in
h)
usage
;;
C)
COPYLIBS=1
LIBLINK=${LIBLINK}-jb
BIGLINK=${BIGLINK}-jb
;;
l)
list_modules
;;
Expand Down
16 changes: 9 additions & 7 deletions docs/source/android.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
Python API
==========

The Python for android project includes a Python module called "android". It
consists of multiple parts which are mostly there to facilitate the use of the Java API.
The Python for Android project includes a Python module called
``android`` which consists of multiple parts that are mostly there to
facilitate the use of the Java API.

This module is not designed to be comprehensive. Most of the Java API is also accessible with PyJNIus,
so if you can't find what you need here you can try using the Java API directly instead.
This module is not designed to be comprehensive. Most of the Java API
is also accessible with PyJNIus, so if you can't find what you need
here you can try using the Java API directly instead.


Android (``android``)
Expand Down Expand Up @@ -88,7 +90,7 @@ This billing module gives an access to the `In-App Billing <http://developer.and

#. `Setup some In-App product <http://developer.android.com/guide/google/play/billing/billing_admin.html>`_ to buy. Let's say you've created a product with the id "org.kivy.gopremium"

#. In your application, you can use the billing module like this::
#. In your application, you can use the ``billing`` module like this::


from android.billing import BillingService
Expand Down Expand Up @@ -123,7 +125,7 @@ This billing module gives an access to the `In-App Billing <http://developer.and
# Return all the items purchased
return self.service.get_purchased_items()

#. To initiate an in-app purchase, just call the buy() method::
#. To initiate an in-app purchase, just call the ``buy()`` method::

# Note: start the service at the start, and never twice!
bs = MyBillingService()
Expand All @@ -136,7 +138,7 @@ This billing module gives an access to the `In-App Billing <http://developer.and

#. You'll receive all the notifications about the billing process in the callback.

#. Last step, create your application with `--with-billing $BILLING_PUBKEY`::
#. Last step, create your application with ``--with-billing $BILLING_PUBKEY``::

./build.py ... --with-billing $BILLING_PUBKEY

Expand Down
16 changes: 8 additions & 8 deletions docs/source/contribute.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ Extending Python for android native support
-------------------------------------------

So, you want to get into python-for-android and extend what's available
to python on android ?
to Python on Android ?

Turns out it's not very complicated, here is a little introduction on how to go
about it. Without Pyjnius, the schema to access to Java API from Cython is::
about it. Without Pyjnius, the schema to access the Java API from Cython is::

[1] Cython -> [2] C JNI -> [3] Java

Think about acceleration sensors : you want to get the acceleration values in
python nothing is available natively, but you have a java API for that : the
google API is available here
Think about acceleration sensors: you want to get the acceleration
values in Python, but nothing is available natively. Lukcily you have
a Java API for that : the Google API is available here
http://developer.android.com/reference/android/hardware/Sensor.html

You can't use it directly, you need to do your own API to use it in python,
Expand Down Expand Up @@ -82,14 +82,14 @@ Jni gottchas
Create your own recipes
-----------------------

A recipe is a script that contain the "definition" of a module to compile.
A recipe is a script that contains the "definition" of a module to compile.
The directory layout of a recipe for a <modulename> is something like::

python-for-android/recipes/<modulename>/recipe.sh
python-for-android/recipes/<modulename>/patches/
python-for-android/recipes/<modulename>/patches/fix-path.patch

When building, all the recipe build must go to::
When building, all the recipe builds must go to::

python-for-android/build/<modulename>/<archiveroot>

Expand All @@ -101,5 +101,5 @@ For example, if you want to create a recipe for sdl, do::
sed -i 's#XXX#sdl#' sdl/recipe.sh

Then, edit the sdl/recipe.sh to adjust other information (version, url) and
complete build function.
complete the build function.

15 changes: 8 additions & 7 deletions docs/source/example_helloworld.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ with this project.

.. note::

Don't forget that Python for android is not Kivy only, and you might want
to use other toolkit libraries. When other toolkits will be available, this
documentation will be enhanced.
Don't forget that Python for Android is not Kivy only, and you
might want to use other toolkit libraries. When other toolkits
will be available, this documentation will be enhanced.

Let's create a simple Hello world application, with one Label and one Button.

Expand Down Expand Up @@ -43,7 +43,7 @@ Let's create a simple Hello world application, with one Label and one Button.
class HelloWorldScreen(GridLayout):
counter = NumericProperty(0)
def my_callback(self):
print 'The button have been pushed'
print 'The button has been pushed'
self.counter += 1

class HelloWorldApp(App):
Expand All @@ -55,15 +55,16 @@ Let's create a simple Hello world application, with one Label and one Button.

#. Go to the ``python-for-android`` directory

#. Create a distribute with kivy::
#. Create a distribution with kivy::

./distribute.sh -m kivy

#. Go to the newly created ``default`` distribution::

cd dist/default

#. Plug your android device, and ensure you can install development application
#. Plug your android device, and ensure you can install development
application

#. Build your hello world application in debug mode::

Expand All @@ -72,7 +73,7 @@ Let's create a simple Hello world application, with one Label and one Button.

#. Take your device, and start the application!

#. If it's goes wrong, open the logcat by doing::
#. If something goes wrong, open the logcat by doing::

adb logcat

Expand Down
11 changes: 6 additions & 5 deletions docs/source/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ Examples
Prebuilt VirtualBox
-------------------

A good starting point to build an APK are prebuilt VirtualBox images, where
the Android NDK, the Android SDK and the Kivy Python-For-Android sources
are prebuilt in an VirtualBox image. Please search the `Download Section
<http://kivy.org/#download>`__ for
such an image.
A good starting point to build an APK are prebuilt VirtualBox images,
where the Android NDK, the Android SDK, and the Kivy
Python-For-Android sources are prebuilt in an VirtualBox image. Please
search the `Download Section <http://kivy.org/#download>`__ for such
an image. You will also need to create a device filter for the Android
USB device using the VirtualBox OS settings.

.. include:: example_helloworld.rst
.. include:: example_compass.rst
Expand Down
8 changes: 5 additions & 3 deletions docs/source/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ Android. Go to :doc:`prerequisites.rst` to see which one are working.
_sqlite3.so not found
---------------------

We recently fixed sqlite3 compilation. In case of, you must:
We recently fixed sqlite3 compilation. In case of this error, you
must:

* Install development headers for sqlite3 if it's not already installed. On Ubuntu:
* Install development headers for sqlite3 if they are not already
installed. On Ubuntu:

apt-get install libsqlite3-dev

Expand All @@ -26,4 +28,4 @@ We recently fixed sqlite3 compilation. In case of, you must:
sqlite3/*
lib-dynload/_sqlite3.so

And then, sqlite3 will be compiled, and included in your APK.
Then sqlite3 will be compiled and included in your APK.
Loading