├── .gitignore ├── .projectile ├── LICENSE ├── MANIFEST.in ├── README.md ├── distribute.sh ├── doc ├── Makefile ├── make.bat └── source │ ├── apis.rst │ ├── bootstraps.rst │ ├── buildoptions.rst │ ├── commands.rst │ ├── conf.py │ ├── contribute.rst │ ├── ext │ └── sphinx_rtd_theme │ │ ├── .gitignore │ │ ├── Gemfile │ │ ├── Gemfile.lock │ │ ├── Gruntfile.js │ │ ├── LICENSE │ │ ├── MANIFEST.in │ │ ├── README.rst │ │ ├── bower.json │ │ ├── demo_docs │ │ ├── Makefile │ │ └── source │ │ │ ├── __init__.py │ │ │ ├── conf.py │ │ │ ├── demo.rst │ │ │ ├── index.rst │ │ │ ├── list.rst │ │ │ ├── static │ │ │ └── yi_jing_01_chien.jpg │ │ │ └── test_py_module │ │ │ ├── __init__.py │ │ │ └── test.py │ │ ├── package.json │ │ ├── requirements.txt │ │ ├── sass │ │ ├── _theme_badge.sass │ │ ├── _theme_badge_fa.sass │ │ ├── _theme_breadcrumbs.sass │ │ ├── _theme_font_awesome_compatability.sass │ │ ├── _theme_layout.sass │ │ ├── _theme_mathjax.sass │ │ ├── _theme_rst.sass │ │ ├── _theme_variables.sass │ │ ├── badge_only.sass │ │ └── theme.sass │ │ ├── screen_desktop.png │ │ ├── screen_mobile.png │ │ ├── setup.py │ │ └── sphinx_rtd_theme │ │ ├── __init__.py │ │ ├── breadcrumbs.html │ │ ├── footer.html │ │ ├── layout.html │ │ ├── layout_old.html │ │ ├── search.html │ │ ├── searchbox.html │ │ ├── static │ │ ├── css │ │ │ ├── badge_only.css │ │ │ └── theme.css │ │ ├── fonts │ │ │ ├── FontAwesome.otf │ │ │ ├── fontawesome-webfont.eot │ │ │ ├── fontawesome-webfont.svg │ │ │ ├── fontawesome-webfont.ttf │ │ │ └── fontawesome-webfont.woff │ │ └── js │ │ │ └── theme.js │ │ ├── theme.conf │ │ └── versions.html │ ├── index.rst │ ├── old_toolchain │ ├── Screenshot_Kivy_Kompass.png │ ├── _static │ │ └── .empty │ ├── android.rst │ ├── conf.py │ ├── contribute.rst │ ├── customize.rst │ ├── example_compass.rst │ ├── example_helloworld.rst │ ├── examples.rst │ ├── faq.rst │ ├── index.rst │ ├── javaapi.rst │ ├── prerequisites.rst │ ├── related.rst │ ├── toolchain.rst │ └── usage.rst │ ├── quickstart.rst │ ├── recipes.rst │ ├── related.rst │ └── troubleshooting.rst ├── pythonforandroid ├── __init__.py ├── archs.py ├── bdist_apk.py ├── bootstrap.py ├── bootstraps │ ├── __init__.py │ ├── empty │ │ └── __init__.py │ ├── pygame │ │ ├── __init__.py │ │ └── build │ │ │ ├── blacklist.txt │ │ │ ├── build.py │ │ │ ├── buildlib │ │ │ ├── argparse.py │ │ │ └── jinja2.egg │ │ │ │ ├── EGG-INFO │ │ │ │ ├── PKG-INFO │ │ │ │ ├── SOURCES.txt │ │ │ │ ├── dependency_links.txt │ │ │ │ ├── entry_points.txt │ │ │ │ ├── not-zip-safe │ │ │ │ ├── requires.txt │ │ │ │ └── top_level.txt │ │ │ │ └── jinja2 │ │ │ │ ├── __init__.py │ │ │ │ ├── _speedups.c │ │ │ │ ├── _stringdefs.py │ │ │ │ ├── bccache.py │ │ │ │ ├── compiler.py │ │ │ │ ├── constants.py │ │ │ │ ├── debug.py │ │ │ │ ├── defaults.py │ │ │ │ ├── environment.py │ │ │ │ ├── exceptions.py │ │ │ │ ├── ext.py │ │ │ │ ├── filters.py │ │ │ │ ├── lexer.py │ │ │ │ ├── loaders.py │ │ │ │ ├── meta.py │ │ │ │ ├── nodes.py │ │ │ │ ├── optimizer.py │ │ │ │ ├── parser.py │ │ │ │ ├── runtime.py │ │ │ │ ├── sandbox.py │ │ │ │ ├── tests.py │ │ │ │ ├── utils.py │ │ │ │ └── visitor.py │ │ │ ├── jni │ │ │ ├── Android.mk │ │ │ ├── Application.mk │ │ │ └── application │ │ │ │ ├── Android.mk │ │ │ │ ├── launchConfigure.sh │ │ │ │ ├── sdl-config │ │ │ │ └── src │ │ │ │ ├── jniwrapperstuff.h │ │ │ │ └── start.c │ │ │ ├── local.properties │ │ │ ├── res │ │ │ ├── drawable │ │ │ │ ├── icon.png │ │ │ │ └── presplash.jpg │ │ │ ├── layout │ │ │ │ ├── chooser_item.xml │ │ │ │ ├── main.xml │ │ │ │ ├── project_chooser.xml │ │ │ │ └── project_empty.xml │ │ │ └── values │ │ │ │ └── strings.xml │ │ │ ├── src │ │ │ ├── com │ │ │ │ └── android │ │ │ │ │ └── vending │ │ │ │ │ └── billing │ │ │ │ │ └── IMarketBillingService.aidl │ │ │ └── org │ │ │ │ ├── kamranzafar │ │ │ │ └── jtar │ │ │ │ │ ├── Octal.java │ │ │ │ │ ├── TarConstants.java │ │ │ │ │ ├── TarEntry.java │ │ │ │ │ ├── TarHeader.java │ │ │ │ │ ├── TarInputStream.java │ │ │ │ │ ├── TarOutputStream.java │ │ │ │ │ └── TarUtils.java │ │ │ │ └── renpy │ │ │ │ └── android │ │ │ │ ├── Action.java │ │ │ │ ├── AssetExtract.java │ │ │ │ ├── Audio.java │ │ │ │ ├── GenericBroadcastReceiver.java │ │ │ │ ├── GenericBroadcastReceiverCallback.java │ │ │ │ ├── Hardware.java │ │ │ │ ├── Project.java │ │ │ │ ├── ProjectAdapter.java │ │ │ │ ├── ProjectChooser.java │ │ │ │ ├── PythonActivity.java │ │ │ │ ├── PythonService.java │ │ │ │ ├── RenPySound.java │ │ │ │ ├── ResourceManager.java │ │ │ │ ├── SDLSurfaceView.java │ │ │ │ └── billing │ │ │ │ ├── BillingReceiver.java │ │ │ │ ├── BillingService.java │ │ │ │ ├── Consts.java │ │ │ │ ├── PurchaseDatabase.java │ │ │ │ ├── PurchaseObserver.java │ │ │ │ ├── ResponseHandler.java │ │ │ │ ├── Security.java │ │ │ │ └── util │ │ │ │ ├── AESObfuscator.java │ │ │ │ ├── Base64.java │ │ │ │ ├── Base64DecoderException.java │ │ │ │ └── Installation.java │ │ │ ├── templates │ │ │ ├── AndroidManifest.tmpl.xml │ │ │ ├── Configuration.tmpl.java │ │ │ ├── build.xml │ │ │ ├── kivy-icon.png │ │ │ ├── kivy-ouya-icon.png │ │ │ ├── kivy-presplash.jpg │ │ │ ├── launcher-icon.png │ │ │ ├── launcher-presplash.jpg │ │ │ └── strings.xml │ │ │ ├── tools │ │ │ ├── biglink │ │ │ ├── biglink-jb │ │ │ ├── liblink │ │ │ └── liblink-jb │ │ │ └── whitelist.txt │ └── sdl2 │ │ ├── __init__.py │ │ └── build │ │ ├── AndroidManifest.xml │ │ ├── ant.properties │ │ ├── blacklist.txt │ │ ├── build.properties │ │ ├── build.py │ │ ├── build.xml │ │ ├── jni │ │ ├── Android.mk │ │ ├── Application.mk │ │ └── src │ │ │ ├── Android.mk │ │ │ ├── Android_static.mk │ │ │ └── start.c │ │ ├── proguard-project.txt │ │ ├── res │ │ ├── drawable-hdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-mdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-xhdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-xxhdpi │ │ │ └── ic_launcher.png │ │ ├── drawable │ │ │ ├── .gitkeep │ │ │ └── icon.png │ │ ├── layout │ │ │ └── main.xml │ │ └── values │ │ │ └── strings.xml │ │ ├── src │ │ └── org │ │ │ ├── kamranzafar │ │ │ └── jtar │ │ │ │ ├── Octal.java │ │ │ │ ├── TarConstants.java │ │ │ │ ├── TarEntry.java │ │ │ │ ├── TarHeader.java │ │ │ │ ├── TarInputStream.java │ │ │ │ ├── TarOutputStream.java │ │ │ │ └── TarUtils.java │ │ │ ├── kivy │ │ │ └── android │ │ │ │ ├── GenericBroadcastReceiver.java │ │ │ │ ├── GenericBroadcastReceiverCallback.java │ │ │ │ ├── PythonActivity.java │ │ │ │ ├── PythonService.java │ │ │ │ ├── PythonUtil.java │ │ │ │ └── concurrency │ │ │ │ ├── PythonEvent.java │ │ │ │ └── PythonLock.java │ │ │ ├── libsdl │ │ │ └── app │ │ │ │ └── SDLActivity.java │ │ │ └── renpy │ │ │ └── android │ │ │ ├── AssetExtract.java │ │ │ ├── Hardware.java │ │ │ ├── PythonActivity.java │ │ │ ├── PythonService.java │ │ │ └── ResourceManager.java │ │ ├── templates │ │ ├── AndroidManifest.tmpl.xml │ │ ├── Service.tmpl.java │ │ ├── build.tmpl.xml │ │ ├── custom_rules.tmpl.xml │ │ ├── kivy-icon.png │ │ ├── kivy-presplash.jpg │ │ └── strings.tmpl.xml │ │ └── whitelist.txt ├── build.py ├── distribution.py ├── graph.py ├── includes │ └── arm64-v8a │ │ └── machine │ │ └── cpu-features.h ├── logger.py ├── patching.py ├── recipe.py ├── recipes │ ├── __init__.py │ ├── android │ │ ├── __init__.py │ │ ├── recipe.sh │ │ └── src │ │ │ ├── android │ │ │ ├── __init__.py │ │ │ ├── _android.pyx │ │ │ ├── _android_billing.pyx │ │ │ ├── _android_billing_jni.c │ │ │ ├── _android_jni.c │ │ │ ├── _android_sound.pyx │ │ │ ├── _android_sound_jni.c │ │ │ ├── activity.py │ │ │ ├── billing.py │ │ │ ├── broadcast.py │ │ │ ├── mixer.py │ │ │ └── runnable.py │ │ │ └── setup.py │ ├── audiostream │ │ ├── __init__.py │ │ └── recipe.sh │ ├── babel │ │ └── __init__.py │ ├── boost │ │ ├── __init__.py │ │ ├── disable-so-version.patch │ │ ├── use-android-libs.patch │ │ └── user-config.jam │ ├── brokenrecipe │ │ └── __init__.py │ ├── cdecimal │ │ ├── __init__.py │ │ ├── cross-compile.patch │ │ └── locale.patch │ ├── cffi │ │ ├── __init__.py │ │ └── disable-pkg-config.patch │ ├── cryptography │ │ ├── __init__.py │ │ ├── fix-cffi-path.patch │ │ └── link-static.patch │ ├── enum34 │ │ └── __init__.py │ ├── evdev │ │ ├── __init__.py │ │ ├── evcnt.patch │ │ ├── evdev-permissions.patch │ │ ├── include-dir.patch │ │ ├── keycnt.patch │ │ └── remove-uinput.patch │ ├── fontconfig │ │ └── __init__.py │ ├── freetype │ │ ├── __init__.py │ │ └── recipe.sh │ ├── harfbuzz │ │ ├── __init__.py │ │ └── recipe.sh │ ├── hostpython2 │ │ ├── Setup │ │ ├── __init__.py │ │ └── recipe.sh │ ├── hostpython3 │ │ └── __init__.py │ ├── hostpython3crystax │ │ └── __init__.py │ ├── idna │ │ └── __init__.py │ ├── ipaddress │ │ └── __init__.py │ ├── jpeg │ │ ├── Application.mk │ │ ├── __init__.py │ │ └── build-static.patch │ ├── kivy │ │ ├── __init__.py │ │ └── recipe.sh │ ├── kivysdl2python3 │ │ ├── __init__.py │ │ ├── android_sdl2_compat.patch │ │ └── recipe.sh │ ├── leveldb │ │ ├── __init__.py │ │ ├── disable-so-version.patch │ │ └── find-snappy.patch │ ├── libffi │ │ ├── Application.mk │ │ ├── __init__.py │ │ ├── disable-mips-check.patch │ │ └── remove-version-info.patch │ ├── libmysqlclient │ │ ├── Linux.cmake │ │ ├── __init__.py │ │ ├── add-custom-platform.patch │ │ ├── disable-soname.patch │ │ ├── disable-soversion.patch │ │ └── p4a.cmake │ ├── libsodium │ │ └── __init__.py │ ├── libtorrent │ │ ├── __init__.py │ │ ├── disable-so-version.patch │ │ ├── use-soname-python.patch │ │ └── user-config-openssl.patch │ ├── libzmq │ │ └── __init__.py │ ├── m2crypto │ │ └── __init__.py │ ├── mysqldb │ │ ├── __init__.py │ │ ├── disable-zip.patch │ │ └── override-mysql-config.patch │ ├── ndghttpsclient │ ├── netifaces │ │ └── __init__.py │ ├── numpy │ │ ├── __init__.py │ │ └── patches │ │ │ ├── ar.patch │ │ │ ├── fix-numpy.patch │ │ │ ├── lib.patch │ │ │ └── prevent_libs_check.patch │ ├── openssl │ │ ├── __init__.py │ │ └── disable-sover.patch │ ├── pil │ │ ├── __init__.py │ │ ├── disable-tk.patch │ │ └── fix-directories.patch │ ├── png │ │ └── __init__.py │ ├── pyasn1 │ │ └── __init__.py │ ├── pycparser │ │ └── __init__.py │ ├── pycrypto │ │ ├── __init__.py │ │ └── add_length.patch │ ├── pygame │ │ ├── Setup │ │ ├── __init__.py │ │ ├── patches │ │ │ ├── fix-array-surface.patch │ │ │ ├── fix-sdl-spam-log.patch │ │ │ └── fix-surface-access.patch │ │ └── recipe.sh │ ├── pygame_bootstrap_components │ │ └── __init__.py │ ├── pyjnius │ │ ├── __init__.py │ │ ├── recipe.sh │ │ └── sdl2_jnienv_getter.patch │ ├── pyleveldb │ │ ├── __init__.py │ │ └── bindings-only.patch │ ├── pyopenssl │ │ ├── __init__.py │ │ └── fix-dlfcn.patch │ ├── pysdl2 │ │ └── __init__.py │ ├── python2 │ │ ├── Setup.local-ssl │ │ ├── __init__.py │ │ ├── patches │ │ │ ├── Python-2.7.2-ctypes-disable-wchar.patch │ │ │ ├── Python-2.7.2-xcompile.patch │ │ │ ├── Python-2.7.2-xcompile.patch-backup │ │ │ ├── Python-2.7.2-xcompile.patch-new │ │ │ ├── _scproxy.py │ │ │ ├── ctypes-find-library-updated.patch │ │ │ ├── ctypes-find-library.patch │ │ │ ├── custom-loader.patch │ │ │ ├── disable-modules.patch │ │ │ ├── disable-openpty.patch │ │ │ ├── enable-ssl.patch │ │ │ ├── fix-configure-darwin.patch │ │ │ ├── fix-distutils-darwin.patch │ │ │ ├── fix-dlfcn.patch │ │ │ ├── fix-dynamic-lookup.patch │ │ │ ├── fix-filesystemdefaultencoding.patch │ │ │ ├── fix-ftime-removal.patch │ │ │ ├── fix-gethostbyaddr.patch │ │ │ ├── fix-locale.patch │ │ │ ├── fix-remove-corefoundation.patch │ │ │ ├── fix-setup-flags.patch │ │ │ ├── fix-termios.patch │ │ │ ├── parsetuple.patch │ │ │ ├── t.htm │ │ │ ├── t_files │ │ │ │ ├── a899e84.jpg │ │ │ │ ├── analytics.js │ │ │ │ ├── b0dcca.css │ │ │ │ ├── jquery.js │ │ │ │ ├── json2.js │ │ │ │ ├── legal_hacks.png │ │ │ │ ├── te-news.png │ │ │ │ └── terrible_small_logo.png │ │ │ └── verbose-compilation.patch │ │ └── recipe.sh │ ├── python3 │ │ ├── __init__.py │ │ ├── log_failures.patch │ │ ├── patches-termux │ │ │ ├── Lib-tmpfile.py.patch │ │ │ ├── _cursesmodule.c.patch │ │ │ ├── dlfcn_py_android.patch │ │ │ ├── mathmodule.c.patch │ │ │ ├── posixmodule.c.patch │ │ │ ├── pwdmodule_no_pw_gecos.patch │ │ │ ├── setup.py.patch │ │ │ └── subprocess.py.patch │ │ └── patches │ │ │ ├── python-3.4.2-android-libmpdec.patch │ │ │ ├── python-3.4.2-android-locale.patch │ │ │ ├── python-3.4.2-android-misc.patch │ │ │ ├── python-3.4.2-android-missing-getdents64-definition.patch │ │ │ ├── python-3.4.2-cross-compile.patch │ │ │ ├── python-3.4.2-libpymodules_loader.patch │ │ │ └── python-3.4.2-python-misc.patch │ ├── python3crystax │ │ └── __init__.py │ ├── pytz │ │ └── __init__.py │ ├── pyusb │ │ ├── __init__.py │ │ └── fix-android.patch │ ├── pyzmq │ │ └── __init__.py │ ├── sdl │ │ └── __init__.py │ ├── sdl2 │ │ ├── __init__.py │ │ └── add_nativeSetEnv.patch │ ├── sdl2_image │ │ ├── __init__.py │ │ ├── disable-assembler.patch │ │ ├── disable_jpg.patch │ │ ├── disable_webp.patch │ │ └── extra-cflags.patch │ ├── sdl2_mixer │ │ ├── __init__.py │ │ └── disable_modplug_mikmod_smpeg.patch │ ├── sdl2_ttf │ │ └── __init__.py │ ├── sdl2python3 │ │ ├── __init__.py │ │ └── add_nativeSetEnv.patch │ ├── sdl2python3crystax │ │ ├── __init__.py │ │ └── add_nativeSetEnv.patch │ ├── setuptools │ │ └── __init__.py │ ├── six │ │ └── __init__.py │ ├── snappy │ │ └── __init__.py │ ├── sqlalchemy │ │ ├── __init__.py │ │ └── zipsafe.patch │ ├── twisted │ │ └── __init__.py │ ├── vispy │ │ ├── __init__.py │ │ ├── disable_font_triage.patch │ │ ├── disable_freetype.patch │ │ ├── disable_freetype.patch_backup │ │ ├── remove_ati_check.patch │ │ └── use_es2.patch │ ├── vlc │ │ └── __init__.py │ ├── zeroconf │ │ └── __init__.py │ ├── zope │ │ └── __init__.py │ └── zope_interface │ │ └── __init__.py ├── toolchain.py ├── tools │ ├── biglink │ ├── liblink │ └── liblink.sh └── util.py ├── setup.py ├── testapps ├── testapp │ ├── colours.png │ └── main.py ├── testapp_nogui │ └── main.py └── vispy_testapp │ └── main.py └── tests └── test_graph.py /.gitignore: -------------------------------------------------------------------------------- 1 | *.swp 2 | *.swo 3 | *~ 4 | 5 | #ECLIPSE + PYDEV 6 | .project 7 | .pydevproject 8 | 9 | .deps 10 | 11 | .optional-deps 12 | 13 | *.pyc 14 | *.pyo 15 | *.apk 16 | .packages 17 | python_for_android.egg-info 18 | /build/ 19 | doc/build 20 | __pycache__/ 21 | 22 | #idea/pycharm 23 | .idea/ 24 | -------------------------------------------------------------------------------- /.projectile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geohot/python-for-android/19500c8c32dd6954a32af9c6eb6bc81cae363e10/.projectile -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010-2015 Kivy Team and other contributors 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | 2 | include LICENSE README.md 3 | 4 | recursive-include doc * 5 | prune doc/build 6 | 7 | recursive-include pythonforandroid *.py *.tmpl biglink liblink 8 | recursive-include pythonforandroid/recipes *.py *.patch *.c *.pyx Setup *.h 9 | 10 | recursive-include pythonforandroid/bootstraps *.properties *.xml *.java *.tmpl *.txt *.png *.aidl *.py *.sh *.c *.h 11 | 12 | prune .git 13 | prune pythonforandroid/bootstraps/pygame/build/libs 14 | -------------------------------------------------------------------------------- /distribute.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # This file is just a shim to report an error messaage if some tool 4 | # tries to run the old python-for-android. 5 | 6 | # An alternative would be to implement argument handling and pass 7 | # things to the new toolchain so that it works the same as before, but 8 | # that would be harder. 9 | 10 | 11 | cat <`_. 6 | 7 | Issues and pull requests are welcome via the integrated `issue tracker 8 | `_. 9 | -------------------------------------------------------------------------------- /doc/source/ext/sphinx_rtd_theme/.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *.egg-info 3 | *.egg 4 | *build/ 5 | .tox 6 | .coverage 7 | *.DS_Store 8 | *.sass-cache 9 | .ruby-version 10 | dist/ 11 | bower_components/ 12 | node_modules/ 13 | npm-debug.log 14 | -------------------------------------------------------------------------------- /doc/source/ext/sphinx_rtd_theme/Gemfile: -------------------------------------------------------------------------------- 1 | # A sample Gemfile 2 | source "https://rubygems.org" 3 | 4 | gem "compass" 5 | -------------------------------------------------------------------------------- /doc/source/ext/sphinx_rtd_theme/Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | chunky_png (1.2.9) 5 | compass (0.12.2) 6 | chunky_png (~> 1.2) 7 | fssm (>= 0.2.7) 8 | sass (~> 3.1) 9 | fssm (0.2.10) 10 | sass (3.2.12) 11 | 12 | PLATFORMS 13 | ruby 14 | 15 | DEPENDENCIES 16 | compass 17 | -------------------------------------------------------------------------------- /doc/source/ext/sphinx_rtd_theme/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 Dave Snider 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /doc/source/ext/sphinx_rtd_theme/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include *.txt 2 | include LICENSE 3 | recursive-include sphinx_rtd_theme *.conf 4 | recursive-include sphinx_rtd_theme *.css 5 | recursive-include sphinx_rtd_theme *.eot 6 | recursive-include sphinx_rtd_theme *.html 7 | recursive-include sphinx_rtd_theme *.js 8 | recursive-include sphinx_rtd_theme *.svg 9 | recursive-include sphinx_rtd_theme *.ttf 10 | recursive-include sphinx_rtd_theme *.woff 11 | -------------------------------------------------------------------------------- /doc/source/ext/sphinx_rtd_theme/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sphinx-rtd-theme", 3 | "version": "1.0", 4 | "homepage": "https://github.com/snide/wyrm", 5 | "authors": [ 6 | "Dave Snider " 7 | ], 8 | "description": "Sphinx theme for readthedocs.org.", 9 | "license": "MIT", 10 | "main": [ 11 | "dist/**" 12 | ], 13 | "ignore": [ 14 | "docs", 15 | "demo_docs", 16 | ".gitignore", 17 | ".DS_Store", 18 | ".sass-cache*", 19 | ".bowerrc", 20 | "bower.json", 21 | "package.json", 22 | "Gruntfile.js", 23 | "node_modules", 24 | "bower_components", 25 | "test", 26 | "tests", 27 | "src" 28 | ], 29 | "dependencies": { 30 | "wyrm": "~0.0.x" 31 | } 32 | } 33 | 34 | -------------------------------------------------------------------------------- /doc/source/ext/sphinx_rtd_theme/demo_docs/source/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geohot/python-for-android/19500c8c32dd6954a32af9c6eb6bc81cae363e10/doc/source/ext/sphinx_rtd_theme/demo_docs/source/__init__.py -------------------------------------------------------------------------------- /doc/source/ext/sphinx_rtd_theme/demo_docs/source/list.rst: -------------------------------------------------------------------------------- 1 | .. important:: 2 | 3 | wanna play a game? 4 | 5 | - inside 6 | - this 7 | 8 | - list 9 | - ``in the world`` 10 | 11 | - hi 12 | - his 13 | 14 | hi 15 | 16 | 17 | 18 | A list 19 | ====== 20 | 21 | - here 22 | - is 23 | - some 24 | - list 25 | - items 26 | - `yahoo `_ 27 | - ``huh`` 28 | - how 29 | - ``inline literall`` 30 | - ``inline literall`` 31 | - ``inline literall`` 32 | 33 | Second list level 34 | ----------------- 35 | 36 | - here is a list in a second-level section. 37 | - `yahoo `_ 38 | - `yahoo `_ 39 | 40 | - `yahoo `_ 41 | - here is an inner bullet ``oh`` 42 | 43 | - one more ``with an inline literally``. `yahoo `_ 44 | 45 | heh heh. child. try to beat this embed: 46 | 47 | .. literalinclude:: test_py_module/test.py 48 | :language: python 49 | :linenos: 50 | :lines: 1-10 51 | - and another. `yahoo `_ 52 | - `yahoo `_ 53 | - ``hi`` 54 | - and hehe 55 | 56 | But deeper down the rabbit hole 57 | """"""""""""""""""""""""""""""" 58 | 59 | - I kept saying that, "deeper down the rabbit hole". `yahoo `_ 60 | 61 | - I cackle at night `yahoo `_. 62 | - I'm so lonely here in GZ ``guangzhou`` 63 | - A man of python destiny, hopes and dreams. `yahoo `_ 64 | 65 | - `yahoo `_ 66 | 67 | - `yahoo `_ ``hi`` 68 | - ``destiny`` 69 | 70 | -------------------------------------------------------------------------------- /doc/source/ext/sphinx_rtd_theme/demo_docs/source/static/yi_jing_01_chien.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geohot/python-for-android/19500c8c32dd6954a32af9c6eb6bc81cae363e10/doc/source/ext/sphinx_rtd_theme/demo_docs/source/static/yi_jing_01_chien.jpg -------------------------------------------------------------------------------- /doc/source/ext/sphinx_rtd_theme/demo_docs/source/test_py_module/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geohot/python-for-android/19500c8c32dd6954a32af9c6eb6bc81cae363e10/doc/source/ext/sphinx_rtd_theme/demo_docs/source/test_py_module/__init__.py -------------------------------------------------------------------------------- /doc/source/ext/sphinx_rtd_theme/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sphinx_rtd_theme", 3 | "version": "0.0.11", 4 | "private": true, 5 | "dependencies": {}, 6 | "devDependencies": { 7 | "grunt": "~0.4.1", 8 | "grunt-contrib-sass": "~0.7.2", 9 | "grunt-contrib-watch": "~0.4.3", 10 | "grunt-contrib-connect": "0.5.0", 11 | "grunt-contrib-clean": "0.5.0", 12 | "grunt-contrib-copy": "0.5.0", 13 | "connect-livereload": "~0.3.0", 14 | "grunt-exec": "~0.4.2", 15 | "grunt-open": "0.2.2", 16 | "matchdep": "~0.1.2" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /doc/source/ext/sphinx_rtd_theme/requirements.txt: -------------------------------------------------------------------------------- 1 | sphinx>=1.1 2 | -------------------------------------------------------------------------------- /doc/source/ext/sphinx_rtd_theme/sass/_theme_badge_fa.sass: -------------------------------------------------------------------------------- 1 | // Slimmer version of FA for use on the badge_only.sass file. 2 | 3 | +font-face(FontAwesome, '#{$font-awesome-dir}fontawesome_webfont') 4 | 5 | .fa:before 6 | display: inline-block 7 | font-family: FontAwesome 8 | font-style: normal 9 | font-weight: normal 10 | line-height: 1 11 | text-decoration: inherit 12 | +font-smooth 13 | 14 | a .fa 15 | display: inline-block 16 | text-decoration: inherit 17 | 18 | 19 | li 20 | .fa 21 | display: inline-block 22 | .fa-large:before, 23 | .fa-large:before 24 | /* 1.5 increased font size for fa-large * 1.25 width 25 | width: 1.5 * 1.25em 26 | 27 | ul.fas 28 | list-style-type: none 29 | margin-left: 2em 30 | text-indent: -0.8em 31 | li 32 | .fa 33 | width: .8em 34 | .fa-large:before, 35 | .fa-large:before 36 | /* 1.5 increased font size for fa-large * 1.25 width 37 | vertical-align: baseline 38 | // width: 1.5*1.25em 39 | 40 | .fa-book:before 41 | content: "\f02d" 42 | 43 | .icon-book:before 44 | content: "\f02d" 45 | 46 | .fa-caret-down:before 47 | content: "\f0d7" 48 | 49 | .icon-caret-down:before 50 | content: "\f0d7" 51 | 52 | .fa-caret-up:before 53 | content: "\f0d8" 54 | 55 | .icon-caret-up:before 56 | content: "\f0d8" 57 | 58 | .fa-caret-left:before 59 | content: "\f0d9" 60 | 61 | .icon-caret-left:before 62 | content: "\f0d9" 63 | 64 | .fa-caret-right:before 65 | content: "\f0da" 66 | 67 | .icon-caret-right:before 68 | content: "\f0da" 69 | -------------------------------------------------------------------------------- /doc/source/ext/sphinx_rtd_theme/sass/_theme_breadcrumbs.sass: -------------------------------------------------------------------------------- 1 | .wy-breadcrumbs li 2 | display: inline-block 3 | &.wy-breadcrumbs-aside 4 | float: right 5 | a 6 | display: inline-block 7 | padding: 5px 8 | &:first-child 9 | padding-left: 0 10 | .wy-breadcrumbs-extra 11 | margin-bottom: 0 12 | color: $text-light 13 | font-size: 80% 14 | display: inline-block 15 | 16 | 17 | +media($mobile) 18 | .wy-breadcrumbs-extra 19 | display: none 20 | .wy-breadcrumbs li.wy-breadcrumbs-aside 21 | display: none 22 | 23 | @media print 24 | .wy-breadcrumbs li.wy-breadcrumbs-aside 25 | display: none 26 | -------------------------------------------------------------------------------- /doc/source/ext/sphinx_rtd_theme/sass/_theme_font_awesome_compatability.sass: -------------------------------------------------------------------------------- 1 | .icon 2 | @extend .fa 3 | .icon-home 4 | @extend .fa-home 5 | .icon-search 6 | @extend .fa-search 7 | .icon-book 8 | @extend .fa-book 9 | .icon-caret-down 10 | @extend .fa-caret-down 11 | .icon-github 12 | @extend .fa-github 13 | .icon-bitbucket 14 | @extend .fa-bitbucket 15 | .icon-fire 16 | @extend .fa-fire 17 | .icon-circle-arrow-right 18 | @extend .fa-arrow-circle-right 19 | .icon-circle-arrow-left 20 | @extend .fa-arrow-circle-left 21 | .icon-link 22 | @extend .fa-link 23 | -------------------------------------------------------------------------------- /doc/source/ext/sphinx_rtd_theme/sass/_theme_mathjax.sass: -------------------------------------------------------------------------------- 1 | span[id*='MathJax-Span'] 2 | color: $mathjax-color 3 | 4 | .math 5 | text-align: center 6 | -------------------------------------------------------------------------------- /doc/source/ext/sphinx_rtd_theme/sass/_theme_variables.sass: -------------------------------------------------------------------------------- 1 | // In here are varibles used for sphinx_rtd_theme, they either add to or overwrite the default ones 2 | // that are set in wyrm_core/wy_variables.sass. You'll find wyrm in bower_components if you're looking 3 | // for a reference. 4 | 5 | $font-awesome-dir: "../font/" 6 | $static-img: "../img/" 7 | $mathjax-color: $text-color 8 | 9 | $base-font-family: "Lato", "proxima-nova", "Helvetica Neue", Arial, sans-serif 10 | $custom-font-family: "Roboto Slab", "ff-tisa-web-pro", "Georgia", Arial, sans-serif 11 | $custom-font-family2: Georgia, serif 12 | $code-font-family: Consolas, "Andale Mono WT", "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L", Monaco, "Courier New", Courier, monospace 13 | -------------------------------------------------------------------------------- /doc/source/ext/sphinx_rtd_theme/sass/badge_only.sass: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------ 2 | // CONTRIBUTORS, PLEASE READ THIS! 3 | // ------------------------------------------------------------ 4 | // This generates the RTD sticky badge for non RTD themes. As 5 | // always, only files labeled "theme_*.sass should be edited". 6 | // ------------------------------------------------------------ 7 | $border-box-sizing: false !default 8 | 9 | @import wyrm_core/wy_variables 10 | @import theme_variables 11 | @import bourbon 12 | @import neat 13 | @import wyrm_core/mixin 14 | @import wyrm_core/grid_settings 15 | @import _theme_badge_fa 16 | @import _theme_badge 17 | -------------------------------------------------------------------------------- /doc/source/ext/sphinx_rtd_theme/sass/theme.sass: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------ 2 | // CONTRIBUTORS, PLEASE READ THIS! 3 | // ------------------------------------------------------------ 4 | // This theme pulls from other frontend projects. The only 5 | // things you should edit are the sass files that start with 6 | // "theme_*.sass". All other files are loaded through bower. 7 | // ------------------------------------------------------------ 8 | 9 | // Variable defaults set by Wyrm 10 | @import wyrm_core/wy_variables 11 | 12 | // Variable overrides that change coloring and fonts for this theme. 13 | @import theme_variables 14 | 15 | // bourbon.io framework 16 | @import bourbon 17 | 18 | // Bourbon.io/neat framework, with some default media queries 19 | @import wyrm_core/grid_settings 20 | @import neat 21 | // Some corrections for neat 22 | @import wyrm_core/neat_extra 23 | 24 | // Custom reset 25 | @import wyrm_core/reset 26 | 27 | // Wyrm mixins 28 | @import wyrm_core/mixin 29 | 30 | // Font Awesome 4.0 with wyrm extras 31 | @import font-awesome 32 | @import wyrm_core/font_icon_defaults 33 | 34 | // Wyrm core styles used in this theme 35 | @import wyrm_core/alert 36 | @import wyrm_core/button 37 | @import wyrm_core/dropdown 38 | @import wyrm_core/form 39 | @import wyrm_core/generic 40 | @import wyrm_core/table 41 | @import wyrm_core/type 42 | 43 | // Pygments styling 44 | @import wyrm_addons/pygments/pygments 45 | @import wyrm_addons/pygments/pygments_light 46 | 47 | // Theme specific styles. These are likely the files you want to edit. 48 | @import theme_breadcrumbs 49 | @import theme_layout 50 | @import theme_badge 51 | @import theme_rst 52 | @import theme_mathjax 53 | @import theme_font_awesome_compatability 54 | -------------------------------------------------------------------------------- /doc/source/ext/sphinx_rtd_theme/screen_desktop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geohot/python-for-android/19500c8c32dd6954a32af9c6eb6bc81cae363e10/doc/source/ext/sphinx_rtd_theme/screen_desktop.png -------------------------------------------------------------------------------- /doc/source/ext/sphinx_rtd_theme/screen_mobile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geohot/python-for-android/19500c8c32dd6954a32af9c6eb6bc81cae363e10/doc/source/ext/sphinx_rtd_theme/screen_mobile.png -------------------------------------------------------------------------------- /doc/source/ext/sphinx_rtd_theme/setup.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """`sphinx_rtd_theme` lives on `Github`_. 3 | 4 | .. _github: https://www.github.com/snide/sphinx_rtd_theme 5 | 6 | """ 7 | from setuptools import setup 8 | from sphinx_rtd_theme import __version__ 9 | 10 | 11 | setup( 12 | name='sphinx_rtd_theme', 13 | version=__version__, 14 | url='https://github.com/snide/sphinx_rtd_theme/', 15 | license='MIT', 16 | author='Dave Snider', 17 | author_email='dave.snider@gmail.com', 18 | description='ReadTheDocs.org theme for Sphinx, 2013 version.', 19 | long_description=open('README.rst').read(), 20 | zip_safe=False, 21 | packages=['sphinx_rtd_theme'], 22 | package_data={'sphinx_rtd_theme': [ 23 | 'theme.conf', 24 | '*.html', 25 | 'static/css/*.css', 26 | 'static/js/*.js', 27 | 'static/font/*.*' 28 | ]}, 29 | include_package_data=True, 30 | install_requires=open('requirements.txt').read().splitlines(), 31 | classifiers=[ 32 | 'Development Status :: 3 - Alpha', 33 | 'License :: OSI Approved :: BSD License', 34 | 'Environment :: Console', 35 | 'Environment :: Web Environment', 36 | 'Intended Audience :: Developers', 37 | 'Programming Language :: Python :: 2.7', 38 | 'Programming Language :: Python :: 3', 39 | 'Operating System :: OS Independent', 40 | 'Topic :: Documentation', 41 | 'Topic :: Software Development :: Documentation', 42 | ], 43 | ) 44 | -------------------------------------------------------------------------------- /doc/source/ext/sphinx_rtd_theme/sphinx_rtd_theme/__init__.py: -------------------------------------------------------------------------------- 1 | """Sphinx ReadTheDocs theme. 2 | 3 | From https://github.com/ryan-roemer/sphinx-bootstrap-theme. 4 | 5 | """ 6 | import os 7 | 8 | VERSION = (0, 1, 5) 9 | 10 | __version__ = ".".join(str(v) for v in VERSION) 11 | __version_full__ = __version__ 12 | 13 | 14 | def get_html_theme_path(): 15 | """Return list of HTML theme paths.""" 16 | cur_dir = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) 17 | return cur_dir 18 | -------------------------------------------------------------------------------- /doc/source/ext/sphinx_rtd_theme/sphinx_rtd_theme/breadcrumbs.html: -------------------------------------------------------------------------------- 1 |
2 | 18 |
19 |
20 | -------------------------------------------------------------------------------- /doc/source/ext/sphinx_rtd_theme/sphinx_rtd_theme/footer.html: -------------------------------------------------------------------------------- 1 |
2 | {% if next or prev %} 3 | 11 | {% endif %} 12 | 13 |
14 | 15 |
16 |

17 | {%- if show_copyright %} 18 | {%- if hasdoc('copyright') %} 19 | {% trans path=pathto('copyright'), copyright=copyright|e %}© Copyright {{ copyright }}.{% endtrans %} 20 | {%- else %} 21 | {% trans copyright=copyright|e %}© Copyright {{ copyright }}.{% endtrans %} 22 | {%- endif %} 23 | {%- endif %} 24 | 25 | {%- if last_updated %} 26 | {% trans last_updated=last_updated|e %}Last updated on {{ last_updated }}.{% endtrans %} 27 | {%- endif %} 28 |

29 |
30 | 31 | {% trans %}Sphinx theme provided by Read the Docs{% endtrans %} 32 |
33 | -------------------------------------------------------------------------------- /doc/source/ext/sphinx_rtd_theme/sphinx_rtd_theme/search.html: -------------------------------------------------------------------------------- 1 | {# 2 | basic/search.html 3 | ~~~~~~~~~~~~~~~~~ 4 | 5 | Template for the search page. 6 | 7 | :copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS. 8 | :license: BSD, see LICENSE for details. 9 | #} 10 | {%- extends "layout.html" %} 11 | {% set title = _('Search') %} 12 | {% set script_files = script_files + ['_static/searchtools.js'] %} 13 | {% block footer %} 14 | 17 | {# this is used when loading the search index using $.ajax fails, 18 | such as on Chrome for documents on localhost #} 19 | 20 | {{ super() }} 21 | {% endblock %} 22 | {% block body %} 23 | 31 | 32 | {% if search_performed %} 33 |

{{ _('Search Results') }}

34 | {% if not search_results %} 35 |

{{ _('Your search did not match any documents. Please make sure that all words are spelled correctly and that you\'ve selected enough categories.') }}

36 | {% endif %} 37 | {% endif %} 38 |
39 | {% if search_results %} 40 |
    41 | {% for href, caption, context in search_results %} 42 |
  • 43 | {{ caption }} 44 |

    {{ context|e }}

    45 |
  • 46 | {% endfor %} 47 |
48 | {% endif %} 49 |
50 | {% endblock %} 51 | -------------------------------------------------------------------------------- /doc/source/ext/sphinx_rtd_theme/sphinx_rtd_theme/searchbox.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 | 5 | 6 |
7 |
8 | -------------------------------------------------------------------------------- /doc/source/ext/sphinx_rtd_theme/sphinx_rtd_theme/static/fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geohot/python-for-android/19500c8c32dd6954a32af9c6eb6bc81cae363e10/doc/source/ext/sphinx_rtd_theme/sphinx_rtd_theme/static/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /doc/source/ext/sphinx_rtd_theme/sphinx_rtd_theme/static/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geohot/python-for-android/19500c8c32dd6954a32af9c6eb6bc81cae363e10/doc/source/ext/sphinx_rtd_theme/sphinx_rtd_theme/static/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /doc/source/ext/sphinx_rtd_theme/sphinx_rtd_theme/static/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geohot/python-for-android/19500c8c32dd6954a32af9c6eb6bc81cae363e10/doc/source/ext/sphinx_rtd_theme/sphinx_rtd_theme/static/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /doc/source/ext/sphinx_rtd_theme/sphinx_rtd_theme/static/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geohot/python-for-android/19500c8c32dd6954a32af9c6eb6bc81cae363e10/doc/source/ext/sphinx_rtd_theme/sphinx_rtd_theme/static/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /doc/source/ext/sphinx_rtd_theme/sphinx_rtd_theme/theme.conf: -------------------------------------------------------------------------------- 1 | [theme] 2 | inherit = basic 3 | stylesheet = css/theme.css 4 | 5 | [options] 6 | typekit_id = hiw1hhg 7 | analytics_id = 8 | sticky_navigation = False 9 | -------------------------------------------------------------------------------- /doc/source/ext/sphinx_rtd_theme/sphinx_rtd_theme/versions.html: -------------------------------------------------------------------------------- 1 | {% if READTHEDOCS %} 2 | {# Add rst-badge after rst-versions for small badge style. #} 3 |
4 | 5 | Read the Docs 6 | v: {{ current_version }} 7 | 8 | 9 |
10 |
11 |
Versions
12 | {% for slug, url in versions %} 13 |
{{ slug }}
14 | {% endfor %} 15 |
16 |
17 |
Downloads
18 | {% for type, url in downloads %} 19 |
{{ type }}
20 | {% endfor %} 21 |
22 |
23 |
On Read the Docs
24 |
25 | Project Home 26 |
27 |
28 | Builds 29 |
30 |
31 |
32 | Free document hosting provided by Read the Docs. 33 | 34 |
35 |
36 | {% endif %} 37 | 38 | -------------------------------------------------------------------------------- /doc/source/index.rst: -------------------------------------------------------------------------------- 1 | python-for-android 2 | ================== 3 | 4 | python-for-android is an open source build tool to let you package 5 | Python code into standalone android APKs that can be passed around, 6 | installed, or uploaded to marketplaces such as the Play Store just 7 | like any other Android app. This tool was originally developed for the 8 | `Kivy cross-platform graphical framework `_, 9 | but now supports multiple bootstraps and can be easily extended to 10 | package other types of Python app for Android. 11 | 12 | python-for-android supports two major operations; first, it can 13 | compile the Python interpreter, its dependencies, backend libraries 14 | and python code for Android devices. This stage is fully customisable, 15 | you can install as many or few components as you like. The result is 16 | a standalone Android project which can be used to generate any number 17 | of different APKs, even with different names, icons, Python code etc. 18 | The second function of python-for-android is to provide a simple 19 | interface to these distributions, to generate from such a project a 20 | Python APK with build parameters and Python code to taste. 21 | 22 | 23 | Contents 24 | ======== 25 | 26 | .. toctree:: 27 | :maxdepth: 2 28 | 29 | quickstart 30 | buildoptions 31 | installation 32 | commands 33 | recipes 34 | bootstraps 35 | apis 36 | troubleshooting 37 | contribute 38 | old_toolchain/index.rst 39 | 40 | 41 | Indices and tables 42 | ================== 43 | 44 | * :ref:`genindex` 45 | * :ref:`modindex` 46 | * :ref:`search` 47 | 48 | -------------------------------------------------------------------------------- /doc/source/old_toolchain/Screenshot_Kivy_Kompass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geohot/python-for-android/19500c8c32dd6954a32af9c6eb6bc81cae363e10/doc/source/old_toolchain/Screenshot_Kivy_Kompass.png -------------------------------------------------------------------------------- /doc/source/old_toolchain/_static/.empty: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geohot/python-for-android/19500c8c32dd6954a32af9c6eb6bc81cae363e10/doc/source/old_toolchain/_static/.empty -------------------------------------------------------------------------------- /doc/source/old_toolchain/customize.rst: -------------------------------------------------------------------------------- 1 | Customize your distribution 2 | --------------------------- 3 | 4 | The basic layout of a distribution is:: 5 | 6 | AndroidManifest.xml - (*) android manifest (generated from templates) 7 | assets/ 8 | private.mp3 - (*) fake package that will contain all the python installation 9 | public.mp3 - (*) fake package that will contain your application 10 | bin/ - contain all the apk generated from build.py 11 | blacklist.txt - list of file patterns to not include in the APK 12 | buildlib/ - internals libraries for build.py 13 | build.py - build script to use for packaging your application 14 | build.xml - (*) build settings (generated from templates) 15 | default.properties - settings generated from your distribute.sh 16 | libs/ - contain all the compiled libraries 17 | local.properties - settings generated from your distribute.sh 18 | private/ - private directory containing all the python files 19 | lib/ this is where you can remove or add python libs. 20 | python2.7/ by default, some modules are already removed (tests, idlelib, ...) 21 | project.properties - settings generated from your distribute.sh 22 | python-install/ - the whole python installation, generated from distribute.sh 23 | not included in the final package. 24 | res/ - (*) android resource (generated from build.py) 25 | src/ - Java bootstrap 26 | templates/ - Templates used by build.py 27 | 28 | (*): Theses files are automatically generated from build.py, don't change them directly ! 29 | 30 | 31 | -------------------------------------------------------------------------------- /doc/source/old_toolchain/examples.rst: -------------------------------------------------------------------------------- 1 | Examples 2 | ======== 3 | 4 | Prebuilt VirtualBox 5 | ------------------- 6 | 7 | A good starting point to build an APK are prebuilt VirtualBox images, 8 | where the Android NDK, the Android SDK, and the Kivy 9 | Python-For-Android sources are prebuilt in an VirtualBox image. Please 10 | search the `Download Section `__ for such 11 | an image. You will also need to create a device filter for the Android 12 | USB device using the VirtualBox OS settings. 13 | 14 | .. include:: example_helloworld.rst 15 | .. include:: example_compass.rst 16 | 17 | .. toctree:: 18 | :hidden: 19 | 20 | example_helloworld 21 | example_compass 22 | -------------------------------------------------------------------------------- /doc/source/old_toolchain/faq.rst: -------------------------------------------------------------------------------- 1 | FAQ 2 | === 3 | 4 | arm-linux-androideabi-gcc: Internal error: Killed (program cc1) 5 | --------------------------------------------------------------- 6 | 7 | This could happen if you are not using a validated SDK/NDK with Python for 8 | Android. Go to :doc:`prerequisites.rst` to see which one are working. 9 | 10 | _sqlite3.so not found 11 | --------------------- 12 | 13 | We recently fixed sqlite3 compilation. In case of this error, you 14 | must: 15 | 16 | * Install development headers for sqlite3 if they are not already 17 | installed. On Ubuntu: 18 | 19 | apt-get install libsqlite3-dev 20 | 21 | * Compile the distribution with (sqlite3 must be the first argument):: 22 | 23 | ./distribute.sh -m 'sqlite3 kivy' 24 | 25 | * Go into your distribution at `dist/default` 26 | * Edit blacklist.txt, and remove all the lines concerning sqlite3:: 27 | 28 | sqlite3/* 29 | lib-dynload/_sqlite3.so 30 | 31 | Then sqlite3 will be compiled and included in your APK. 32 | 33 | Too many levels of symbolic links 34 | ----------------------------------------------------- 35 | 36 | Python for Android does not work within a virtual enviroment. The Python for 37 | Android directory must be outside of the virtual enviroment prior to running 38 | 39 | ./distribute.sh -m "kivy" 40 | 41 | or else you may encounter OSError: [Errno 40] Too many levels of symbolic links. -------------------------------------------------------------------------------- /doc/source/old_toolchain/index.rst: -------------------------------------------------------------------------------- 1 | 2 | Old p4a toolchain doc 3 | ===================== 4 | 5 | This is the documentation for the old python-for-android toolchain, 6 | using distribute.sh and build.py. This it entirely superseded by the 7 | new toolchain, you do not need to read it unless using this old 8 | method. 9 | 10 | Python for android is a project to create your own Python distribution 11 | including the modules you want, and create an apk including python, libs, and 12 | your application. 13 | 14 | - Forum: https://groups.google.com/forum/#!forum/python-android 15 | - Mailing list: python-android@googlegroups.com 16 | 17 | .. toctree:: 18 | :maxdepth: 2 19 | 20 | toolchain.rst 21 | examples.rst 22 | android.rst 23 | javaapi.rst 24 | contribute.rst 25 | related.rst 26 | faq.rst 27 | 28 | Indices and tables 29 | ================== 30 | 31 | * :ref:`genindex` 32 | * :ref:`modindex` 33 | * :ref:`search` 34 | 35 | -------------------------------------------------------------------------------- /doc/source/old_toolchain/related.rst: -------------------------------------------------------------------------------- 1 | Related projects 2 | ================ 3 | 4 | - PGS4A: http://pygame.renpy.org/ (thanks to Renpy to make it possible) 5 | - Android scripting: http://code.google.com/p/android-scripting/ 6 | - Python on a chip: http://code.google.com/p/python-on-a-chip/ 7 | 8 | -------------------------------------------------------------------------------- /doc/source/related.rst: -------------------------------------------------------------------------------- 1 | Related projects 2 | ================ 3 | 4 | python-for-android was originally created to package Kivy applications. 5 | -------------------------------------------------------------------------------- /pythonforandroid/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geohot/python-for-android/19500c8c32dd6954a32af9c6eb6bc81cae363e10/pythonforandroid/__init__.py -------------------------------------------------------------------------------- /pythonforandroid/bdist_apk.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function 2 | from setuptools import Command 3 | from pythonforandroid import toolchain 4 | 5 | class BdistAPK(Command): 6 | description = 'Create an APK with python-for-android' 7 | user_options = [] 8 | 9 | def initialize_options(sel): 10 | print('initialising!') 11 | 12 | def finalize_options(self): 13 | print('finalising!') 14 | 15 | def run(self): 16 | print('running!') 17 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geohot/python-for-android/19500c8c32dd6954a32af9c6eb6bc81cae363e10/pythonforandroid/bootstraps/__init__.py -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/empty/__init__.py: -------------------------------------------------------------------------------- 1 | from pythonforandroid.toolchain import Bootstrap 2 | from os.path import join, exists 3 | from os import walk 4 | import glob 5 | import sh 6 | 7 | 8 | class EmptyBootstrap(Bootstrap): 9 | name = 'empty' 10 | 11 | recipe_depends = [] 12 | 13 | can_be_chosen_automatically = False 14 | 15 | def run_distribute(self): 16 | print('empty bootstrap has no distribute') 17 | exit(1) 18 | 19 | bootstrap = EmptyBootstrap() 20 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/EGG-INFO/dependency_links.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/EGG-INFO/entry_points.txt: -------------------------------------------------------------------------------- 1 | 2 | [babel.extractors] 3 | jinja2 = jinja2.ext:babel_extract[i18n] 4 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/EGG-INFO/not-zip-safe: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/EGG-INFO/requires.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | [i18n] 4 | Babel>=0.8 -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/EGG-INFO/top_level.txt: -------------------------------------------------------------------------------- 1 | jinja2 2 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/defaults.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | jinja2.defaults 4 | ~~~~~~~~~~~~~~~ 5 | 6 | Jinja default filters and tags. 7 | 8 | :copyright: (c) 2010 by the Jinja Team. 9 | :license: BSD, see LICENSE for more details. 10 | """ 11 | from jinja2.utils import generate_lorem_ipsum, Cycler, Joiner 12 | 13 | 14 | # defaults for the parser / lexer 15 | BLOCK_START_STRING = '{%' 16 | BLOCK_END_STRING = '%}' 17 | VARIABLE_START_STRING = '{{' 18 | VARIABLE_END_STRING = '}}' 19 | COMMENT_START_STRING = '{#' 20 | COMMENT_END_STRING = '#}' 21 | LINE_STATEMENT_PREFIX = None 22 | LINE_COMMENT_PREFIX = None 23 | TRIM_BLOCKS = False 24 | NEWLINE_SEQUENCE = '\n' 25 | 26 | 27 | # default filters, tests and namespace 28 | from jinja2.filters import FILTERS as DEFAULT_FILTERS 29 | from jinja2.tests import TESTS as DEFAULT_TESTS 30 | DEFAULT_NAMESPACE = { 31 | 'range': xrange, 32 | 'dict': lambda **kw: kw, 33 | 'lipsum': generate_lorem_ipsum, 34 | 'cycler': Cycler, 35 | 'joiner': Joiner 36 | } 37 | 38 | 39 | # export all constants 40 | __all__ = tuple(x for x in locals().keys() if x.isupper()) 41 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/pygame/build/jni/Application.mk: -------------------------------------------------------------------------------- 1 | APP_PROJECT_PATH := $(call my-dir)/.. 2 | 3 | # Available libraries: mad sdl_mixer sdl_image sdl_ttf sdl_net sdl_blitpool sdl_gfx intl 4 | # sdl_mixer depends on tremor and optionally mad 5 | # sdl_image depends on png and jpeg 6 | # sdl_ttf depends on freetype 7 | 8 | APP_MODULES := application sdl sdl_main tremor png jpeg freetype sdl_ttf sdl_image sqlite3 9 | 10 | APP_ABI := $(ARCH) 11 | # AND: I have no idea why I have to specify app_platform when distribute.sh seems to just set the sysroot cflag 12 | # AND: Either way, this has to *at least* be configurable 13 | APP_PLATFORM := android-14 14 | APP_STL := gnustl_static 15 | APP_CFLAGS += $(OFLAG) 16 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/pygame/build/jni/application/sdl-config: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | LOCAL_PATH=`dirname $0` 4 | LOCAL_PATH=`cd $LOCAL_PATH && pwd` 5 | 6 | prefix=$LOCAL_PATH/../sdl 7 | exec_prefix=$LOCAL_PATH/../../bin/ndk/local/$ARCH 8 | exec_prefix_set=no 9 | 10 | #usage="\ 11 | #Usage: sdl-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs]" 12 | usage="\ 13 | Usage: sdl-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs] [--static-libs]" 14 | 15 | if test $# -eq 0; then 16 | echo "${usage}" 1>&2 17 | exit 1 18 | fi 19 | 20 | while test $# -gt 0; do 21 | case "$1" in 22 | -*=*) optarg=`echo "$1" | LC_ALL="C" sed 's/[-_a-zA-Z0-9]*=//'` ;; 23 | *) optarg= ;; 24 | esac 25 | 26 | case $1 in 27 | --prefix=*) 28 | prefix=$optarg 29 | if test $exec_prefix_set = no ; then 30 | exec_prefix=$optarg 31 | fi 32 | ;; 33 | --prefix) 34 | echo $prefix 35 | ;; 36 | --exec-prefix=*) 37 | exec_prefix=$optarg 38 | exec_prefix_set=yes 39 | ;; 40 | --exec-prefix) 41 | echo $exec_prefix 42 | ;; 43 | --version) 44 | echo 1.2.14 45 | ;; 46 | --cflags) 47 | echo -I${prefix}/include -D_GNU_SOURCE=1 -D_REENTRANT 48 | ;; 49 | --libs) 50 | echo -L${exec_prefix} -lsdl 51 | ;; 52 | --static-libs) 53 | # --libs|--static-libs) 54 | echo -L${exec_prefix} -lsdl 55 | ;; 56 | *) 57 | echo "${usage}" 1>&2 58 | exit 1 59 | ;; 60 | esac 61 | shift 62 | done 63 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/pygame/build/jni/application/src/jniwrapperstuff.h: -------------------------------------------------------------------------------- 1 | 2 | /* JNI-C++ wrapper stuff */ 3 | #ifndef _JNI_WRAPPER_STUFF_H_ 4 | #define _JNI_WRAPPER_STUFF_H_ 5 | 6 | #ifndef SDL_JAVA_PACKAGE_PATH 7 | #error You have to define SDL_JAVA_PACKAGE_PATH to your package path with dots replaced with underscores, for example "com_example_SanAngeles" 8 | #endif 9 | #define JAVA_EXPORT_NAME2(name,package) Java_##package##_##name 10 | #define JAVA_EXPORT_NAME1(name,package) JAVA_EXPORT_NAME2(name,package) 11 | #define JAVA_EXPORT_NAME(name) JAVA_EXPORT_NAME1(name,SDL_JAVA_PACKAGE_PATH) 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/pygame/build/local.properties: -------------------------------------------------------------------------------- 1 | sdk.dir=/opt/android-sdk 2 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/pygame/build/res/drawable/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geohot/python-for-android/19500c8c32dd6954a32af9c6eb6bc81cae363e10/pythonforandroid/bootstraps/pygame/build/res/drawable/icon.png -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/pygame/build/res/drawable/presplash.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geohot/python-for-android/19500c8c32dd6954a32af9c6eb6bc81cae363e10/pythonforandroid/bootstraps/pygame/build/res/drawable/presplash.jpg -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/pygame/build/res/layout/chooser_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 15 | 16 | 21 | 22 | 30 | 31 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/pygame/build/res/layout/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/pygame/build/res/layout/project_chooser.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 14 | 15 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/pygame/build/res/layout/project_empty.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/pygame/build/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Kivy Launcher 4 | Kivy Launcher 5 | 6 | 1323531558.3 7 | 8 | 9 | kivy 10 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/pygame/build/src/com/android/vending/billing/IMarketBillingService.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.vending.billing; 18 | 19 | import android.os.Bundle; 20 | 21 | interface IMarketBillingService { 22 | /** Given the arguments in bundle form, returns a bundle for results. */ 23 | Bundle sendBillingRequest(in Bundle bundle); 24 | } 25 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/pygame/build/src/org/kamranzafar/jtar/TarConstants.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Kamran Zafar 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.kamranzafar.jtar; 19 | 20 | /** 21 | * @author Kamran Zafar 22 | * 23 | */ 24 | public class TarConstants { 25 | public static final int EOF_BLOCK = 1024; 26 | public static final int DATA_BLOCK = 512; 27 | public static final int HEADER_BLOCK = 512; 28 | } 29 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/pygame/build/src/org/renpy/android/Action.java: -------------------------------------------------------------------------------- 1 | package org.renpy.android; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.net.Uri; 6 | import android.app.Activity; 7 | import android.util.Log; 8 | 9 | public class Action { 10 | 11 | static Context context; 12 | 13 | /* Deliver some data to someone else 14 | */ 15 | static void send(String mimeType, String filename, String subject, String text, String chooser_title) { 16 | Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); 17 | emailIntent.setType(mimeType); 18 | /** tryied with String [] emails, but hard to code the whole C/Cython part. 19 | if (emails != null) 20 | emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, emails); 21 | **/ 22 | if (subject != null) 23 | emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject); 24 | if (text != null) 25 | emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, text); 26 | if (filename != null) 27 | emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://"+ filename)); 28 | if (chooser_title == null) 29 | chooser_title = "Send mail"; 30 | context.startActivity(Intent.createChooser(emailIntent, chooser_title)); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/pygame/build/src/org/renpy/android/GenericBroadcastReceiver.java: -------------------------------------------------------------------------------- 1 | package org.renpy.android; 2 | 3 | import android.content.BroadcastReceiver; 4 | import android.content.Intent; 5 | import android.content.Context; 6 | 7 | public class GenericBroadcastReceiver extends BroadcastReceiver { 8 | 9 | GenericBroadcastReceiverCallback listener; 10 | 11 | public GenericBroadcastReceiver(GenericBroadcastReceiverCallback listener) { 12 | super(); 13 | this.listener = listener; 14 | } 15 | 16 | public void onReceive(Context context, Intent intent) { 17 | this.listener.onReceive(context, intent); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/pygame/build/src/org/renpy/android/GenericBroadcastReceiverCallback.java: -------------------------------------------------------------------------------- 1 | package org.renpy.android; 2 | 3 | import android.content.Intent; 4 | import android.content.Context; 5 | 6 | public interface GenericBroadcastReceiverCallback { 7 | void onReceive(Context context, Intent intent); 8 | }; 9 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/pygame/build/src/org/renpy/android/ProjectAdapter.java: -------------------------------------------------------------------------------- 1 | package org.renpy.android; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | import android.view.View; 6 | import android.view.ViewGroup; 7 | import android.view.Gravity; 8 | import android.widget.ArrayAdapter; 9 | import android.widget.TextView; 10 | import android.widget.LinearLayout; 11 | import android.widget.ImageView; 12 | import android.graphics.Bitmap; 13 | import android.graphics.BitmapFactory; 14 | import android.util.Log; 15 | 16 | public class ProjectAdapter extends ArrayAdapter { 17 | 18 | private Activity mContext; 19 | private ResourceManager resourceManager; 20 | 21 | 22 | public ProjectAdapter(Activity context) { 23 | super(context, 0); 24 | 25 | mContext = context; 26 | resourceManager = new ResourceManager(context); 27 | } 28 | 29 | public View getView(int position, View convertView, ViewGroup parent) { 30 | Project p = getItem(position); 31 | 32 | View v = resourceManager.inflateView("chooser_item"); 33 | TextView title = (TextView) resourceManager.getViewById(v, "title"); 34 | TextView author = (TextView) resourceManager.getViewById(v, "author"); 35 | ImageView icon = (ImageView) resourceManager.getViewById(v, "icon"); 36 | 37 | title.setText(p.title); 38 | author.setText(p.author); 39 | icon.setImageBitmap(p.icon); 40 | 41 | return v; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/pygame/build/src/org/renpy/android/ResourceManager.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class takes care of managing resources for us. In our code, we 3 | * can't use R, since the name of the package containing R will 4 | * change. (This same code is used in both org.renpy.android and 5 | * org.renpy.pygame.) So this is the next best thing. 6 | */ 7 | 8 | package org.renpy.android; 9 | 10 | import android.app.Activity; 11 | import android.content.res.Resources; 12 | import android.view.View; 13 | 14 | public class ResourceManager { 15 | 16 | private Activity act; 17 | private Resources res; 18 | 19 | public ResourceManager(Activity activity) { 20 | act = activity; 21 | res = act.getResources(); 22 | } 23 | 24 | public int getIdentifier(String name, String kind) { 25 | return res.getIdentifier(name, kind, act.getPackageName()); 26 | } 27 | 28 | public String getString(String name) { 29 | 30 | try { 31 | return res.getString(getIdentifier(name, "string")); 32 | } catch (Exception e) { 33 | return null; 34 | } 35 | } 36 | 37 | public View inflateView(String name) { 38 | int id = getIdentifier(name, "layout"); 39 | return act.getLayoutInflater().inflate(id, null); 40 | } 41 | 42 | public View getViewById(View v, String name) { 43 | int id = getIdentifier(name, "id"); 44 | return v.findViewById(id); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/pygame/build/src/org/renpy/android/billing/util/Base64DecoderException.java: -------------------------------------------------------------------------------- 1 | // Copyright 2002, Google, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package org.renpy.android.billing.util; 16 | 17 | /** 18 | * Exception thrown when encountering an invalid Base64 input character. 19 | * 20 | * @author nelson 21 | */ 22 | public class Base64DecoderException extends Exception { 23 | public Base64DecoderException() { 24 | super(); 25 | } 26 | 27 | public Base64DecoderException(String s) { 28 | super(s); 29 | } 30 | 31 | private static final long serialVersionUID = 1L; 32 | } 33 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/pygame/build/templates/Configuration.tmpl.java: -------------------------------------------------------------------------------- 1 | // Autogenerated file by build.py, don't change! 2 | 3 | package org.renpy.android; 4 | 5 | public class Configuration { 6 | {% if args.billing_pubkey %} 7 | static public boolean use_billing = true; 8 | static public String billing_pubkey = "{{ args.billing_pubkey }}"; 9 | {% else %} 10 | static public boolean use_billing = false; 11 | static public String billing_pubkey = null; 12 | {% endif %} 13 | static public byte billing_salt[] = new byte[] {41, -90, -116, -41, 66, -53, 122, -110, -127, -96, -88, 77, 127, 115, 1, 73, 57, 110, 48, -116}; 14 | } 15 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/pygame/build/templates/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/pygame/build/templates/kivy-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geohot/python-for-android/19500c8c32dd6954a32af9c6eb6bc81cae363e10/pythonforandroid/bootstraps/pygame/build/templates/kivy-icon.png -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/pygame/build/templates/kivy-ouya-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geohot/python-for-android/19500c8c32dd6954a32af9c6eb6bc81cae363e10/pythonforandroid/bootstraps/pygame/build/templates/kivy-ouya-icon.png -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/pygame/build/templates/kivy-presplash.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geohot/python-for-android/19500c8c32dd6954a32af9c6eb6bc81cae363e10/pythonforandroid/bootstraps/pygame/build/templates/kivy-presplash.jpg -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/pygame/build/templates/launcher-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geohot/python-for-android/19500c8c32dd6954a32af9c6eb6bc81cae363e10/pythonforandroid/bootstraps/pygame/build/templates/launcher-icon.png -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/pygame/build/templates/launcher-presplash.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geohot/python-for-android/19500c8c32dd6954a32af9c6eb6bc81cae363e10/pythonforandroid/bootstraps/pygame/build/templates/launcher-presplash.jpg -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/pygame/build/templates/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | {{args.name}} 4 | {{args.icon_name}} 5 | {% if private_version %} 6 | {{ private_version }} 7 | {% endif %} 8 | {% if public_version %} 9 | {{ public_version }} 10 | {% endif %} 11 | {{ url_scheme }} 12 | {% for m in args.resource %} 13 | {{ m.split('=', 1)[-1] }} 14 | {% endfor %} 15 | 16 | 17 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/pygame/build/tools/biglink: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from __future__ import print_function 4 | import os 5 | import sys 6 | import subprocess 7 | 8 | sofiles = [ ] 9 | 10 | for directory in sys.argv[2:]: 11 | 12 | for fn in os.listdir(directory): 13 | fn = os.path.join(directory, fn) 14 | 15 | if not fn.endswith(".so.o"): 16 | continue 17 | if not os.path.exists(fn[:-2] + ".libs"): 18 | continue 19 | 20 | sofiles.append(fn[:-2]) 21 | 22 | # The raw argument list. 23 | args = [ ] 24 | 25 | for fn in sofiles: 26 | afn = fn + ".o" 27 | libsfn = fn + ".libs" 28 | 29 | args.append(afn) 30 | with open(libsfn) as fd: 31 | data = fd.read() 32 | args.extend(data.split(" ")) 33 | 34 | unique_args = [ ] 35 | while args: 36 | a = args.pop() 37 | if a in ('-L', ): 38 | continue 39 | if a not in unique_args: 40 | unique_args.insert(0, a) 41 | 42 | 43 | print('Biglink create %s library' % sys.argv[1]) 44 | print('Biglink arguments:') 45 | for arg in unique_args: 46 | print(' %s' % arg) 47 | 48 | args = os.environ['CC'].split() + \ 49 | ['-shared', '-O3', '-o', sys.argv[1]] + \ 50 | unique_args 51 | 52 | sys.exit(subprocess.call(args)) 53 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/pygame/build/tools/liblink: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from __future__ import print_function 4 | import sys 5 | import subprocess 6 | from os import environ 7 | from os.path import basename, join 8 | 9 | libs = [ ] 10 | objects = [ ] 11 | output = None 12 | 13 | 14 | i = 1 15 | while i < len(sys.argv): 16 | opt = sys.argv[i] 17 | i += 1 18 | 19 | if opt == "-o": 20 | output = sys.argv[i] 21 | i += 1 22 | continue 23 | 24 | if opt.startswith("-l") or opt.startswith("-L"): 25 | libs.append(opt) 26 | continue 27 | 28 | if opt in ("-r", "-pipe", "-no-cpp-precomp"): 29 | continue 30 | 31 | if opt in ("--sysroot", "-isysroot", "-framework", "-undefined", 32 | "-macosx_version_min"): 33 | i += 1 34 | continue 35 | 36 | if opt.startswith("-I"): 37 | continue 38 | 39 | if opt.startswith("-m"): 40 | continue 41 | 42 | if opt.startswith("-f"): 43 | continue 44 | 45 | if opt.startswith("-O"): 46 | continue 47 | 48 | if opt.startswith("-g"): 49 | continue 50 | 51 | if opt.startswith("-D"): 52 | continue 53 | 54 | if opt.startswith("-"): 55 | print(sys.argv) 56 | print("Unknown option: %s" % opt) 57 | sys.exit(1) 58 | 59 | if not opt.endswith('.o'): 60 | continue 61 | 62 | objects.append(opt) 63 | 64 | 65 | f = open(output, "w") 66 | f.close() 67 | 68 | output = join(environ.get('LIBLINK_PATH'), basename(output)) 69 | 70 | f = open(output + ".libs", "w") 71 | f.write(" ".join(libs)) 72 | f.close() 73 | 74 | sys.exit(subprocess.call([ 75 | environ.get('LD'), '-r', 76 | '-o', output + '.o' 77 | #, '-arch', environ.get('ARCH') 78 | ] + objects)) 79 | 80 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/pygame/build/tools/liblink-jb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from __future__ import print_function 4 | import sys 5 | import subprocess 6 | from os import environ 7 | from os.path import basename, join 8 | 9 | libs = [ ] 10 | libdirs = [ ] 11 | output = None 12 | 13 | 14 | i = 1 15 | while i < len(sys.argv): 16 | opt = sys.argv[i] 17 | i += 1 18 | 19 | if opt == "-o": 20 | output = sys.argv[i] 21 | i ++ 1 22 | continue 23 | 24 | if opt.startswith("-l"): 25 | libs.append(opt[2:]) 26 | continue 27 | 28 | if opt.startswith("-L"): 29 | libdirs.append(opt[2:]) 30 | continue 31 | 32 | output = join(environ.get('LIBLINK_PATH'), basename(output)) 33 | 34 | with open(output + ".libs", "w") as f: 35 | f.write("\n".join(libs)) 36 | 37 | with open(output + ".libdirs", "w") as f: 38 | f.write("\n".join(libdirs)) 39 | 40 | 41 | libargs = ' '.join(["'%s'" % arg for arg in sys.argv[1:]]) 42 | cmd = '%s -shared %s %s' % (environ['CC'], environ['LDFLAGS'], libargs) 43 | sys.exit(subprocess.call(cmd, shell=True)) 44 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/pygame/build/whitelist.txt: -------------------------------------------------------------------------------- 1 | # put files here that you need to un-blacklist 2 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/sdl2/build/ant.properties: -------------------------------------------------------------------------------- 1 | # This file is used to override default values used by the Ant build system. 2 | # 3 | # This file must be checked into Version Control Systems, as it is 4 | # integral to the build system of your project. 5 | 6 | # This file is only used by the Ant script. 7 | 8 | # You can use this to override default values such as 9 | # 'source.dir' for the location of your java source folder and 10 | # 'out.dir' for the location of your output folder. 11 | 12 | # You can also use it define how the release builds are signed by declaring 13 | # the following properties: 14 | # 'key.store' for the location of your keystore and 15 | # 'key.alias' for the name of the key to use. 16 | # The password will be asked during the build when you use the 'release' target. 17 | 18 | source.absolute.dir = tmp-src 19 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/sdl2/build/build.properties: -------------------------------------------------------------------------------- 1 | # This file is used to override default values used by the Ant build system. 2 | # 3 | # This file must be checked in Version Control Systems, as it is 4 | # integral to the build system of your project. 5 | 6 | # This file is only used by the Ant script. 7 | 8 | # You can use this to override default values such as 9 | # 'source.dir' for the location of your java source folder and 10 | # 'out.dir' for the location of your output folder. 11 | 12 | # You can also use it define how the release builds are signed by declaring 13 | # the following properties: 14 | # 'key.store' for the location of your keystore and 15 | # 'key.alias' for the name of the key to use. 16 | # The password will be asked during the build when you use the 'release' target. 17 | 18 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/sdl2/build/jni/Android.mk: -------------------------------------------------------------------------------- 1 | include $(call all-subdir-makefiles) 2 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/sdl2/build/jni/Application.mk: -------------------------------------------------------------------------------- 1 | 2 | # Uncomment this if you're using STL in your project 3 | # See CPLUSPLUS-SUPPORT.html in the NDK documentation for more information 4 | # APP_STL := stlport_static 5 | 6 | # APP_ABI := armeabi armeabi-v7a x86 7 | APP_ABI := $(ARCH) 8 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/sdl2/build/jni/src/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_MODULE := main 6 | 7 | SDL_PATH := ../SDL 8 | 9 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/$(SDL_PATH)/include 10 | 11 | # Add your application source files here... 12 | LOCAL_SRC_FILES := $(SDL_PATH)/src/main/android/SDL_android_main.c \ 13 | start.c 14 | 15 | LOCAL_CFLAGS += -I$(LOCAL_PATH)/../../../../other_builds/$(PYTHON2_NAME)/$(ARCH)/python2/python-install/include/python2.7 $(EXTRA_CFLAGS) 16 | 17 | LOCAL_SHARED_LIBRARIES := SDL2 python_shared 18 | 19 | LOCAL_LDLIBS := -lGLESv1_CM -lGLESv2 -llog $(EXTRA_LDLIBS) 20 | 21 | LOCAL_LDFLAGS += -L$(LOCAL_PATH)/../../../../other_builds/$(PYTHON2_NAME)/$(ARCH)/python2/python-install/lib $(APPLICATION_ADDITIONAL_LDFLAGS) 22 | 23 | include $(BUILD_SHARED_LIBRARY) 24 | 25 | ifdef CRYSTAX_PYTHON_VERSION 26 | $(call import-module,python/$(CRYSTAX_PYTHON_VERSION)) 27 | endif 28 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/sdl2/build/jni/src/Android_static.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_MODULE := main 6 | 7 | LOCAL_SRC_FILES := YourSourceHere.c 8 | 9 | LOCAL_STATIC_LIBRARIES := SDL2_static 10 | 11 | include $(BUILD_SHARED_LIBRARY) 12 | $(call import-module,SDL)LOCAL_PATH := $(call my-dir) 13 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/sdl2/build/proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/sdl2/build/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geohot/python-for-android/19500c8c32dd6954a32af9c6eb6bc81cae363e10/pythonforandroid/bootstraps/sdl2/build/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/sdl2/build/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geohot/python-for-android/19500c8c32dd6954a32af9c6eb6bc81cae363e10/pythonforandroid/bootstraps/sdl2/build/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/sdl2/build/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geohot/python-for-android/19500c8c32dd6954a32af9c6eb6bc81cae363e10/pythonforandroid/bootstraps/sdl2/build/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/sdl2/build/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geohot/python-for-android/19500c8c32dd6954a32af9c6eb6bc81cae363e10/pythonforandroid/bootstraps/sdl2/build/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/sdl2/build/res/drawable/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geohot/python-for-android/19500c8c32dd6954a32af9c6eb6bc81cae363e10/pythonforandroid/bootstraps/sdl2/build/res/drawable/.gitkeep -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/sdl2/build/res/drawable/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geohot/python-for-android/19500c8c32dd6954a32af9c6eb6bc81cae363e10/pythonforandroid/bootstraps/sdl2/build/res/drawable/icon.png -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/sdl2/build/res/layout/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/sdl2/build/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | SDL App 4 | 0.1 5 | 6 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/sdl2/build/src/org/kamranzafar/jtar/TarConstants.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Kamran Zafar 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package org.kamranzafar.jtar; 19 | 20 | /** 21 | * @author Kamran Zafar 22 | * 23 | */ 24 | public class TarConstants { 25 | public static final int EOF_BLOCK = 1024; 26 | public static final int DATA_BLOCK = 512; 27 | public static final int HEADER_BLOCK = 512; 28 | } 29 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/sdl2/build/src/org/kivy/android/GenericBroadcastReceiver.java: -------------------------------------------------------------------------------- 1 | package org.kivy.android; 2 | 3 | import android.content.BroadcastReceiver; 4 | import android.content.Intent; 5 | import android.content.Context; 6 | 7 | public class GenericBroadcastReceiver extends BroadcastReceiver { 8 | 9 | GenericBroadcastReceiverCallback listener; 10 | 11 | public GenericBroadcastReceiver(GenericBroadcastReceiverCallback listener) { 12 | super(); 13 | this.listener = listener; 14 | } 15 | 16 | public void onReceive(Context context, Intent intent) { 17 | this.listener.onReceive(context, intent); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/sdl2/build/src/org/kivy/android/GenericBroadcastReceiverCallback.java: -------------------------------------------------------------------------------- 1 | package org.kivy.android; 2 | 3 | import android.content.Intent; 4 | import android.content.Context; 5 | 6 | public interface GenericBroadcastReceiverCallback { 7 | void onReceive(Context context, Intent intent); 8 | }; 9 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/sdl2/build/src/org/kivy/android/PythonUtil.java: -------------------------------------------------------------------------------- 1 | package org.kivy.android; 2 | 3 | import java.io.File; 4 | 5 | import android.util.Log; 6 | 7 | 8 | public class PythonUtil { 9 | private static final String TAG = "PythonUtil"; 10 | 11 | protected static String[] getLibraries() { 12 | return new String[] { 13 | "SDL2", 14 | "SDL2_image", 15 | "SDL2_mixer", 16 | "SDL2_ttf", 17 | "python2.7", 18 | "python3.5m", 19 | "main" 20 | }; 21 | } 22 | 23 | public static void loadLibraries(File filesDir) { 24 | 25 | String filesDirPath = filesDir.getAbsolutePath(); 26 | boolean skippedPython = false; 27 | 28 | for (String lib : getLibraries()) { 29 | try { 30 | System.loadLibrary(lib); 31 | } catch(UnsatisfiedLinkError e) { 32 | if (lib.startsWith("python") && !skippedPython) { 33 | skippedPython = true; 34 | continue; 35 | } 36 | throw e; 37 | } 38 | } 39 | 40 | try { 41 | System.load(filesDirPath + "/lib/python2.7/lib-dynload/_io.so"); 42 | System.load(filesDirPath + "/lib/python2.7/lib-dynload/unicodedata.so"); 43 | } catch(UnsatisfiedLinkError e) { 44 | Log.v(TAG, "Failed to load _io.so or unicodedata.so...but that's okay."); 45 | } 46 | 47 | try { 48 | // System.loadLibrary("ctypes"); 49 | System.load(filesDirPath + "/lib/python2.7/lib-dynload/_ctypes.so"); 50 | } catch(UnsatisfiedLinkError e) { 51 | Log.v(TAG, "Unsatisfied linker when loading ctypes"); 52 | } 53 | 54 | Log.v(TAG, "Loaded everything!"); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/sdl2/build/src/org/kivy/android/concurrency/PythonEvent.java: -------------------------------------------------------------------------------- 1 | package org.kivy.android.concurrency; 2 | 3 | import java.util.concurrent.locks.Condition; 4 | import java.util.concurrent.locks.Lock; 5 | import java.util.concurrent.locks.ReentrantLock; 6 | 7 | /** 8 | * Created by ryan on 3/28/14. 9 | */ 10 | public class PythonEvent { 11 | private final Lock lock = new ReentrantLock(); 12 | private final Condition cond = lock.newCondition(); 13 | private boolean flag = false; 14 | 15 | public void set() { 16 | lock.lock(); 17 | try { 18 | flag = true; 19 | cond.signalAll(); 20 | } finally { 21 | lock.unlock(); 22 | } 23 | } 24 | 25 | public void wait_() throws InterruptedException { 26 | lock.lock(); 27 | try { 28 | while (!flag) { 29 | cond.await(); 30 | } 31 | } finally { 32 | lock.unlock(); 33 | } 34 | } 35 | 36 | public void clear() { 37 | lock.lock(); 38 | try { 39 | flag = false; 40 | cond.signalAll(); 41 | } finally { 42 | lock.unlock(); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/sdl2/build/src/org/kivy/android/concurrency/PythonLock.java: -------------------------------------------------------------------------------- 1 | package org.kivy.android.concurrency; 2 | 3 | import java.util.concurrent.locks.Lock; 4 | import java.util.concurrent.locks.ReentrantLock; 5 | 6 | /** 7 | * Created by ryan on 3/28/14. 8 | */ 9 | public class PythonLock { 10 | private final Lock lock = new ReentrantLock(); 11 | 12 | public void acquire() { 13 | lock.lock(); 14 | } 15 | 16 | public void release() { 17 | lock.unlock(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/sdl2/build/src/org/renpy/android/PythonActivity.java: -------------------------------------------------------------------------------- 1 | package org.renpy.android; 2 | 3 | import android.util.Log; 4 | 5 | class PythonActivity extends org.kivy.android.PythonActivity { 6 | static { 7 | Log.w("PythonActivity", "Accessing org.renpy.android.PythonActivity " 8 | + "is deprecated and will be removed in a " 9 | + "future version. Please switch to " 10 | + "org.kivy.android.PythonActivity."); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/sdl2/build/src/org/renpy/android/PythonService.java: -------------------------------------------------------------------------------- 1 | package org.renpy.android; 2 | 3 | import android.util.Log; 4 | 5 | class PythonService extends org.kivy.android.PythonService { 6 | static { 7 | Log.w("PythonService", "Accessing org.renpy.android.PythonService " 8 | + "is deprecated and will be removed in a " 9 | + "future version. Please switch to " 10 | + "org.kivy.android.PythonService."); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/sdl2/build/src/org/renpy/android/ResourceManager.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class takes care of managing resources for us. In our code, we 3 | * can't use R, since the name of the package containing R will 4 | * change. (This same code is used in both org.renpy.android and 5 | * org.renpy.pygame.) So this is the next best thing. 6 | */ 7 | 8 | package org.renpy.android; 9 | 10 | import android.app.Activity; 11 | import android.content.res.Resources; 12 | import android.view.View; 13 | 14 | import android.util.Log; 15 | 16 | public class ResourceManager { 17 | 18 | private Activity act; 19 | private Resources res; 20 | 21 | public ResourceManager(Activity activity) { 22 | act = activity; 23 | res = act.getResources(); 24 | } 25 | 26 | public int getIdentifier(String name, String kind) { 27 | Log.v("SDL", "getting identifier"); 28 | Log.v("SDL", "kind is " + kind + " and name " + name); 29 | Log.v("SDL", "result is " + res.getIdentifier(name, kind, act.getPackageName())); 30 | return res.getIdentifier(name, kind, act.getPackageName()); 31 | } 32 | 33 | public String getString(String name) { 34 | 35 | try { 36 | Log.v("SDL", "asked to get string " + name); 37 | return res.getString(getIdentifier(name, "string")); 38 | } catch (Exception e) { 39 | Log.v("SDL", "got exception looking for string!"); 40 | return null; 41 | } 42 | } 43 | 44 | public View inflateView(String name) { 45 | int id = getIdentifier(name, "layout"); 46 | return act.getLayoutInflater().inflate(id, null); 47 | } 48 | 49 | public View getViewById(View v, String name) { 50 | int id = getIdentifier(name, "id"); 51 | return v.findViewById(id); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/sdl2/build/templates/custom_rules.tmpl.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | {% for dir, includes in args.extra_source_dirs %} 7 | 8 | {% endfor %} 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/sdl2/build/templates/kivy-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geohot/python-for-android/19500c8c32dd6954a32af9c6eb6bc81cae363e10/pythonforandroid/bootstraps/sdl2/build/templates/kivy-icon.png -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/sdl2/build/templates/kivy-presplash.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geohot/python-for-android/19500c8c32dd6954a32af9c6eb6bc81cae363e10/pythonforandroid/bootstraps/sdl2/build/templates/kivy-presplash.jpg -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/sdl2/build/templates/strings.tmpl.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | {{ args.name }} 4 | 0.1 5 | 6 | -------------------------------------------------------------------------------- /pythonforandroid/bootstraps/sdl2/build/whitelist.txt: -------------------------------------------------------------------------------- 1 | # put files here that you need to un-blacklist 2 | -------------------------------------------------------------------------------- /pythonforandroid/includes/arm64-v8a/machine/cpu-features.h: -------------------------------------------------------------------------------- 1 | #ifndef _ARM64_CPU_FEATURES 2 | #define _ARM64_CPU_FEATURES 3 | 4 | #define __ARM_ARCH__ 8 5 | #define __ARM_HAVE_HALFWORD_MULTIPLY 1 6 | 7 | #endif // _ARM64_CPU_FEATURES 8 | -------------------------------------------------------------------------------- /pythonforandroid/patching.py: -------------------------------------------------------------------------------- 1 | from os import uname 2 | 3 | 4 | def check_all(*callables): 5 | def check(**kwargs): 6 | return all(c(**kwargs) for c in callables) 7 | return check 8 | 9 | 10 | def check_any(*callables): 11 | def check(**kwargs): 12 | return any(c(**kwargs) for c in callables) 13 | return check 14 | 15 | 16 | def is_platform(platform): 17 | def is_x(**kwargs): 18 | return uname()[0] == platform 19 | return is_x 20 | 21 | is_linux = is_platform('Linux') 22 | is_darwin = is_platform('Darwin') 23 | 24 | 25 | def is_arch(xarch): 26 | def is_x(arch, **kwargs): 27 | return arch.arch == xarch 28 | return is_x 29 | 30 | 31 | def is_api_gt(apiver): 32 | def is_x(recipe, **kwargs): 33 | return recipe.ctx.android_api > apiver 34 | return is_x 35 | 36 | 37 | def is_api_gte(apiver): 38 | def is_x(recipe, **kwargs): 39 | return recipe.ctx.android_api >= apiver 40 | return is_x 41 | 42 | 43 | def is_api_lt(apiver): 44 | def is_x(recipe, **kwargs): 45 | return recipe.ctx.android_api < apiver 46 | return is_x 47 | 48 | 49 | def is_api_lte(apiver): 50 | def is_x(recipe, **kwargs): 51 | return recipe.ctx.android_api <= apiver 52 | return is_x 53 | 54 | 55 | def is_api(apiver): 56 | def is_x(recipe, **kwargs): 57 | return recipe.ctx.android_api == apiver 58 | return is_x 59 | 60 | 61 | def will_build(recipe_name): 62 | def will(recipe, **kwargs): 63 | return recipe_name in recipe.ctx.recipe_build_order 64 | return will 65 | 66 | 67 | def is_ndk(ndk): 68 | def is_x(recipe, **kwargs): 69 | return recipe.ctx.ndk == ndk 70 | return is_x 71 | 72 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geohot/python-for-android/19500c8c32dd6954a32af9c6eb6bc81cae363e10/pythonforandroid/recipes/__init__.py -------------------------------------------------------------------------------- /pythonforandroid/recipes/android/recipe.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | VERSION_android= 4 | URL_android= 5 | DEPS_android=(pygame) 6 | MD5_android= 7 | BUILD_android=$BUILD_PATH/android/android 8 | RECIPE_android=$RECIPES_PATH/android 9 | 10 | function prebuild_android() { 11 | cd $BUILD_PATH/android 12 | 13 | rm -rf android 14 | if [ ! -d android ]; then 15 | try cp -a $RECIPE_android/src $BUILD_android 16 | fi 17 | } 18 | 19 | function shouldbuild_android() { 20 | if [ -d "$SITEPACKAGES_PATH/android" ]; then 21 | DO_BUILD=0 22 | fi 23 | } 24 | 25 | function build_android() { 26 | cd $BUILD_android 27 | 28 | # if the last step have been done, avoid all 29 | if [ -f .done ]; then 30 | return 31 | fi 32 | 33 | push_arm 34 | 35 | export LDFLAGS="$LDFLAGS -L$LIBS_PATH" 36 | export LDSHARED="$LIBLINK" 37 | 38 | # cythonize 39 | try find . -iname '*.pyx' -exec $CYTHON {} \; 40 | try $HOSTPYTHON setup.py build_ext -v 41 | try $HOSTPYTHON setup.py install -O2 42 | 43 | unset LDSHARED 44 | 45 | touch .done 46 | pop_arm 47 | } 48 | 49 | function postbuild_android() { 50 | true 51 | } 52 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/android/src/android/__init__.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Android module 3 | ============== 4 | 5 | ''' 6 | 7 | # legacy import 8 | from android._android import * 9 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/android/src/android/billing.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Android Billing API 3 | =================== 4 | 5 | ''' 6 | 7 | from android._android_billing import * 8 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/android/src/android/runnable.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Runnable 3 | ======== 4 | 5 | ''' 6 | 7 | from jnius import PythonJavaClass, java_method, autoclass 8 | from android.config import JAVA_NAMESPACE 9 | 10 | # reference to the activity 11 | _PythonActivity = autoclass(JAVA_NAMESPACE + '.PythonActivity') 12 | 13 | 14 | class Runnable(PythonJavaClass): 15 | '''Wrapper around Java Runnable class. This class can be used to schedule a 16 | call of a Python function into the PythonActivity thread. 17 | ''' 18 | 19 | __javainterfaces__ = ['java/lang/Runnable'] 20 | __runnables__ = [] 21 | 22 | def __init__(self, func): 23 | super(Runnable, self).__init__() 24 | self.func = func 25 | 26 | def __call__(self, *args, **kwargs): 27 | self.args = args 28 | self.kwargs = kwargs 29 | Runnable.__runnables__.append(self) 30 | _PythonActivity.mActivity.runOnUiThread(self) 31 | 32 | @java_method('()V') 33 | def run(self): 34 | try: 35 | self.func(*self.args, **self.kwargs) 36 | except: 37 | import traceback 38 | traceback.print_exc() 39 | 40 | Runnable.__runnables__.remove(self) 41 | 42 | def run_on_ui_thread(f): 43 | '''Decorator to create automatically a :class:`Runnable` object with the 44 | function. The function will be delayed and call into the Activity thread. 45 | ''' 46 | def f2(*args, **kwargs): 47 | Runnable(f)(*args, **kwargs) 48 | return f2 49 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/android/src/setup.py: -------------------------------------------------------------------------------- 1 | from distutils.core import setup, Extension 2 | import os 3 | 4 | library_dirs = ['libs/' + os.environ['ARCH']] 5 | lib_dict = { 6 | 'pygame': ['sdl'], 7 | 'sdl2': ['SDL2', 'SDL2_image', 'SDL2_mixer', 'SDL2_ttf'] 8 | } 9 | sdl_libs = lib_dict[os.environ['BOOTSTRAP']] 10 | 11 | renpy_sound = Extension('android._android_sound', 12 | ['android/_android_sound.c', 'android/_android_sound_jni.c', ], 13 | libraries=sdl_libs + ['log'], 14 | library_dirs=library_dirs) 15 | 16 | modules = [Extension('android._android', 17 | ['android/_android.c', 'android/_android_jni.c'], 18 | libraries=sdl_libs + ['log'], 19 | library_dirs=library_dirs), 20 | Extension('android._android_billing', 21 | ['android/_android_billing.c', 'android/_android_billing_jni.c'], 22 | libraries=['log'], 23 | library_dirs=library_dirs)] 24 | 25 | if int(os.environ['IS_PYGAME']): 26 | modules.append(renpy_sound) 27 | 28 | 29 | setup(name='android', 30 | version='1.0', 31 | packages=['android'], 32 | package_dir={'android': 'android'}, 33 | ext_modules=modules 34 | ) 35 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/audiostream/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | from pythonforandroid.toolchain import CythonRecipe, shprint, current_directory, info 3 | import sh 4 | import glob 5 | from os.path import join, exists 6 | 7 | 8 | class AudiostreamRecipe(CythonRecipe): 9 | version = 'master' 10 | url = 'https://github.com/kivy/audiostream/archive/{version}.zip' 11 | name = 'audiostream' 12 | depends = ['python2', ('sdl', 'sdl2'), 'pyjnius'] 13 | 14 | def get_recipe_env(self, arch): 15 | if 'sdl' in self.ctx.recipe_build_order: 16 | sdl_include = 'sdl' 17 | sdl_mixer_include = 'sdl_mixer' 18 | elif 'sdl2' in self.ctx.recipe_build_order: 19 | sdl_include = 'SDL' 20 | sdl_mixer_include = 'SDL2_mixer' 21 | 22 | #note: audiostream library is not yet able to judge whether it is being used with sdl or with sdl2. 23 | #this causes linking to fail against SDL2 (compiling against SDL2 works) 24 | #need to find a way to fix this in audiostream's setup.py 25 | raise RuntimeError('Audiostream library is not yet able to configure itself to link against SDL2. Patch on audiostream library needed - any help much appreciated!') 26 | 27 | env = super(AudiostreamRecipe, self).get_recipe_env(arch) 28 | env['CFLAGS'] += ' -I{jni_path}/{sdl_include}/include -I{jni_path}/{sdl_mixer_include}'.format( 29 | jni_path = join(self.ctx.bootstrap.build_dir, 'jni'), 30 | sdl_include = sdl_include, 31 | sdl_mixer_include = sdl_mixer_include) 32 | return env 33 | 34 | 35 | 36 | recipe = AudiostreamRecipe() 37 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/audiostream/recipe.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | VERSION_audiostream=${VERSION_audiostream:-master} 4 | URL_audiostream=https://github.com/kivy/audiostream/archive/$VERSION_audiostream.zip 5 | DEPS_audiostream=(python sdl pyjnius) 6 | MD5_audiostream= 7 | BUILD_audiostream=$BUILD_PATH/audiostream/$(get_directory $URL_audiostream) 8 | RECIPE_audiostream=$RECIPES_PATH/audiostream 9 | 10 | function prebuild_audiostream() { 11 | cd $BUILD_audiostream 12 | } 13 | 14 | function shouldbuild_audiostream() { 15 | if [ -d "$SITEPACKAGES_PATH/audiostream" ]; then 16 | DO_BUILD=0 17 | fi 18 | } 19 | 20 | function build_audiostream() { 21 | cd $BUILD_audiostream 22 | 23 | push_arm 24 | 25 | # build python extension 26 | export JNI_PATH=$JNI_PATH 27 | export CFLAGS="$CFLAGS -I$JNI_PATH/sdl/include -I$JNI_PATH/sdl_mixer/" 28 | export LDFLAGS="$LDFLAGS -lm -L$LIBS_PATH" 29 | try cd $BUILD_audiostream 30 | $HOSTPYTHON setup.py build_ext &>/dev/null 31 | try find . -iname '*.pyx' -exec $CYTHON {} \; 32 | try $HOSTPYTHON setup.py build_ext -v 33 | try $HOSTPYTHON setup.py install -O2 34 | try cp -a audiostream/platform/android/org $JAVACLASS_PATH 35 | 36 | pop_arm 37 | } 38 | 39 | function postbuild_audiostream() { 40 | true 41 | } 42 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/babel/__init__.py: -------------------------------------------------------------------------------- 1 | from pythonforandroid.recipe import PythonRecipe 2 | 3 | 4 | class BabelRecipe(PythonRecipe): 5 | name = 'babel' 6 | version = '2.1.1' 7 | url = 'https://pypi.python.org/packages/source/B/Babel/Babel-{version}.tar.gz' 8 | 9 | depends = [('python2', 'python3crystax'), 'setuptools', 'pytz'] 10 | 11 | call_hostpython_via_targetpython = False 12 | install_in_hostpython = True 13 | 14 | 15 | recipe = BabelRecipe() 16 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/boost/disable-so-version.patch: -------------------------------------------------------------------------------- 1 | --- boost/boostcpp.jam 2015-12-14 03:30:09.000000000 +0100 2 | +++ boost-patch/boostcpp.jam 2016-02-08 16:38:40.510859612 +0100 3 | @@ -155,8 +155,9 @@ 4 | if $(type) = SHARED_LIB && 5 | ! [ $(property-set).get ] in windows cygwin darwin aix && 6 | ! [ $(property-set).get ] in pgi 7 | { 8 | + return $(result) ; # disable version suffix for android 9 | result = $(result).$(BOOST_VERSION) ; 10 | } 11 | 12 | return $(result) ; 13 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/boost/use-android-libs.patch: -------------------------------------------------------------------------------- 1 | --- boost/tools/build/src/tools/python.jam 2015-10-16 20:55:36.000000000 +0200 2 | +++ boost-patch/tools/build/src/tools/python.jam 2016-02-09 13:16:09.519261546 +0100 3 | @@ -646,6 +646,7 @@ 4 | 5 | case aix : return pthread dl ; 6 | 7 | + case * : return ; # use Android builtin libs 8 | case * : return pthread dl 9 | gcc:util linux:util ; 10 | } 11 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/boost/user-config.jam: -------------------------------------------------------------------------------- 1 | import os ; 2 | 3 | local ANDROIDNDK = [ os.environ ANDROIDNDK ] ; 4 | local ANDROIDAPI = [ os.environ ANDROIDAPI ] ; 5 | local TOOLCHAIN_VERSION = [ os.environ TOOLCHAIN_VERSION ] ; 6 | local TOOLCHAIN_PREFIX = [ os.environ TOOLCHAIN_PREFIX ] ; 7 | local ARCH = [ os.environ ARCH ] ; 8 | local PYTHON_ROOT = [ os.environ PYTHON_ROOT ] ; 9 | 10 | using gcc : $(ARCH) : $(TOOLCHAIN_PREFIX)-g++ : 11 | $(ARCH) 12 | $(TOOLCHAIN_PREFIX)-ar 13 | -DBOOST_SP_USE_PTHREADS 14 | -DBOOST_AC_USE_PTHREADS 15 | -DBOOST_SP_USE_PTHREADS 16 | -DBOOST_AC_USE_PTHREADS 17 | -frtti 18 | -fexceptions 19 | -I$(ANDROIDNDK)/platforms/android-$(ANDROIDAPI)/arch-$(ARCH)/usr/include 20 | -I$(ANDROIDNDK)/sources/cxx-stl/gnu-libstdc++/$(TOOLCHAIN_VERSION)/include 21 | -I$(ANDROIDNDK)/sources/cxx-stl/gnu-libstdc++/$(TOOLCHAIN_VERSION)/libs/$(ARCH)/include 22 | -I$(PYTHON_ROOT)/include/python2.7 23 | --sysroot=$(ANDROIDNDK)/platforms/android-$(ANDROIDAPI)/arch-$(ARCH) 24 | -L$(ANDROIDNDK)/sources/cxx-stl/gnu-libstdc++/$(TOOLCHAIN_VERSION)/libs/$(ARCH) 25 | -L$(PYTHON_ROOT)/lib 26 | -lgnustl_shared 27 | -lpython2.7 28 | ; 29 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/brokenrecipe/__init__.py: -------------------------------------------------------------------------------- 1 | from pythonforandroid.toolchain import Recipe 2 | 3 | class BrokenRecipe(Recipe): 4 | def __init__(self): 5 | print('This is a broken recipe, not a real one!') 6 | 7 | 8 | recipe = BrokenRecipe() 9 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/cdecimal/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | from pythonforandroid.toolchain import CompiledComponentsPythonRecipe 3 | from pythonforandroid.patching import is_darwin 4 | 5 | 6 | class CdecimalRecipe(CompiledComponentsPythonRecipe): 7 | name = 'cdecimal' 8 | version = '2.3' 9 | url = 'http://www.bytereef.org/software/mpdecimal/releases/cdecimal-{version}.tar.gz' 10 | 11 | depends = ['python2'] 12 | 13 | patches = ['locale.patch', 14 | 'cross-compile.patch'] 15 | 16 | def prebuild_arch(self, arch): 17 | super(CdecimalRecipe, self).prebuild_arch(arch) 18 | if not is_darwin(): 19 | if '64' in arch.arch: 20 | machine = 'ansi64' 21 | else: 22 | machine = 'ansi32' 23 | self.setup_extra_args = ['--with-machine=' + machine] 24 | 25 | 26 | recipe = CdecimalRecipe() 27 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/cdecimal/cross-compile.patch: -------------------------------------------------------------------------------- 1 | diff -Naur cdecimal/setup.py b/setup.py 2 | --- cdecimal/setup.py 2015-12-14 13:48:23.085997956 -0600 3 | +++ b/setup.py 2015-12-14 13:48:11.413805121 -0600 4 | @@ -229,7 +229,7 @@ 5 | def configure(machine, cc, py_size_t): 6 | os.chmod("./configure", 0x1ed) # pip removes execute permissions. 7 | if machine: # string has been validated. 8 | - os.system("./configure MACHINE=%s" % machine) 9 | + os.system("./configure --host=%s MACHINE=%s" % (os.environ['TOOLCHAIN_PREFIX'], machine)) 10 | elif 'sunos' in SYSTEM and py_size_t == 8: 11 | # cc is from sysconfig. 12 | os.system("./configure CC='%s -m64'" % cc) 13 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/cffi/__init__.py: -------------------------------------------------------------------------------- 1 | from pythonforandroid.recipe import CompiledComponentsPythonRecipe 2 | 3 | 4 | class CffiRecipe(CompiledComponentsPythonRecipe): 5 | name = 'cffi' 6 | version = '1.4.2' 7 | url = 'https://pypi.python.org/packages/source/c/cffi/cffi-{version}.tar.gz' 8 | 9 | depends = [('python2', 'python3crystax'), 'setuptools', 'pycparser', 'libffi'] 10 | 11 | patches = ['disable-pkg-config.patch'] 12 | 13 | # call_hostpython_via_targetpython = False 14 | install_in_hostpython = True 15 | 16 | def get_recipe_env(self, arch=None): 17 | env = super(CffiRecipe, self).get_recipe_env(arch) 18 | libffi = self.get_recipe('libffi', self.ctx) 19 | includes = libffi.get_include_dirs(arch) 20 | env['CFLAGS'] = ' -I'.join([env.get('CFLAGS', '')] + includes) 21 | env['LDFLAGS'] = (env.get('CFLAGS', '') + ' -L' + 22 | self.ctx.get_libs_dir(arch.arch)) 23 | env['PYTHONPATH'] = ':'.join([ 24 | self.ctx.get_site_packages_dir(), 25 | env['BUILDLIB_PATH'], 26 | ]) 27 | return env 28 | 29 | 30 | recipe = CffiRecipe() 31 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/cffi/disable-pkg-config.patch: -------------------------------------------------------------------------------- 1 | diff -Naur cffi-1.4.2/setup.py b/setup.py 2 | --- cffi-1.4.2/setup.py 2015-12-21 12:09:47.000000000 -0600 3 | +++ b/setup.py 2015-12-23 10:20:40.590622524 -0600 4 | @@ -5,8 +5,7 @@ 5 | 6 | sources = ['c/_cffi_backend.c'] 7 | libraries = ['ffi'] 8 | -include_dirs = ['/usr/include/ffi', 9 | - '/usr/include/libffi'] # may be changed by pkg-config 10 | +include_dirs = [] 11 | define_macros = [] 12 | library_dirs = [] 13 | extra_compile_args = [] 14 | @@ -67,14 +66,7 @@ 15 | sys.stderr.write("The above error message can be safely ignored\n") 16 | 17 | def use_pkg_config(): 18 | - if sys.platform == 'darwin' and os.path.exists('/usr/local/bin/brew'): 19 | - use_homebrew_for_libffi() 20 | - 21 | - _ask_pkg_config(include_dirs, '--cflags-only-I', '-I', sysroot=True) 22 | - _ask_pkg_config(extra_compile_args, '--cflags-only-other') 23 | - _ask_pkg_config(library_dirs, '--libs-only-L', '-L', sysroot=True) 24 | - _ask_pkg_config(extra_link_args, '--libs-only-other') 25 | - _ask_pkg_config(libraries, '--libs-only-l', '-l') 26 | + pass 27 | 28 | def use_homebrew_for_libffi(): 29 | # We can build by setting: 30 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/cryptography/__init__.py: -------------------------------------------------------------------------------- 1 | from os.path import dirname, join 2 | 3 | from pythonforandroid.recipe import CompiledComponentsPythonRecipe 4 | 5 | 6 | class CryptographyRecipe(CompiledComponentsPythonRecipe): 7 | name = 'cryptography' 8 | version = '1.1.2' 9 | url = 'https://pypi.python.org/packages/source/c/cryptography/cryptography-{version}.tar.gz' 10 | 11 | depends = [('python2', 'python3crystax'), 'cffi', 'enum34', 'openssl', 'ipaddress', 'idna'] 12 | 13 | patches = ['fix-cffi-path.patch', 14 | 'link-static.patch'] 15 | 16 | # call_hostpython_via_targetpython = False 17 | 18 | def get_recipe_env(self, arch=None): 19 | env = super(CryptographyRecipe, self).get_recipe_env(arch) 20 | # # libffi = self.get_recipe('libffi', self.ctx) 21 | # # includes = libffi.get_include_dirs(arch) 22 | # # env['CFLAGS'] = ' -I'.join([env.get('CFLAGS', '')] + includes) 23 | # # env['LDFLAGS'] = (env.get('CFLAGS', '') + ' -L' + 24 | # # self.ctx.get_libs_dir(arch.arch)) 25 | openssl = self.get_recipe('openssl', self.ctx) 26 | openssl_dir = openssl.get_build_dir(arch.arch) 27 | env['CFLAGS'] = env.get('CFLAGS', '') + ' -I' + join(openssl_dir, 'include') 28 | # env['LDFLAGS'] = env.get('LDFLAGS', '') + ' -L' + openssl.get_build_dir(arch.arch) 29 | env['LIBSSL'] = join(openssl_dir, 'libssl.a') 30 | env['LIBCRYPTO'] = join(openssl_dir, 'libcrypto.a') 31 | env['PYTHONPATH'] = ':'.join([ 32 | join(dirname(self.real_hostpython_location), 'Lib'), 33 | join(dirname(self.real_hostpython_location), 'Lib', 'site-packages'), 34 | env['BUILDLIB_PATH'], 35 | ]) 36 | return env 37 | 38 | def build_arch(self, arch): 39 | super(CryptographyRecipe, self).build_arch(arch) 40 | 41 | 42 | recipe = CryptographyRecipe() 43 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/cryptography/fix-cffi-path.patch: -------------------------------------------------------------------------------- 1 | diff -Naur cryptography/setup.py b/setup.py 2 | --- cryptography/setup.py 2015-12-10 13:53:28.000000000 -0600 3 | +++ b/setup.py 2015-12-23 12:12:22.830287138 -0600 4 | @@ -18,6 +18,10 @@ 5 | from setuptools.command.install import install 6 | from setuptools.command.test import test 7 | 8 | +import sys 9 | +for d in sys.path[:]: 10 | + if 'python-installs' in d: 11 | + sys.path.remove(d) 12 | 13 | base_dir = os.path.dirname(__file__) 14 | src_dir = os.path.join(base_dir, "src") 15 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/enum34/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | from pythonforandroid.toolchain import PythonRecipe 3 | 4 | 5 | class Enum34Recipe(PythonRecipe): 6 | version = '1.0.4' 7 | url = 'https://pypi.python.org/packages/source/e/enum34/enum34-{version}.tar.gz' 8 | depends = ['python2'] 9 | site_packages_name = 'enum' 10 | 11 | recipe = Enum34Recipe() 12 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/evdev/__init__.py: -------------------------------------------------------------------------------- 1 | from pythonforandroid.recipe import CompiledComponentsPythonRecipe 2 | 3 | 4 | class EvdevRecipe(CompiledComponentsPythonRecipe): 5 | name = 'evdev' 6 | version = 'v0.4.7' 7 | url = 'https://github.com/gvalkov/python-evdev/archive/{version}.zip' 8 | 9 | depends = [('python2', 'python3')] 10 | 11 | build_cmd = 'build' 12 | 13 | patches = ['evcnt.patch', 14 | 'keycnt.patch', 15 | 'remove-uinput.patch', 16 | 'include-dir.patch', 17 | 'evdev-permissions.patch'] 18 | 19 | def get_recipe_env(self, arch=None): 20 | env = super(EvdevRecipe, self).get_recipe_env(arch) 21 | env['NDKPLATFORM'] = self.ctx.ndk_platform 22 | return env 23 | 24 | 25 | recipe = EvdevRecipe() 26 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/evdev/evcnt.patch: -------------------------------------------------------------------------------- 1 | diff -Naur orig/evdev/input.c v0.4.7/evdev/input.c 2 | --- orig/evdev/input.c 2015-06-11 13:56:43.483891914 -0500 3 | +++ v0.4.7/evdev/input.c 2015-06-11 13:57:29.079529095 -0500 4 | @@ -24,6 +24,8 @@ 5 | #include 6 | #endif 7 | 8 | +#define EV_CNT (EV_MAX+1) 9 | + 10 | #define MAX_NAME_SIZE 256 11 | 12 | extern char* EV_NAME[EV_CNT]; 13 | @@ -190,7 +192,7 @@ 14 | absinfo.maximum, 15 | absinfo.fuzz, 16 | absinfo.flat, 17 | - absinfo.resolution); 18 | + 0); 19 | 20 | evlong = PyLong_FromLong(ev_code); 21 | absitem = Py_BuildValue("(OO)", evlong, py_absinfo); 22 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/evdev/evdev-permissions.patch: -------------------------------------------------------------------------------- 1 | diff -Naur orig/evdev/util.py v0.4.7/evdev/util.py 2 | --- orig/evdev/util.py 2015-06-12 16:31:46.532994729 -0500 3 | +++ v0.4.7/evdev/util.py 2015-06-12 16:32:59.489933840 -0500 4 | @@ -3,15 +3,53 @@ 5 | import os 6 | import stat 7 | import glob 8 | +import subprocess 9 | 10 | from evdev import ecodes 11 | from evdev.events import event_factory 12 | 13 | 14 | +su = False 15 | + 16 | + 17 | +def get_su_binary(): 18 | + global su 19 | + if su is not False: 20 | + return su 21 | + 22 | + su_files = ['/sbin/su', '/system/bin/su', '/system/xbin/su', '/data/local/xbin/su', 23 | + '/data/local/bin/su', '/system/sd/xbin/su', '/system/bin/failsafe/su', 24 | + '/data/local/su'] 25 | + su = None 26 | + 27 | + for fn in su_files: 28 | + if os.path.exists(fn): 29 | + try: 30 | + cmd = [fn, '-c', 'id'] 31 | + output = subprocess.check_output(cmd) 32 | + except Exception: 33 | + pass 34 | + else: 35 | + if 'uid=0' in output: 36 | + su = fn 37 | + break 38 | + 39 | + return su 40 | + 41 | + 42 | +def fix_permissions(nodes): 43 | + su = get_su_binary() 44 | + if su: 45 | + cmd = 'chmod 666 ' + ' '.join(nodes) 46 | + print cmd 47 | + subprocess.check_call(['su', '-c', cmd]) 48 | + 49 | + 50 | def list_devices(input_device_dir='/dev/input'): 51 | '''List readable character devices in ``input_device_dir``.''' 52 | 53 | fns = glob.glob('{}/event*'.format(input_device_dir)) 54 | + fix_permissions(fns) 55 | fns = list(filter(is_device, fns)) 56 | 57 | return fns 58 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/evdev/include-dir.patch: -------------------------------------------------------------------------------- 1 | diff -Naur orig/setup.py v0.4.7/setup.py 2 | --- orig/setup.py 2015-06-11 14:16:31.315765908 -0500 3 | +++ v0.4.7/setup.py 2015-06-11 14:17:05.800263536 -0500 4 | @@ -64,7 +64,7 @@ 5 | 6 | #----------------------------------------------------------------------------- 7 | def create_ecodes(): 8 | - header = '/usr/include/linux/input.h' 9 | + header = os.environ['NDKPLATFORM'] + '/usr/include/linux/input.h' 10 | 11 | if not os.path.isfile(header): 12 | msg = '''\ 13 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/evdev/keycnt.patch: -------------------------------------------------------------------------------- 1 | diff -Naur orig/evdev/genecodes.py v0.4.7/evdev/genecodes.py 2 | --- orig/evdev/genecodes.py 2015-06-12 11:18:39.460538902 -0500 3 | +++ v0.4.7/evdev/genecodes.py 2015-06-12 11:20:49.004337615 -0500 4 | @@ -17,6 +17,8 @@ 5 | #include 6 | #endif 7 | 8 | +#define KEY_CNT (KEY_MAX+1) 9 | + 10 | /* Automatically generated by evdev.genecodes */ 11 | /* Generated on %s */ 12 | 13 | @@ -88,6 +88,7 @@ 14 | macro = regex.search(line) 15 | if macro: 16 | yield ' PyModule_AddIntMacro(m, %s);' % macro.group(1) 17 | + yield ' PyModule_AddIntMacro(m, KEY_CNT);' 18 | 19 | uname = list(os.uname()); del uname[1] 20 | uname = ' '.join(uname) 21 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/fontconfig/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | from pythonforandroid.toolchain import BootstrapNDKRecipe, shprint, current_directory, info_main 3 | from os.path import exists, join 4 | import sh 5 | 6 | 7 | 8 | 9 | class FontconfigRecipe(BootstrapNDKRecipe): 10 | version = "really_old" 11 | url = 'https://github.com/vault/fontconfig/archive/androidbuild.zip' 12 | depends = ['sdl2'] 13 | dir_name = 'fontconfig' 14 | 15 | def build_arch(self, arch): 16 | env = self.get_recipe_env(arch) 17 | 18 | with current_directory(self.get_jni_dir()): 19 | shprint(sh.ndk_build, "V=1", 'fontconfig', _env=env) 20 | 21 | 22 | recipe = FontconfigRecipe() 23 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/freetype/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | from pythonforandroid.toolchain import Recipe, shprint, current_directory, ArchARM 3 | from os.path import exists, join, realpath 4 | from os import uname 5 | import glob 6 | import sh 7 | 8 | class FreetypeRecipe(Recipe): 9 | 10 | version = '2.5.5' 11 | url = 'http://download.savannah.gnu.org/releases/freetype/freetype-{version}.tar.gz' 12 | 13 | depends = ['harfbuzz'] 14 | 15 | def should_build(self, arch): 16 | if exists(join(self.get_build_dir(arch.arch), 'objs', '.libs', 'libfreetype.so')): 17 | return False 18 | return True 19 | 20 | def build_arch(self, arch): 21 | env = self.get_recipe_env(arch) 22 | 23 | harfbuzz_recipe = Recipe.get_recipe('harfbuzz', self.ctx) 24 | env['LDFLAGS'] = ' '.join( 25 | [env['LDFLAGS'], 26 | '-L{}'.format(join(harfbuzz_recipe.get_build_dir(arch.arch), 'src', '.libs'))]) 27 | 28 | with current_directory(self.get_build_dir(arch.arch)): 29 | configure = sh.Command('./configure') 30 | shprint(configure, '--host=arm-linux-androideabi', 31 | '--prefix={}'.format(realpath('.')), 32 | '--without-zlib', '--with-png=no', '--enable-shared', 33 | _env=env) 34 | shprint(sh.make, '-j5', _env=env) 35 | 36 | shprint(sh.cp, 'objs/.libs/libfreetype.so', self.ctx.libs_dir) 37 | 38 | 39 | recipe = FreetypeRecipe() 40 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/freetype/recipe.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | VERSION_freetype=${VERSION_freetype:-2.5.5} 4 | DEPS_freetype=(harfbuzz) 5 | URL_freetype=http://download.savannah.gnu.org/releases/freetype/freetype-2.5.5.tar.gz 6 | MD5_freetype=7448edfbd40c7aa5088684b0a3edb2b8 7 | BUILD_freetype=$BUILD_PATH/freetype/$(get_directory $URL_freetype) 8 | RECIPE_freetype=$RECIPES_PATH/freetype 9 | 10 | # function called for preparing source code if needed 11 | # (you can apply patch etc here.) 12 | function prebuild_freetype() { 13 | true 14 | } 15 | 16 | function build_freetype() { 17 | cd $BUILD_freetype 18 | push_arm 19 | export LDFLAGS="$LDFLAGS -L$BUILD_harfbuzz/src/.libs/" 20 | try ./configure --host=arm-linux-androideabi --prefix=$BUILD_freetype --without-zlib --with-png=no --enable-shared 21 | try make -j5 22 | pop_arm 23 | 24 | try cp $BUILD_freetype/objs/.libs/libfreetype.so $LIBS_PATH 25 | } 26 | 27 | # function called after all the compile have been done 28 | function postbuild_freetype() { 29 | true 30 | } 31 | 32 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/harfbuzz/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | from pythonforandroid.toolchain import Recipe, shprint, current_directory, ArchARM 3 | from os.path import exists, join, realpath 4 | from os import uname 5 | import glob 6 | import sh 7 | 8 | 9 | class HarfbuzzRecipe(Recipe): 10 | version = '0.9.40' 11 | url = 'http://www.freedesktop.org/software/harfbuzz/release/harfbuzz-{version}.tar.bz2' 12 | 13 | def should_build(self, arch): 14 | if exists(join(self.get_build_dir(arch.arch), 'src', '.libs', 'libharfbuzz.so')): 15 | return False 16 | return True 17 | 18 | def build_arch(self, arch): 19 | 20 | env = self.get_recipe_env(arch) 21 | env['LDFLAGS'] = env['LDFLAGS'] + ' -L{}'.format( 22 | self.ctx.get_libs_dir(arch.arch) + 23 | '-L{}'.format(self.ctx.libs_dir)) 24 | with current_directory(self.get_build_dir(arch.arch)): 25 | configure = sh.Command('./configure') 26 | shprint(configure, '--without-icu', '--host=arm-linux=androideabi', 27 | '--prefix={}'.format(join(self.ctx.build_dir, 'python-install')), 28 | '--without-freetype', '--without-glib', _env=env) 29 | shprint(sh.make, '-j5', _env=env) 30 | 31 | shprint(sh.cp, '-L', join('src', '.libs', 'libharfbuzz.so'), self.ctx.libs_dir) 32 | 33 | recipe = HarfbuzzRecipe() 34 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/harfbuzz/recipe.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | VERSION_harfbuzz=${VERSION_harfbuzz:-2.5.5} 4 | URL_harfbuzz=http://www.freedesktop.org/software/harfbuzz/release/harfbuzz-0.9.40.tar.bz2 5 | MD5_harfbuzz=0e27e531f4c4acff601ebff0957755c2 6 | BUILD_harfbuzz=$BUILD_PATH/harfbuzz/$(get_directory $URL_harfbuzz) 7 | RECIPE_harfbuzz=$RECIPES_PATH/harfbuzz 8 | 9 | # function called for preparing source code if needed 10 | # (you can apply patch etc here.) 11 | function prebuild_harfbuzz() { 12 | true 13 | } 14 | 15 | function shouldbuild_harfbuzz() { 16 | if [ -f "$BUILD_harfbuzz/src/.libs/libharfbuzz.so" ]; then 17 | DO_BUILD=0 18 | fi 19 | } 20 | 21 | function build_harfbuzz() { 22 | cd $BUILD_harfbuzz 23 | 24 | push_arm 25 | #~ export LDFLAGS="-L$LIBS_PATH" 26 | #~ export LDSHARED="$LIBLINK" 27 | #try ./configure --build=i686-pc-linux-gnu --host=arm-linux-androideabi --prefix="$BUILD_PATH/python-install" --enable-shared --without-freetype --without-glib 28 | #~ try ./autogen.sh --build=i686-pc-linux-gnu --host=arm-linux-androideabi --prefix="$BUILD_PATH/python-install" --without-freetype --without-glib 29 | try ./configure --without-icu --host=arm-linux-androideabi --prefix="$BUILD_PATH/python-install" --without-freetype --without-glib 30 | try make -j5 31 | pop_arm 32 | try cp -L $BUILD_harfbuzz/src/.libs/libharfbuzz.so $LIBS_PATH 33 | } 34 | 35 | # function called after all the compile have been done 36 | function postbuild_harfbuzz() { 37 | true 38 | } 39 | 40 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/hostpython2/recipe.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | VERSION_hostpython=2.7.2 4 | URL_hostpython=http://python.org/ftp/python/$VERSION_hostpython/Python-$VERSION_hostpython.tar.bz2 5 | MD5_hostpython=ba7b2f11ffdbf195ee0d111b9455a5bd 6 | 7 | # must be generated ? 8 | BUILD_hostpython=$BUILD_PATH/hostpython/$(get_directory $URL_hostpython) 9 | RECIPE_hostpython=$RECIPES_PATH/hostpython 10 | 11 | function prebuild_hostpython() { 12 | cd $BUILD_hostpython 13 | try cp $RECIPE_hostpython/Setup Modules/Setup 14 | } 15 | 16 | function shouldbuild_hostpython() { 17 | cd $BUILD_hostpython 18 | if [ -f hostpython ]; then 19 | DO_BUILD=0 20 | fi 21 | } 22 | 23 | function build_hostpython() { 24 | # placeholder for building 25 | cd $BUILD_hostpython 26 | 27 | try ./configure 28 | try make -j5 29 | try mv Parser/pgen hostpgen 30 | 31 | if [ -f python.exe ]; then 32 | try mv python.exe hostpython 33 | elif [ -f python ]; then 34 | try mv python hostpython 35 | else 36 | error "Unable to found the python executable?" 37 | exit 1 38 | fi 39 | } 40 | 41 | function postbuild_hostpython() { 42 | # placeholder for post build 43 | true 44 | } 45 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/hostpython3crystax/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | from pythonforandroid.toolchain import Recipe, shprint, current_directory, info, warning 3 | from os.path import join, exists 4 | from os import chdir 5 | import sh 6 | 7 | 8 | class Hostpython3Recipe(Recipe): 9 | version = '3.5' 10 | # url = 'http://python.org/ftp/python/{version}/Python-{version}.tgz' 11 | # url = 'https://github.com/crystax/android-vendor-python-3-5/archive/master.zip' 12 | name = 'hostpython3crystax' 13 | 14 | conflicts = ['hostpython2'] 15 | 16 | # def prebuild_armeabi(self): 17 | # # Override hostpython Setup? 18 | # shprint(sh.cp, join(self.get_recipe_dir(), 'Setup'), 19 | # join(self.get_build_dir('armeabi'), 'Modules', 'Setup')) 20 | 21 | def build_arch(self, arch): 22 | self.ctx.hostpython = '/usr/bin/false' 23 | self.ctx.hostpgen = '/usr/bin/false' 24 | 25 | 26 | recipe = Hostpython3Recipe() 27 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/idna/__init__.py: -------------------------------------------------------------------------------- 1 | from pythonforandroid.recipe import PythonRecipe 2 | 3 | 4 | class IdnaRecipe(PythonRecipe): 5 | name = 'idna' 6 | version = '2.0' 7 | url = 'https://pypi.python.org/packages/source/i/idna/idna-{version}.tar.gz' 8 | 9 | depends = [('python2', 'python3crystax'), 'setuptools'] 10 | 11 | call_hostpython_via_targetpython = False 12 | 13 | 14 | recipe = IdnaRecipe() 15 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/ipaddress/__init__.py: -------------------------------------------------------------------------------- 1 | from pythonforandroid.recipe import PythonRecipe 2 | 3 | 4 | class IpaddressRecipe(PythonRecipe): 5 | name = 'ipaddress' 6 | version = '1.0.15' 7 | url = 'https://pypi.python.org/packages/source/i/ipaddress/ipaddress-{version}.tar.gz' 8 | 9 | depends = ['python2'] 10 | 11 | 12 | recipe = IpaddressRecipe() 13 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/jpeg/Application.mk: -------------------------------------------------------------------------------- 1 | APP_OPTIM := release 2 | APP_ABI := all # or armeabi 3 | APP_MODULES := libjpeg 4 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/jpeg/__init__.py: -------------------------------------------------------------------------------- 1 | from pythonforandroid.recipe import NDKRecipe 2 | from pythonforandroid.logger import shprint 3 | from os.path import join, exists 4 | import sh 5 | 6 | 7 | class JpegRecipe(NDKRecipe): 8 | name = 'jpeg' 9 | version = 'linaro-android' 10 | url = 'git://git.linaro.org/people/tomgall/libjpeg-turbo/libjpeg-turbo.git' 11 | 12 | patches = ['build-static.patch'] 13 | 14 | generated_libraries = ['libjpeg.a'] 15 | 16 | def prebuild_arch(self, arch): 17 | super(JpegRecipe, self).prebuild_arch(arch) 18 | 19 | build_dir = self.get_build_dir(arch.arch) 20 | app_mk = join(build_dir, 'Application.mk') 21 | if not exists(app_mk): 22 | shprint(sh.cp, join(self.get_recipe_dir(), 'Application.mk'), app_mk) 23 | jni_ln = join(build_dir, 'jni') 24 | if not exists(jni_ln): 25 | shprint(sh.ln, '-s', build_dir, jni_ln) 26 | 27 | 28 | recipe = JpegRecipe() 29 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/kivy/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | from pythonforandroid.toolchain import CythonRecipe, shprint, current_directory, ArchARM 3 | from os.path import exists, join 4 | import sh 5 | import glob 6 | 7 | 8 | class KivyRecipe(CythonRecipe): 9 | # version = 'stable' 10 | version = 'master' 11 | url = 'https://github.com/kivy/kivy/archive/{version}.zip' 12 | name = 'kivy' 13 | 14 | depends = [('sdl2', 'pygame'), 'pyjnius'] 15 | 16 | # patches = ['setargv.patch'] 17 | 18 | def get_recipe_env(self, arch): 19 | env = super(KivyRecipe, self).get_recipe_env(arch) 20 | if 'sdl2' in self.ctx.recipe_build_order: 21 | env['USE_SDL2'] = '1' 22 | env['KIVY_SDL2_PATH'] = ':'.join([ 23 | join(self.ctx.bootstrap.build_dir, 'jni', 'SDL', 'include'), 24 | join(self.ctx.bootstrap.build_dir, 'jni', 'SDL2_image'), 25 | join(self.ctx.bootstrap.build_dir, 'jni', 'SDL2_mixer'), 26 | join(self.ctx.bootstrap.build_dir, 'jni', 'SDL2_ttf'), 27 | ]) 28 | return env 29 | 30 | recipe = KivyRecipe() 31 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/kivy/recipe.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | VERSION_kivy=${VERSION_kivy:-stable} 4 | URL_kivy=https://github.com/kivy/kivy/archive/$VERSION_kivy.zip 5 | DEPS_kivy=(pygame pyjnius android) 6 | MD5_kivy= 7 | BUILD_kivy=$BUILD_PATH/kivy/$(get_directory $URL_kivy) 8 | RECIPE_kivy=$RECIPES_PATH/kivy 9 | 10 | function prebuild_kivy() { 11 | true 12 | } 13 | 14 | function shouldbuild_kivy() { 15 | if [ -d "$SITEPACKAGES_PATH/kivy" ]; then 16 | DO_BUILD=0 17 | fi 18 | } 19 | 20 | function build_kivy() { 21 | cd $BUILD_kivy 22 | 23 | push_arm 24 | 25 | export LDFLAGS="$LDFLAGS -L$LIBS_PATH" 26 | export LDSHARED="$LIBLINK" 27 | 28 | # fake try to be able to cythonize generated files 29 | $HOSTPYTHON setup.py build_ext 30 | try find . -iname '*.pyx' -exec $CYTHON {} \; 31 | try $HOSTPYTHON setup.py build_ext -v 32 | try find build/lib.* -name "*.o" -exec $STRIP {} \; 33 | try $HOSTPYTHON setup.py install -O2 34 | 35 | try rm -rf $BUILD_PATH/python-install/lib/python*/site-packages/kivy/tools 36 | 37 | unset LDSHARED 38 | pop_arm 39 | } 40 | 41 | function postbuild_kivy() { 42 | true 43 | } 44 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/kivysdl2python3/recipe.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | VERSION_kivy=${VERSION_kivy:-stable} 4 | URL_kivy=https://github.com/kivy/kivy/archive/$VERSION_kivy.zip 5 | DEPS_kivy=(pygame pyjnius android) 6 | MD5_kivy= 7 | BUILD_kivy=$BUILD_PATH/kivy/$(get_directory $URL_kivy) 8 | RECIPE_kivy=$RECIPES_PATH/kivy 9 | 10 | function prebuild_kivy() { 11 | true 12 | } 13 | 14 | function shouldbuild_kivy() { 15 | if [ -d "$SITEPACKAGES_PATH/kivy" ]; then 16 | DO_BUILD=0 17 | fi 18 | } 19 | 20 | function build_kivy() { 21 | cd $BUILD_kivy 22 | 23 | push_arm 24 | 25 | export LDFLAGS="$LDFLAGS -L$LIBS_PATH" 26 | export LDSHARED="$LIBLINK" 27 | 28 | # fake try to be able to cythonize generated files 29 | $HOSTPYTHON setup.py build_ext 30 | try find . -iname '*.pyx' -exec $CYTHON {} \; 31 | try $HOSTPYTHON setup.py build_ext -v 32 | try find build/lib.* -name "*.o" -exec $STRIP {} \; 33 | try $HOSTPYTHON setup.py install -O2 34 | 35 | try rm -rf $BUILD_PATH/python-install/lib/python*/site-packages/kivy/tools 36 | 37 | unset LDSHARED 38 | pop_arm 39 | } 40 | 41 | function postbuild_kivy() { 42 | true 43 | } 44 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/leveldb/disable-so-version.patch: -------------------------------------------------------------------------------- 1 | --- leveldb/build_detect_platform 2014-09-16 23:19:52.000000000 +0200 2 | +++ leveldb-patch/build_detect_platform 2016-03-01 20:25:04.074484399 +0100 3 | @@ -124,6 +124,7 @@ 4 | ;; 5 | OS_ANDROID_CROSSCOMPILE) 6 | PLATFORM=OS_ANDROID 7 | + PLATFORM_SHARED_VERSIONED= 8 | COMMON_FLAGS="$MEMCMP_FLAG -D_REENTRANT -DOS_ANDROID -DLEVELDB_PLATFORM_POSIX" 9 | PLATFORM_LDFLAGS="" # All pthread features are in the Android C library 10 | PORT_FILE=port/port_posix.cc 11 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/leveldb/find-snappy.patch: -------------------------------------------------------------------------------- 1 | --- leveldb/build_detect_platform 2014-09-16 23:19:52.000000000 +0200 2 | +++ leveldb-patch/build_detect_platform 2016-03-01 21:56:04.926650079 +0100 3 | @@ -156,7 +157,7 @@ 4 | # except for the test and benchmark files. By default, find will output a list 5 | # of all files matching either rule, so we need to append -print to make the 6 | # prune take effect. 7 | -DIRS="$PREFIX/db $PREFIX/util $PREFIX/table" 8 | +DIRS="$PREFIX/snappy $PREFIX/db $PREFIX/util $PREFIX/table" 9 | 10 | set -f # temporarily disable globbing so that our patterns aren't expanded 11 | PRUNE_TEST="-name *test*.cc -prune" 12 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/libffi/Application.mk: -------------------------------------------------------------------------------- 1 | APP_OPTIM := release 2 | APP_ABI := all # or armeabi 3 | APP_MODULES := libffi 4 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/libffi/disable-mips-check.patch: -------------------------------------------------------------------------------- 1 | diff -Naur libffi/Android.mk b/Android.mk 2 | --- libffi/Android.mk 2015-12-22 17:00:48.025478556 -0600 3 | +++ b/Android.mk 2015-12-22 17:02:23.999249390 -0600 4 | @@ -23,23 +23,20 @@ 5 | # Build rules for the target. 6 | # 7 | 8 | -# We only build ffi for mips. 9 | -ifeq ($(TARGET_ARCH),mips) 10 | 11 | - include $(CLEAR_VARS) 12 | +include $(CLEAR_VARS) 13 | 14 | - ffi_arch := $(TARGET_ARCH) 15 | - ffi_os := $(TARGET_OS) 16 | +ffi_arch := $(TARGET_ARCH) 17 | +ffi_os := $(TARGET_OS) 18 | 19 | - # This include just keeps the nesting a bit saner. 20 | - include $(LOCAL_PATH)/Libffi.mk 21 | +# This include just keeps the nesting a bit saner. 22 | +include $(LOCAL_PATH)/Libffi.mk 23 | 24 | - LOCAL_MODULE_TAGS := optional 25 | - LOCAL_MODULE := libffi 26 | +LOCAL_MODULE_TAGS := optional 27 | +LOCAL_MODULE := libffi 28 | 29 | - include $(BUILD_SHARED_LIBRARY) 30 | +include $(BUILD_SHARED_LIBRARY) 31 | 32 | -endif 33 | 34 | # Also include the rules for the test suite. 35 | include external/libffi/testsuite/Android.mk 36 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/libffi/remove-version-info.patch: -------------------------------------------------------------------------------- 1 | diff -Naur libffi/Makefile.am b/Makefile.am 2 | --- libffi/Makefile.am 2014-11-12 06:00:59.000000000 -0600 3 | +++ b/Makefile.am 2015-12-23 15:57:10.363148806 -0600 4 | @@ -249,7 +249,7 @@ 5 | AM_CFLAGS += -DFFI_DEBUG 6 | endif 7 | 8 | -libffi_la_LDFLAGS = -no-undefined -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LTLDFLAGS) $(AM_LTLDFLAGS) 9 | +libffi_la_LDFLAGS = -no-undefined -avoid-version $(LTLDFLAGS) $(AM_LTLDFLAGS) 10 | 11 | AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src 12 | AM_CCASFLAGS = $(AM_CPPFLAGS) 13 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/libmysqlclient/Linux.cmake: -------------------------------------------------------------------------------- 1 | asdgasdgasdg 2 | asdg 3 | asdg 4 | include(${CMAKE_ROOT}/Modules/Platform/Linux.cmake) 5 | set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "") 6 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/libmysqlclient/add-custom-platform.patch: -------------------------------------------------------------------------------- 1 | --- libmysqlclient/libmysqlclient/libmysql/CMakeLists.txt 2013-02-27 00:25:45.000000000 -0600 2 | +++ b/libmysqlclient/libmysql/CMakeLists.txt 2016-01-11 13:28:51.142356988 -0600 3 | @@ -152,3 +152,5 @@ 4 | ${CMAKE_SOURCE_DIR}/libmysql/libmysqlclient_r${CMAKE_SHARED_LIBRARY_SUFFIX} 5 | DESTINATION "lib") 6 | ENDIF(WIN32) 7 | + 8 | +LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_PREFIX}") 9 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/libmysqlclient/disable-soname.patch: -------------------------------------------------------------------------------- 1 | --- libmysqlclient/libmysqlclient/CMakeLists.txt 2013-02-27 00:25:45.000000000 -0600 2 | +++ b/libmysqlclient/CMakeLists.txt 2016-01-11 13:48:41.672323738 -0600 3 | @@ -24,6 +24,8 @@ 4 | SET(CMAKE_BUILD_TYPE "Release") 5 | ENDIF(NOT CMAKE_BUILD_TYPE) 6 | 7 | +SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "") 8 | + 9 | # This reads user configuration, generated by configure.js. 10 | IF(WIN32 AND EXISTS ${CMAKE_SOURCE_DIR}/win/configure.data) 11 | INCLUDE(${CMAKE_SOURCE_DIR}/win/configure.data) 12 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/libmysqlclient/disable-soversion.patch: -------------------------------------------------------------------------------- 1 | --- libmysqlclient/libmysqlclient/libmysql/CMakeLists.txt 2013-02-27 00:25:45.000000000 -0600 2 | +++ b/libmysqlclient/libmysql/CMakeLists.txt 2016-01-11 14:00:26.729332913 -0600 3 | @@ -97,9 +97,6 @@ 4 | ADD_LIBRARY(libmysql SHARED ${CLIENT_SOURCES} libmysql.def) 5 | TARGET_LINK_LIBRARIES(libmysql ${CMAKE_THREAD_LIBS_INIT}) 6 | STRING(REGEX REPLACE "\\..+" "" LIBMYSQL_SOVERSION ${SHARED_LIB_VERSION}) 7 | -SET_TARGET_PROPERTIES(libmysql 8 | - PROPERTIES VERSION ${SHARED_LIB_VERSION} 9 | - SOVERSION ${LIBMYSQL_SOVERSION}) 10 | IF(OPENSSL_LIBRARIES) 11 | TARGET_LINK_LIBRARIES(libmysql ${OPENSSL_LIBRARIES} ${OPENSSL_LIBCRYPTO}) 12 | ENDIF(OPENSSL_LIBRARIES) 13 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/libmysqlclient/p4a.cmake: -------------------------------------------------------------------------------- 1 | SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH) 2 | SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 3 | SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 4 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/libsodium/__init__.py: -------------------------------------------------------------------------------- 1 | from pythonforandroid.toolchain import Recipe, shprint, shutil, current_directory 2 | from os.path import exists, join 3 | import sh 4 | 5 | class LibsodiumRecipe(Recipe): 6 | version = '1.0.8' 7 | url = 'https://github.com/jedisct1/libsodium/releases/download/{version}/libsodium-{version}.tar.gz' 8 | depends = ['python2'] 9 | 10 | def should_build(self, arch): 11 | super(LibsodiumRecipe, self).should_build(arch) 12 | return not exists(join(self.ctx.get_libs_dir(arch.arch), 'libsodium.so')) 13 | 14 | def build_arch(self, arch): 15 | super(LibsodiumRecipe, self).build_arch(arch) 16 | env = self.get_recipe_env(arch) 17 | with current_directory(self.get_build_dir(arch.arch)): 18 | bash = sh.Command('bash') 19 | shprint(bash, 'configure', '--enable-minimal', '--disable-soname-versions', '--host=arm-linux-androideabi', '--enable-shared', _env=env) 20 | shprint(sh.make, _env=env) 21 | shutil.copyfile('src/libsodium/.libs/libsodium.so', join(self.ctx.get_libs_dir(arch.arch), 'libsodium.so')) 22 | 23 | def get_recipe_env(self, arch): 24 | env = super(LibsodiumRecipe, self).get_recipe_env(arch) 25 | env['CFLAGS'] += ' -Os' 26 | return env 27 | 28 | recipe = LibsodiumRecipe() 29 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/libtorrent/disable-so-version.patch: -------------------------------------------------------------------------------- 1 | --- libtorrent/Jamfile 2016-01-17 23:52:45.000000000 +0100 2 | +++ libtorrent-patch/Jamfile 2016-02-09 13:37:57.499561750 +0100 3 | @@ -325,6 +325,7 @@ 4 | if $(type) = SHARED_LIB && 5 | ( ! ( [ $(property-set).get ] in windows cygwin ) ) 6 | { 7 | + return $(name) ; # disable version suffix for android 8 | name = $(name).$(VERSION) ; 9 | } 10 | 11 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/libtorrent/use-soname-python.patch: -------------------------------------------------------------------------------- 1 | --- libtorrent/bindings/python/Jamfile 2016-01-17 23:52:45.000000000 +0100 2 | +++ libtorrent-patch/bindings/python/Jamfile 2016-02-09 17:11:44.261578000 +0100 3 | @@ -35,7 +35,7 @@ 4 | 5 | if ( gcc in $(properties) ) 6 | { 7 | - result += -Wl,-Bsymbolic ; 8 | + result += -Wl,-soname=libtorrentpython.so,-Bsymbolic ; 9 | } 10 | } 11 | 12 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/libtorrent/user-config-openssl.patch: -------------------------------------------------------------------------------- 1 | --- boost/user-config.jam 2016-03-02 14:31:41.280414820 +0100 2 | +++ boost-patch/user-config.jam 2016-03-02 14:32:08.904384741 +0100 3 | @@ -6,6 +6,7 @@ 4 | local TOOLCHAIN_PREFIX = [ os.environ TOOLCHAIN_PREFIX ] ; 5 | local ARCH = [ os.environ ARCH ] ; 6 | local PYTHON_ROOT = [ os.environ PYTHON_ROOT ] ; 7 | +local OPENSSL_BUILD_PATH = [ os.environ OPENSSL_BUILD_PATH ] ; 8 | 9 | using gcc : $(ARCH) : $(TOOLCHAIN_PREFIX)-g++ : 10 | $(ARCH) 11 | @@ -20,9 +21,14 @@ 12 | -I$(ANDROIDNDK)/sources/cxx-stl/gnu-libstdc++/$(TOOLCHAIN_VERSION)/include 13 | -I$(ANDROIDNDK)/sources/cxx-stl/gnu-libstdc++/$(TOOLCHAIN_VERSION)/libs/$(ARCH)/include 14 | -I$(PYTHON_ROOT)/include/python2.7 15 | +-I$(OPENSSL_BUILD_PATH)/include 16 | +-I$(OPENSSL_BUILD_PATH)/include/openssl 17 | --sysroot=$(ANDROIDNDK)/platforms/android-$(ANDROIDAPI)/arch-$(ARCH) 18 | -L$(ANDROIDNDK)/sources/cxx-stl/gnu-libstdc++/$(TOOLCHAIN_VERSION)/libs/$(ARCH) 19 | -L$(PYTHON_ROOT)/lib 20 | +-L$(OPENSSL_BUILD_PATH) 21 | -lgnustl_shared 22 | -lpython2.7 23 | +-lcrypto 24 | +-lssl 25 | ; 26 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/mysqldb/disable-zip.patch: -------------------------------------------------------------------------------- 1 | --- mysqldb/setup.py 2014-01-02 13:52:50.000000000 -0600 2 | +++ b/setup.py 2016-01-13 15:48:36.781216443 -0600 3 | @@ -18,4 +18,5 @@ 4 | metadata['ext_modules'] = [ 5 | setuptools.Extension(sources=['_mysql.c'], **options)] 6 | metadata['long_description'] = metadata['long_description'].replace(r'\n', '') 7 | +metadata['zip_safe'] = False 8 | setuptools.setup(**metadata) 9 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/mysqldb/override-mysql-config.patch: -------------------------------------------------------------------------------- 1 | --- mysqldb/setup_posix.py 2014-01-02 13:52:50.000000000 -0600 2 | +++ b/setup_posix.py 2016-01-13 15:48:18.732883429 -0600 3 | @@ -13,17 +13,7 @@ 4 | return "-%s" % f 5 | 6 | def mysql_config(what): 7 | - from os import popen 8 | - 9 | - f = popen("%s --%s" % (mysql_config.path, what)) 10 | - data = f.read().strip().split() 11 | - ret = f.close() 12 | - if ret: 13 | - if ret/256: 14 | - data = [] 15 | - if ret/256 > 1: 16 | - raise EnvironmentError("%s not found" % (mysql_config.path,)) 17 | - return data 18 | + return os.environ['MYSQL_' + what.replace('-', '_')].strip().split() 19 | mysql_config.path = "mysql_config" 20 | 21 | def get_config(): 22 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/ndghttpsclient: -------------------------------------------------------------------------------- 1 | from pythonforandroid.toolchain import PythonRecipe 2 | 3 | class NdgHttpsClientRecipe(PythonRecipe): 4 | version = '0.4.0' 5 | url = 'https://pypi.python.org/packages/source/n/ndg-httpsclient/ndg_httpsclient-{version}.tar.gz' 6 | depends = ['python2', 'pyopenssl', 'cryptography'] 7 | call_hostpython_via_targetpython = False 8 | 9 | recipe = NdgHttpsClientRecipe() 10 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/netifaces/__init__.py: -------------------------------------------------------------------------------- 1 | from pythonforandroid.recipe import CompiledComponentsPythonRecipe 2 | from os.path import join 3 | 4 | 5 | class NetifacesRecipe(CompiledComponentsPythonRecipe): 6 | name = 'netifaces' 7 | version = '0.10.4' 8 | url = 'https://pypi.python.org/packages/source/n/netifaces/netifaces-{version}.tar.gz' 9 | site_packages_name = 'netifaces' 10 | depends = ['python2', 'setuptools'] 11 | 12 | def get_recipe_env(self, arch=None): 13 | env = super(NetifacesRecipe, self).get_recipe_env(arch) 14 | 15 | # TODO: fix hardcoded path 16 | # This is required to prevent issue with _io.so import. 17 | hostpython = self.get_recipe('hostpython2', self.ctx) 18 | env['PYTHONPATH'] = ( 19 | join(hostpython.get_build_dir(arch.arch), 'build', 20 | 'lib.linux-x86_64-2.7') + ':' + env.get('PYTHONPATH', '') 21 | ) 22 | return env 23 | 24 | 25 | recipe = NetifacesRecipe() 26 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/numpy/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | from pythonforandroid.toolchain import CompiledComponentsPythonRecipe, warning 3 | 4 | 5 | class NumpyRecipe(CompiledComponentsPythonRecipe): 6 | 7 | version = '1.9.2' 8 | url = 'http://pypi.python.org/packages/source/n/numpy/numpy-{version}.tar.gz' 9 | site_packages_name= 'numpy' 10 | 11 | depends = ['python2'] 12 | 13 | patches = ['patches/fix-numpy.patch', 14 | 'patches/prevent_libs_check.patch', 15 | 'patches/ar.patch', 16 | 'patches/lib.patch'] 17 | 18 | def prebuild_arch(self, arch): 19 | super(NumpyRecipe, self).prebuild_arch(arch) 20 | 21 | # AND: Fix this warning! 22 | warning('Numpy is built assuming the archiver name is ' 23 | 'arm-linux-androideabi-ar, which may not always be true!') 24 | 25 | 26 | recipe = NumpyRecipe() 27 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/numpy/patches/ar.patch: -------------------------------------------------------------------------------- 1 | --- a/numpy/distutils/unixccompiler.py 2015-02-01 17:38:21.000000000 +0100 2 | +++ b/numpy/distutils/unixccompiler.py 2015-07-08 17:21:05.742468485 +0200 3 | @@ -82,6 +82,8 @@ 4 | pass 5 | self.mkpath(os.path.dirname(output_filename)) 6 | tmp_objects = objects + self.objects 7 | + from os import environ 8 | + self.archiver[0] = 'arm-linux-androideabi-ar' 9 | while tmp_objects: 10 | objects = tmp_objects[:50] 11 | tmp_objects = tmp_objects[50:] 12 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/numpy/patches/prevent_libs_check.patch: -------------------------------------------------------------------------------- 1 | diff --git a/numpy/distutils/system_info.py b/numpy/distutils/system_info.py 2 | index a050430..471e958 100644 3 | --- a/numpy/distutils/system_info.py 4 | +++ b/numpy/distutils/system_info.py 5 | @@ -610,6 +610,7 @@ class system_info: 6 | return self.get_paths(self.section, key) 7 | 8 | def get_libs(self, key, default): 9 | + return [] 10 | try: 11 | libs = self.cp.get(self.section, key) 12 | except NoOptionError: 13 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/openssl/disable-sover.patch: -------------------------------------------------------------------------------- 1 | --- openssl/Makefile 2016-01-28 17:26:49.159522273 +0100 2 | +++ b/Makefile 2016-01-28 17:26:54.358438402 +0100 3 | @@ -342,7 +342,7 @@ 4 | link-shared: 5 | @ set -e; for i in $(SHLIBDIRS); do \ 6 | $(MAKE) -f $(HERE)/Makefile.shared -e $(BUILDENV) \ 7 | - LIBNAME=$$i LIBVERSION=$(SHLIB_MAJOR).$(SHLIB_MINOR) \ 8 | + LIBNAME=$$i LIBVERSION= \ 9 | LIBCOMPATVERSIONS=";$(SHLIB_VERSION_HISTORY)" \ 10 | symlink.$(SHLIB_TARGET); \ 11 | libs="$$libs -l$$i"; \ 12 | @@ -356,7 +356,7 @@ 13 | libs="$(LIBKRB5) $$libs"; \ 14 | fi; \ 15 | $(CLEARENV) && $(MAKE) -f Makefile.shared -e $(BUILDENV) \ 16 | - LIBNAME=$$i LIBVERSION=$(SHLIB_MAJOR).$(SHLIB_MINOR) \ 17 | + LIBNAME=$$i LIBVERSION= \ 18 | LIBCOMPATVERSIONS=";$(SHLIB_VERSION_HISTORY)" \ 19 | LIBDEPS="$$libs $(EX_LIBS)" \ 20 | link_a.$(SHLIB_TARGET); \ 21 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/pil/__init__.py: -------------------------------------------------------------------------------- 1 | from os.path import join 2 | 3 | from pythonforandroid.recipe import CompiledComponentsPythonRecipe 4 | 5 | 6 | class PILRecipe(CompiledComponentsPythonRecipe): 7 | name = 'pil' 8 | version = '1.1.7' 9 | url = 'http://effbot.org/downloads/Imaging-{version}.tar.gz' 10 | depends = [('python2', 'python3'), 'png', 'jpeg'] 11 | site_packages_name = 'PIL' 12 | 13 | patches = ['disable-tk.patch', 14 | 'fix-directories.patch'] 15 | 16 | def get_recipe_env(self, arch=None): 17 | env = super(PILRecipe, self).get_recipe_env(arch) 18 | 19 | png = self.get_recipe('png', self.ctx) 20 | png_lib_dir = png.get_lib_dir(arch) 21 | png_jni_dir = png.get_jni_dir(arch) 22 | jpeg = self.get_recipe('jpeg', self.ctx) 23 | jpeg_lib_dir = jpeg.get_lib_dir(arch) 24 | jpeg_jni_dir = jpeg.get_jni_dir(arch) 25 | env['JPEG_ROOT'] = '{}|{}'.format(jpeg_lib_dir, jpeg_jni_dir) 26 | 27 | cflags = ' -I{} -L{} -I{} -L{}'.format(png_jni_dir, png_lib_dir, jpeg_jni_dir, jpeg_lib_dir) 28 | env['CFLAGS'] += cflags 29 | env['CXXFLAGS'] += cflags 30 | env['CC'] += cflags 31 | env['CXX'] += cflags 32 | 33 | ndk_dir = self.ctx.ndk_platform 34 | ndk_lib_dir = join(ndk_dir, 'usr', 'lib') 35 | ndk_include_dir = join(ndk_dir, 'usr', 'include') 36 | env['ZLIB_ROOT'] = '{}|{}'.format(ndk_lib_dir, ndk_include_dir) 37 | 38 | return env 39 | 40 | 41 | recipe = PILRecipe() 42 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/pil/disable-tk.patch: -------------------------------------------------------------------------------- 1 | --- Imaging-1.1.7/setup.py.orig 2012-08-31 12:52:25.000000000 +0200 2 | +++ Imaging-1.1.7/setup.py 2012-08-31 12:53:04.000000000 +0200 3 | @@ -322,7 +322,7 @@ 4 | "_imagingcms", ["_imagingcms.c"], libraries=["lcms"] + extra 5 | )) 6 | 7 | - if sys.platform == "darwin": 8 | + if False: #sys.platform == "darwin": 9 | # locate Tcl/Tk frameworks 10 | frameworks = [] 11 | framework_roots = [ 12 | 13 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/png/__init__.py: -------------------------------------------------------------------------------- 1 | from pythonforandroid.recipe import NDKRecipe 2 | 3 | 4 | class PngRecipe(NDKRecipe): 5 | name = 'png' 6 | version = '1.6.15' 7 | url = 'https://github.com/julienr/libpng-android/archive/{version}.zip' 8 | 9 | generated_libraries = ['libpng.a'] 10 | 11 | 12 | recipe = PngRecipe() 13 | 14 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/pyasn1/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | from pythonforandroid.toolchain import PythonRecipe 3 | 4 | 5 | class PyASN1Recipe(PythonRecipe): 6 | version = '0.1.8' 7 | url = 'https://pypi.python.org/packages/source/p/pyasn1/pyasn1-{version}.tar.gz' 8 | depends = ['python2'] 9 | 10 | recipe = PyASN1Recipe() 11 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/pycparser/__init__.py: -------------------------------------------------------------------------------- 1 | from pythonforandroid.recipe import PythonRecipe 2 | 3 | 4 | class PycparserRecipe(PythonRecipe): 5 | name = 'pycparser' 6 | version = '2.14' 7 | url = 'https://pypi.python.org/packages/source/p/pycparser/pycparser-{version}.tar.gz' 8 | 9 | depends = [('python2', 'python3crystax'), 'setuptools'] 10 | 11 | call_hostpython_via_targetpython = False 12 | 13 | install_in_hostpython = True 14 | 15 | 16 | recipe = PycparserRecipe() 17 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/pycrypto/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | from pythonforandroid.toolchain import ( 3 | CompiledComponentsPythonRecipe, 4 | Recipe, 5 | current_directory, 6 | info, 7 | shprint, 8 | ) 9 | from os.path import join 10 | import sh 11 | 12 | 13 | class PyCryptoRecipe(CompiledComponentsPythonRecipe): 14 | version = '2.6.1' 15 | url = 'https://pypi.python.org/packages/source/p/pycrypto/pycrypto-{version}.tar.gz' 16 | depends = ['openssl', 'python2'] 17 | site_packages_name = 'Crypto' 18 | 19 | patches = ['add_length.patch'] 20 | 21 | def get_recipe_env(self, arch=None): 22 | env = super(PyCryptoRecipe, self).get_recipe_env(arch) 23 | openssl_build_dir = Recipe.get_recipe('openssl', self.ctx).get_build_dir(arch.arch) 24 | env['CC'] = '%s -I%s' % (env['CC'], join(openssl_build_dir, 'include')) 25 | env['LDFLAGS'] = env['LDFLAGS'] + ' -L{}'.format( 26 | self.ctx.get_libs_dir(arch.arch) + 27 | '-L{}'.format(self.ctx.libs_dir)) + ' -L{}'.format( 28 | openssl_build_dir) 29 | env['EXTRA_CFLAGS'] = '--host linux-armv' 30 | env['ac_cv_func_malloc_0_nonnull'] = 'yes' 31 | return env 32 | 33 | def build_compiled_components(self, arch): 34 | info('Configuring compiled components in {}'.format(self.name)) 35 | 36 | env = self.get_recipe_env(arch) 37 | with current_directory(self.get_build_dir(arch.arch)): 38 | configure = sh.Command('./configure') 39 | shprint(configure, '--host=arm-eabi', 40 | '--prefix={}'.format(self.ctx.get_python_install_dir()), 41 | '--enable-shared', _env=env) 42 | super(PyCryptoRecipe, self).build_compiled_components(arch) 43 | 44 | recipe = PyCryptoRecipe() 45 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/pycrypto/add_length.patch: -------------------------------------------------------------------------------- 1 | --- pycrypto-2.6.1/src/hash_SHA2_template.c.orig 2013-10-14 14:38:10.000000000 -0700 2 | +++ pycrypto-2.6.1/src/hash_SHA2_template.c 2014-05-19 10:15:51.000000000 -0700 3 | @@ -87,7 +87,7 @@ 4 | * return 1 on success 5 | * return 0 if the length overflows 6 | */ 7 | -int add_length(hash_state *hs, sha2_word_t inc) { 8 | +static int add_length(hash_state *hs, sha2_word_t inc) { 9 | sha2_word_t overflow_detector; 10 | overflow_detector = hs->length_lower; 11 | hs->length_lower += inc; 12 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/pygame/patches/fix-surface-access.patch: -------------------------------------------------------------------------------- 1 | --- pygame-1.9.1release/src/surface.c.orig 2012-01-06 15:05:14.457829356 +0100 2 | +++ pygame-1.9.1release/src/surface.c 2012-01-06 15:05:26.009829217 +0100 3 | @@ -1722,7 +1722,7 @@ 4 | { 5 | SDL_Surface *surf = PySurface_AsSurface (self); 6 | /* Need to use 64bit vars so this works on 64 bit pythons. */ 7 | - Uint64 r, g, b, a; 8 | + unsigned long r, g, b, a; 9 | 10 | if (!PyArg_ParseTuple (args, "(kkkk)", &r, &g, &b, &a)) 11 | return NULL; 12 | @@ -1734,10 +1734,12 @@ 13 | printf("what are: %d, %d, %d, %d\n", surf->format->Rmask, surf->format->Gmask, surf->format->Bmask, surf->format->Amask); 14 | */ 15 | 16 | - surf->format->Rmask = (Uint32)r; 17 | - surf->format->Gmask = (Uint32)g; 18 | - surf->format->Bmask = (Uint32)b; 19 | - surf->format->Amask = (Uint32)a; 20 | + SDL_PixelFormat *spf = surf->format; 21 | + 22 | + spf->Rmask = (Uint32)r; 23 | + spf->Gmask = (Uint32)g; 24 | + spf->Bmask = (Uint32)b; 25 | + spf->Amask = (Uint32)a; 26 | 27 | Py_RETURN_NONE; 28 | } 29 | @@ -1762,7 +1764,7 @@ 30 | surf_set_shifts (PyObject *self, PyObject *args) 31 | { 32 | SDL_Surface *surf = PySurface_AsSurface (self); 33 | - Uint64 r, g, b, a; 34 | + unsigned long r, g, b, a; 35 | 36 | if (!PyArg_ParseTuple (args, "(kkkk)", &r, &g, &b, &a)) 37 | return NULL; 38 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/pygame_bootstrap_components/__init__.py: -------------------------------------------------------------------------------- 1 | from pythonforandroid.toolchain import BootstrapNDKRecipe, current_directory, shprint, info 2 | from os.path import exists, join 3 | import sh 4 | import glob 5 | 6 | class PygameJNIComponentsRecipe(BootstrapNDKRecipe): 7 | version = 'master' 8 | url = 'https://github.com/kivy/p4a-pygame-bootstrap-components/archive/{version}.zip' 9 | dir_name = 'bootstrap_components' 10 | 11 | def prebuild_arch(self, arch): 12 | super(PygameJNIComponentsRecipe, self).postbuild_arch(arch) 13 | 14 | info('Unpacking pygame bootstrap JNI dir components') 15 | with current_directory(self.get_build_container_dir(arch)): 16 | if exists('sdl'): 17 | info('sdl dir exists, so it looks like the JNI components' + 18 | 'are already unpacked. Skipping.') 19 | return 20 | for dirn in glob.glob(join(self.get_build_dir(arch), 21 | 'pygame_bootstrap_jni', '*')): 22 | shprint(sh.mv, dirn, './') 23 | info('Unpacking was successful, deleting original container dir') 24 | shprint(sh.rm, '-rf', self.get_build_dir(arch)) 25 | 26 | 27 | recipe = PygameJNIComponentsRecipe() 28 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/pyjnius/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | from pythonforandroid.toolchain import CythonRecipe, shprint, current_directory, info 3 | from pythonforandroid.patching import will_build, check_any 4 | import sh 5 | from os.path import join 6 | 7 | 8 | class PyjniusRecipe(CythonRecipe): 9 | version = 'master' 10 | url = 'https://github.com/kivy/pyjnius/archive/{version}.zip' 11 | name = 'pyjnius' 12 | depends = [('python2', 'python3crystax'), ('sdl2', 'sdl'), 'six'] 13 | site_packages_name = 'jnius' 14 | 15 | patches = [('sdl2_jnienv_getter.patch', will_build('sdl2'))] 16 | 17 | def postbuild_arch(self, arch): 18 | super(PyjniusRecipe, self).postbuild_arch(arch) 19 | info('Copying pyjnius java class to classes build dir') 20 | with current_directory(self.get_build_dir(arch.arch)): 21 | shprint(sh.cp, '-a', join('jnius', 'src', 'org'), self.ctx.javaclass_dir) 22 | 23 | 24 | recipe = PyjniusRecipe() 25 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/pyjnius/recipe.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | VERSION_pyjnius=${VERSION_pyjnius:-master} 4 | URL_pyjnius=https://github.com/kivy/pyjnius/archive/$VERSION_pyjnius.zip 5 | DEPS_pyjnius=(python sdl) 6 | MD5_pyjnius= 7 | BUILD_pyjnius=$BUILD_PATH/pyjnius/$(get_directory $URL_pyjnius) 8 | RECIPE_pyjnius=$RECIPES_PATH/pyjnius 9 | 10 | function prebuild_pyjnius() { 11 | true 12 | } 13 | 14 | function shouldbuild_pyjnius() { 15 | if [ -d "$SITEPACKAGES_PATH/jnius" ]; then 16 | DO_BUILD=0 17 | fi 18 | } 19 | 20 | function build_pyjnius() { 21 | cd $BUILD_pyjnius 22 | 23 | push_arm 24 | 25 | export LDFLAGS="$LDFLAGS -L$LIBS_PATH" 26 | export LDSHARED="$LIBLINK" 27 | 28 | # fake try to be able to cythonize generated files 29 | $HOSTPYTHON setup.py build_ext 30 | try find . -iname '*.pyx' -exec $CYTHON {} \; 31 | try $HOSTPYTHON setup.py build_ext -v 32 | try find build/lib.* -name "*.o" -exec $STRIP {} \; 33 | try $HOSTPYTHON setup.py install -O2 34 | try cp -a jnius/src/org $JAVACLASS_PATH 35 | 36 | unset LDSHARED 37 | pop_arm 38 | } 39 | 40 | function postbuild_pyjnius() { 41 | true 42 | } 43 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/pyjnius/sdl2_jnienv_getter.patch: -------------------------------------------------------------------------------- 1 | diff --git a/jnius/jnius_jvm_android.pxi b/jnius/jnius_jvm_android.pxi 2 | index ac89fec..71daa43 100644 3 | --- a/jnius/jnius_jvm_android.pxi 4 | +++ b/jnius/jnius_jvm_android.pxi 5 | @@ -1,5 +1,5 @@ 6 | # on android, rely on SDL to get the JNI env 7 | -cdef extern JNIEnv *SDL_ANDROID_GetJNIEnv() 8 | +cdef extern JNIEnv *SDL_AndroidGetJNIEnv() 9 | 10 | cdef JNIEnv *get_platform_jnienv(): 11 | - return SDL_ANDROID_GetJNIEnv() 12 | + return SDL_AndroidGetJNIEnv() 13 | diff --git a/setup.py b/setup.py 14 | index 740510f..0c8e55f 100644 15 | --- a/setup.py 16 | +++ b/setup.py 17 | @@ -53,7 +53,7 @@ except ImportError: 18 | 19 | if platform == 'android': 20 | # for android, we use SDL... 21 | - libraries = ['sdl', 'log'] 22 | + libraries = ['SDL2', 'log'] 23 | library_dirs = ['libs/' + getenv('ARCH')] 24 | elif platform == 'darwin': 25 | import subprocess 26 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/pyopenssl/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | from pythonforandroid.toolchain import PythonRecipe 3 | 4 | 5 | class PyOpenSSLRecipe(PythonRecipe): 6 | version = '0.14' 7 | url = 'https://pypi.python.org/packages/source/p/pyOpenSSL/pyOpenSSL-{version}.tar.gz' 8 | depends = ['openssl', 'python2', 'setuptools'] 9 | site_packages_name = 'OpenSSL' 10 | 11 | call_hostpython_via_targetpython = False 12 | 13 | 14 | recipe = PyOpenSSLRecipe() 15 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/pyopenssl/fix-dlfcn.patch: -------------------------------------------------------------------------------- 1 | --- pyOpenSSL-0.13.orig/OpenSSL/__init__.py 2011-09-02 17:46:13.000000000 +0200 2 | +++ pyOpenSSL-0.13/OpenSSL/__init__.py 2013-07-29 17:20:15.750079894 +0200 3 | @@ -12,6 +12,11 @@ 4 | except AttributeError: 5 | from OpenSSL import crypto 6 | else: 7 | + # XXX android fix 8 | + # linux: RTLD_NOW (0x2) | RTLD_GLOBAL (0x100 / 256) 9 | + # android: RTLD_NOW (0x0) | RTLD_GLOBAL (0x2) 10 | + flags = 0x2 11 | + ''' 12 | try: 13 | import DLFCN 14 | except ImportError: 15 | @@ -31,6 +36,7 @@ 16 | else: 17 | flags = DLFCN.RTLD_NOW | DLFCN.RTLD_GLOBAL 18 | del DLFCN 19 | + ''' 20 | 21 | sys.setdlopenflags(flags) 22 | from OpenSSL import crypto 23 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/pysdl2/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | from pythonforandroid.toolchain import PythonRecipe, shprint, current_directory, ArchARM 3 | from os.path import exists, join 4 | import sh 5 | import glob 6 | 7 | class PySDL2Recipe(PythonRecipe): 8 | version = '0.9.3' 9 | url = 'https://bitbucket.org/marcusva/py-sdl2/downloads/PySDL2-{version}.tar.gz' 10 | 11 | depends = ['sdl2'] 12 | 13 | 14 | recipe = PySDL2Recipe() 15 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/python2/Setup.local-ssl: -------------------------------------------------------------------------------- 1 | SSL= 2 | _ssl _ssl.c \ 3 | -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \ 4 | -L$(SSL) -lssl -lcrypto 5 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/python2/patches/_scproxy.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Stub functions for _scproxy on iOS 3 | No proxy is supported yet. 4 | ''' 5 | 6 | def _get_proxy_settings(): 7 | return {'exclude_simple': 1} 8 | 9 | def _get_proxies(): 10 | return {} 11 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/python2/patches/ctypes-find-library-updated.patch: -------------------------------------------------------------------------------- 1 | diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py 2 | index 52b3520..01b13a9 100644 3 | --- a/Lib/ctypes/util.py 4 | +++ b/Lib/ctypes/util.py 5 | @@ -71,7 +71,23 @@ if os.name == "ce": 6 | def find_library(name): 7 | return name 8 | 9 | -if os.name == "posix" and sys.platform == "darwin": 10 | +# This patch overrides the find_library to look in the right places on 11 | +# Android 12 | +if True: 13 | + def find_library(name): 14 | + # Check the user app lib dir 15 | + app_root = os.path.abspath('./').split(os.path.sep)[0:4] 16 | + lib_search = os.path.sep.join(app_root) + os.path.sep + 'lib' 17 | + for filename in os.listdir(lib_search): 18 | + if filename.endswith('.so') and name in filename: 19 | + return lib_search + os.path.sep + filename 20 | + # Check the normal Android system libraries 21 | + for filename in os.listdir('/system/lib'): 22 | + if filename.endswith('.so') and name in filename: 23 | + return lib_search + os.path.sep + filename 24 | + return None 25 | + 26 | +elif os.name == "posix" and sys.platform == "darwin": 27 | from ctypes.macholib.dyld import dyld_find as _dyld_find 28 | def find_library(name): 29 | possible = ['lib%s.dylib' % name, 30 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/python2/patches/ctypes-find-library.patch: -------------------------------------------------------------------------------- 1 | diff -ur Python-2.7.2.orig/Lib/ctypes/util.py Python-2.7.2/Lib/ctypes/util.py 2 | --- Python-2.7.2.orig/Lib/ctypes/util.py 2011-06-11 16:46:24.000000000 +0100 3 | +++ Python-2.7.2/Lib/ctypes/util.py 2015-05-10 15:50:18.906203529 +0100 4 | @@ -71,7 +71,21 @@ 5 | def find_library(name): 6 | return name 7 | 8 | -if os.name == "posix" and sys.platform == "darwin": 9 | +# this test is for android specifically shoudl match here and ignore any 10 | +# of the other platform tests below 11 | +if os.name == "posix": 12 | + def find_library(name): 13 | + """ hack to find librarys for kivy and android 14 | + split the path and get the first parts which will give us 15 | + the app path something like /data/data/org.app.foo/""" 16 | + app_root = os.path.abspath('./').split(os.path.sep)[0:4] 17 | + lib_search = os.path.sep.join(app_root) + os.path.sep + 'lib' 18 | + for filename in os.listdir(lib_search): 19 | + if filename.endswith('.so') and name in filename: 20 | + return lib_search + os.path.sep + filename 21 | + return None 22 | + 23 | +elif os.name == "posix" and sys.platform == "darwin": 24 | from ctypes.macholib.dyld import dyld_find as _dyld_find 25 | def find_library(name): 26 | possible = ['lib%s.dylib' % name, 27 | Only in Python-2.7.2/Lib/ctypes: util.py.save 28 | Only in Python-2.7.2/Lib/ctypes: util.py.save.1 29 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/python2/patches/disable-modules.patch: -------------------------------------------------------------------------------- 1 | --- Python-2.7.2.orig/setup.py 2010-10-31 17:40:21.000000000 +0100 2 | +++ Python-2.7.2/setup.py 2011-11-27 16:49:36.840204364 +0100 3 | @@ -21,7 +21,7 @@ 4 | COMPILED_WITH_PYDEBUG = hasattr(sys, 'gettotalrefcount') 5 | 6 | # This global variable is used to hold the list of modules to be disabled. 7 | -disabled_module_list = [] 8 | +disabled_module_list = ['spwd','bz2','ossaudiodev','_curses','_curses_panel','readline','_locale','_bsddb','gdbm','dbm','nis','linuxaudiodev','crypt','_multiprocessing'] 9 | 10 | def add_dir_to_list(dirlist, dir): 11 | """Add the directory 'dir' to the list 'dirlist' (at the front) if 12 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/python2/patches/enable-ssl.patch: -------------------------------------------------------------------------------- 1 | --- python2/Modules/Setup.dist 2011-06-11 10:46:26.000000000 -0500 2 | +++ b/Modules/Setup.dist 2015-12-28 16:18:13.329648940 -0600 3 | @@ -211,10 +211,10 @@ 4 | 5 | # Socket module helper for SSL support; you must comment out the other 6 | # socket line above, and possibly edit the SSL variable: 7 | -#SSL=/usr/local/ssl 8 | -#_ssl _ssl.c \ 9 | -# -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \ 10 | -# -L$(SSL)/lib -lssl -lcrypto 11 | +SSL=/p4a/path/to/openssl 12 | +_ssl _ssl.c \ 13 | + -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \ 14 | + -L$(SSL) -lssl -lcrypto 15 | 16 | # The crypt module is now disabled by default because it breaks builds 17 | # on many systems (where -lcrypt is needed), e.g. Linux (I believe). 18 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/python2/patches/fix-configure-darwin.patch: -------------------------------------------------------------------------------- 1 | --- Python-2.7.2.orig/configure 2012-07-09 23:48:02.000000000 +0200 2 | +++ Python-2.7.2/configure 2012-07-09 23:47:34.000000000 +0200 3 | @@ -4927,7 +4927,7 @@ 4 | RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH} 5 | INSTSONAME="$LDLIBRARY".$SOVERSION 6 | ;; 7 | - Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*) 8 | + Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|Darwin*) 9 | LDLIBRARY='libpython$(VERSION).so' 10 | BLDLIBRARY='-L. -lpython$(VERSION)' 11 | RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH} 12 | @@ -4960,7 +4960,7 @@ 13 | BLDLIBRARY='-L. -lpython$(VERSION)' 14 | RUNSHARED=DLL_PATH=`pwd`:${DLL_PATH:-/atheos/sys/libs:/atheos/autolnk/lib} 15 | ;; 16 | - Darwin*) 17 | + DDarwin*) 18 | LDLIBRARY='libpython$(VERSION).dylib' 19 | BLDLIBRARY='-L. -lpython$(VERSION)' 20 | RUNSHARED='DYLD_LIBRARY_PATH=`pwd`:${DYLD_LIBRARY_PATH}' 21 | @@ -7625,6 +7625,9 @@ 22 | LDSHARED='ld -b' 23 | fi ;; 24 | OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";; 25 | + Darwin*|Linux*|GNU*|QNX*) 26 | + LDSHARED='$(CC) -shared' 27 | + LDCXXSHARED='$(CXX) -shared';; 28 | Darwin/1.3*) 29 | LDSHARED='$(CC) -bundle' 30 | LDCXXSHARED='$(CXX) -bundle' 31 | @@ -7680,9 +7683,6 @@ 32 | fi 33 | fi 34 | ;; 35 | - Linux*|GNU*|QNX*) 36 | - LDSHARED='$(CC) -shared' 37 | - LDCXXSHARED='$(CXX) -shared';; 38 | BSD/OS*/4*) 39 | LDSHARED="gcc -shared" 40 | LDCXXSHARED="g++ -shared";; 41 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/python2/patches/fix-distutils-darwin.patch: -------------------------------------------------------------------------------- 1 | --- Python-2.7.2.orig/Lib/distutils/command/build_ext.py 2011-06-11 17:46:24.000000000 +0200 2 | +++ Python-2.7.2/Lib/distutils/command/build_ext.py 2012-08-01 18:32:13.000000000 +0200 3 | @@ -236,7 +236,7 @@ 4 | # Python's library directory must be appended to library_dirs 5 | sysconfig.get_config_var('Py_ENABLE_SHARED') 6 | if ((sys.platform.startswith('linux') or sys.platform.startswith('gnu') 7 | - or sys.platform.startswith('sunos')) 8 | + or sys.platform.startswith('sunos') or sys.platform.startswith('darwin')) 9 | and sysconfig.get_config_var('Py_ENABLE_SHARED')): 10 | if sys.executable.startswith(os.path.join(sys.exec_prefix, "bin")): 11 | # building third party extensions 12 | @@ -750,9 +750,9 @@ 13 | # extensions, it is a reference to the original list 14 | return ext.libraries + [pythonlib, "m"] + extra 15 | 16 | - elif sys.platform == 'darwin': 17 | - # Don't use the default code below 18 | - return ext.libraries 19 | + #elif sys.platform == 'darwin': 20 | + # # Don't use the default code below 21 | + # return ext.libraries 22 | elif sys.platform[:3] == 'aix': 23 | # Don't use the default code below 24 | return ext.libraries 25 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/python2/patches/fix-dlfcn.patch: -------------------------------------------------------------------------------- 1 | diff -Naur Python-2.7.2.orig/Lib/plat-linux2/DLFCN.py Python-2.7.2/Lib/plat-linux2/DLFCN.py 2 | --- Python-2.7.2.orig/Lib/plat-linux2/DLFCN.py 2011-06-11 17:46:24.000000000 +0200 3 | +++ Python-2.7.2/Lib/plat-linux2/DLFCN.py 2013-07-29 16:34:45.318131844 +0200 4 | @@ -74,10 +74,17 @@ 5 | # Included from gnu/stubs.h 6 | 7 | # Included from bits/dlfcn.h 8 | +# PATCHED FOR ANDROID (the only supported symbols are): 9 | +# enum { 10 | +# RTLD_NOW = 0, 11 | +# RTLD_LAZY = 1, 12 | +# RTLD_LOCAL = 0, 13 | +# RTLD_GLOBAL = 2, 14 | +# }; 15 | RTLD_LAZY = 0x00001 16 | -RTLD_NOW = 0x00002 17 | -RTLD_BINDING_MASK = 0x3 18 | -RTLD_NOLOAD = 0x00004 19 | -RTLD_GLOBAL = 0x00100 20 | +RTLD_NOW = 0x00000 21 | +RTLD_BINDING_MASK = 0x0 22 | +RTLD_NOLOAD = 0x00000 23 | +RTLD_GLOBAL = 0x00002 24 | RTLD_LOCAL = 0 25 | -RTLD_NODELETE = 0x01000 26 | +RTLD_NODELETE = 0x00000 27 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/python2/patches/fix-dynamic-lookup.patch: -------------------------------------------------------------------------------- 1 | --- Python-2.7.2/Makefile.pre.in.orig 2012-07-05 17:09:45.000000000 +0200 2 | +++ Python-2.7.2/Makefile.pre.in 2012-07-05 17:10:00.000000000 +0200 3 | @@ -435,7 +435,7 @@ 4 | fi 5 | 6 | libpython$(VERSION).dylib: $(LIBRARY_OBJS) 7 | - $(CC) -dynamiclib -Wl,-single_module $(LDFLAGS) -undefined dynamic_lookup -Wl,-install_name,$(prefix)/lib/libpython$(VERSION).dylib -Wl,-compatibility_version,$(VERSION) -Wl,-current_version,$(VERSION) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \ 8 | + $(CC) -dynamiclib -Wl,-single_module $(LDFLAGS) -Wl,-install_name,$(prefix)/lib/libpython$(VERSION).dylib -Wl,-compatibility_version,$(VERSION) -Wl,-current_version,$(VERSION) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \ 9 | 10 | 11 | libpython$(VERSION).sl: $(LIBRARY_OBJS) 12 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/python2/patches/fix-filesystemdefaultencoding.patch: -------------------------------------------------------------------------------- 1 | --- Python-2.7.2.orig/Python/bltinmodule.c 2012-03-30 01:44:57.018079845 +0200 2 | +++ Python-2.7.2/Python/bltinmodule.c 2012-03-30 01:45:02.650079649 +0200 3 | @@ -22,7 +22,7 @@ 4 | #elif defined(__APPLE__) 5 | const char *Py_FileSystemDefaultEncoding = "utf-8"; 6 | #else 7 | -const char *Py_FileSystemDefaultEncoding = NULL; /* use default */ 8 | +const char *Py_FileSystemDefaultEncoding = "utf-8"; /* use default */ 9 | #endif 10 | 11 | /* Forward */ 12 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/python2/patches/fix-ftime-removal.patch: -------------------------------------------------------------------------------- 1 | diff -u -r Python-2.7.2.orig/Modules/timemodule.c Python-2.7.2/Modules/timemodule.c 2 | --- Python-2.7.2.orig/Modules/timemodule.c 2011-06-11 15:46:27.000000000 +0000 3 | +++ Python-2.7.2/Modules/timemodule.c 2015-09-11 10:37:36.708661691 +0000 4 | @@ -27,6 +27,7 @@ 5 | #include 6 | #endif 7 | 8 | +#undef HAVE_FTIME 9 | #ifdef HAVE_FTIME 10 | #include 11 | #if !defined(MS_WINDOWS) && !defined(PYOS_OS2) 12 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/python2/patches/fix-gethostbyaddr.patch: -------------------------------------------------------------------------------- 1 | --- Python-2.7.2/Modules/socketmodule.c.orig 2012-01-06 01:40:09.915694810 +0100 2 | +++ Python-2.7.2/Modules/socketmodule.c 2012-01-06 01:40:36.967694486 +0100 3 | @@ -146,6 +146,9 @@ 4 | On the other hand, not all Linux versions agree, so there the settings 5 | computed by the configure script are needed! */ 6 | 7 | +/* Android hack, same reason are what is described above */ 8 | +#undef HAVE_GETHOSTBYNAME_R 9 | + 10 | #ifndef linux 11 | # undef HAVE_GETHOSTBYNAME_R_3_ARG 12 | # undef HAVE_GETHOSTBYNAME_R_5_ARG 13 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/python2/patches/fix-remove-corefoundation.patch: -------------------------------------------------------------------------------- 1 | --- Python-2.7.2/configure.orig 2012-07-05 16:44:36.000000000 +0200 2 | +++ Python-2.7.2/configure 2012-07-05 16:44:44.000000000 +0200 3 | @@ -13732,10 +13732,6 @@ 4 | 5 | fi 6 | 7 | -if test $ac_sys_system = Darwin 8 | -then 9 | - LIBS="$LIBS -framework CoreFoundation" 10 | -fi 11 | 12 | 13 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for %zd printf() format support" >&5 14 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/python2/patches/fix-setup-flags.patch: -------------------------------------------------------------------------------- 1 | --- Python-2.7.2/setup.py.orig 2012-01-08 15:10:39.867332119 +0100 2 | +++ Python-2.7.2/setup.py 2012-01-08 15:10:45.723331911 +0100 3 | @@ -445,6 +445,13 @@ 4 | '/lib', '/usr/lib', 5 | ] 6 | inc_dirs += ['/usr/include'] 7 | + else: 8 | + cflags = os.environ.get('CFLAGS') 9 | + if cflags: 10 | + inc_dirs += [x[2:] for x in cflags.split() if x.startswith('-I')] 11 | + ldflags = os.environ.get('LDFLAGS') 12 | + if ldflags: 13 | + lib_dirs += [x[2:] for x in ldflags.split() if x.startswith('-L')] 14 | exts = [] 15 | missing = [] 16 | 17 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/python2/patches/fix-termios.patch: -------------------------------------------------------------------------------- 1 | --- Python-2.7.2.orig/Modules/termios.c 2012-06-12 02:49:39.780162534 +0200 2 | +++ Python-2.7.2/Modules/termios.c 2012-06-12 02:51:52.092157828 +0200 3 | @@ -227,6 +227,7 @@ 4 | return Py_None; 5 | } 6 | 7 | +#if 0 // No tcdrain defined for Android. 8 | PyDoc_STRVAR(termios_tcdrain__doc__, 9 | "tcdrain(fd) -> None\n\ 10 | \n\ 11 | @@ -246,6 +247,7 @@ 12 | Py_INCREF(Py_None); 13 | return Py_None; 14 | } 15 | +#endif 16 | 17 | PyDoc_STRVAR(termios_tcflush__doc__, 18 | "tcflush(fd, queue) -> None\n\ 19 | @@ -301,8 +303,10 @@ 20 | METH_VARARGS, termios_tcsetattr__doc__}, 21 | {"tcsendbreak", termios_tcsendbreak, 22 | METH_VARARGS, termios_tcsendbreak__doc__}, 23 | +#if 0 // No tcdrain defined for Android. 24 | {"tcdrain", termios_tcdrain, 25 | METH_VARARGS, termios_tcdrain__doc__}, 26 | +#endif 27 | {"tcflush", termios_tcflush, 28 | METH_VARARGS, termios_tcflush__doc__}, 29 | {"tcflow", termios_tcflow, 30 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/python2/patches/parsetuple.patch: -------------------------------------------------------------------------------- 1 | --- Python-2.7.2/configure.orig 2015-06-24 17:47:39.181473779 +0200 2 | +++ Python-2.7.2/configure 2015-06-24 17:48:31.646173137 +0200 3 | @@ -5731,7 +5731,7 @@ 4 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gcc supports ParseTuple __format__" >&5 5 | $as_echo_n "checking whether gcc supports ParseTuple __format__... " >&6; } 6 | save_CFLAGS=$CFLAGS 7 | - CFLAGS="$CFLAGS -Werror" 8 | + CFLAGS="$CFLAGS -Werror -Wformat" 9 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext 10 | /* end confdefs.h. */ 11 | 12 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/python2/patches/t_files/a899e84.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geohot/python-for-android/19500c8c32dd6954a32af9c6eb6bc81cae363e10/pythonforandroid/recipes/python2/patches/t_files/a899e84.jpg -------------------------------------------------------------------------------- /pythonforandroid/recipes/python2/patches/t_files/legal_hacks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geohot/python-for-android/19500c8c32dd6954a32af9c6eb6bc81cae363e10/pythonforandroid/recipes/python2/patches/t_files/legal_hacks.png -------------------------------------------------------------------------------- /pythonforandroid/recipes/python2/patches/t_files/te-news.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geohot/python-for-android/19500c8c32dd6954a32af9c6eb6bc81cae363e10/pythonforandroid/recipes/python2/patches/t_files/te-news.png -------------------------------------------------------------------------------- /pythonforandroid/recipes/python2/patches/t_files/terrible_small_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geohot/python-for-android/19500c8c32dd6954a32af9c6eb6bc81cae363e10/pythonforandroid/recipes/python2/patches/t_files/terrible_small_logo.png -------------------------------------------------------------------------------- /pythonforandroid/recipes/python2/patches/verbose-compilation.patch: -------------------------------------------------------------------------------- 1 | --- Python-2.7.2/Makefile.pre.in.orig 2012-01-07 18:25:42.097075564 +0100 2 | +++ Python-2.7.2/Makefile.pre.in 2012-01-07 18:26:03.289074810 +0100 3 | @@ -410,8 +410,8 @@ 4 | # Build the shared modules 5 | sharedmods: $(BUILDPYTHON) 6 | @case $$MAKEFLAGS in \ 7 | - *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' PYTHONXCPREFIX='$(DESTDIR)$(prefix)' $(HOSTPYTHON) -E $(srcdir)/setup.py -q build;; \ 8 | - *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' PYTHONXCPREFIX='$(DESTDIR)$(prefix)' $(HOSTPYTHON) -E $(srcdir)/setup.py build;; \ 9 | + *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' PYTHONXCPREFIX='$(DESTDIR)$(prefix)' $(HOSTPYTHON) -E $(srcdir)/setup.py build -v;; \ 10 | + *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' PYTHONXCPREFIX='$(DESTDIR)$(prefix)' $(HOSTPYTHON) -E $(srcdir)/setup.py build -v;; \ 11 | esac 12 | 13 | # Build static library 14 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/python3/patches-termux/Lib-tmpfile.py.patch: -------------------------------------------------------------------------------- 1 | diff -u -r ../Python-3.4.3/Lib/tempfile.py ./Lib/tempfile.py 2 | --- ../Python-3.4.3/Lib/tempfile.py 2015-02-25 06:27:44.000000000 -0500 3 | +++ ./Lib/tempfile.py 2015-07-21 19:58:07.631659902 -0400 4 | @@ -124,7 +124,7 @@ 5 | if _os.name == 'nt': 6 | dirlist.extend([ r'c:\temp', r'c:\tmp', r'\temp', r'\tmp' ]) 7 | else: 8 | - dirlist.extend([ '/tmp', '/var/tmp', '/usr/tmp' ]) 9 | + dirlist.extend([ '@TERMUX_PREFIX@/tmp' ]) 10 | 11 | # As a last resort, the current directory. 12 | try: 13 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/python3/patches-termux/_cursesmodule.c.patch: -------------------------------------------------------------------------------- 1 | We use libandroid-support when building Python, but Python does not 2 | use LDFLAGS when building modules (and not much point in this case). 3 | 4 | diff -u -r ../Python-3.4.1/Modules/_cursesmodule.c ./Modules/_cursesmodule.c 5 | --- ../Python-3.4.1/Modules/_cursesmodule.c 2014-05-19 07:19:39.000000000 +0200 6 | +++ ./Modules/_cursesmodule.c 2014-06-04 08:56:50.441097925 +0200 7 | @@ -121,7 +121,7 @@ 8 | #include 9 | #endif 10 | 11 | -#ifdef HAVE_LANGINFO_H 12 | +#if defined(HAVE_LANGINFO_H) && !defined(__ANDROID__) 13 | #include 14 | #endif 15 | 16 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/python3/patches-termux/dlfcn_py_android.patch: -------------------------------------------------------------------------------- 1 | From https://github.com/kivy/python-for-android/blob/master/recipes/python/patches/fix-dlfcn.patch 2 | 3 | See https://github.com/kivy/python-for-android/issues/141 4 | diff -u -r ../Python-3.4.0rc1/Lib/plat-linux/DLFCN.py ./Lib/plat-linux/DLFCN.py 5 | --- ../Python-3.4.0rc1/Lib/plat-linux/DLFCN.py 2014-02-10 23:51:49.000000000 +0100 6 | +++ ./Lib/plat-linux/DLFCN.py 2014-02-13 03:25:19.000000000 +0100 7 | @@ -74,10 +74,18 @@ 8 | # Included from gnu/stubs.h 9 | 10 | # Included from bits/dlfcn.h 11 | + 12 | +# PATCHED FOR ANDROID (the only supported symbols are): 13 | +# enum { 14 | +# RTLD_NOW = 0, 15 | +# RTLD_LAZY = 1, 16 | +# RTLD_LOCAL = 0, 17 | +# RTLD_GLOBAL = 2, 18 | +# }; 19 | RTLD_LAZY = 0x00001 20 | -RTLD_NOW = 0x00002 21 | -RTLD_BINDING_MASK = 0x3 22 | -RTLD_NOLOAD = 0x00004 23 | -RTLD_GLOBAL = 0x00100 24 | +RTLD_NOW = 0x00000 25 | +RTLD_BINDING_MASK = 0x0 26 | +RTLD_NOLOAD = 0x00000 27 | +RTLD_GLOBAL = 0x00002 28 | RTLD_LOCAL = 0 29 | -RTLD_NODELETE = 0x01000 30 | +RTLD_NODELETE = 0x00000 31 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/python3/patches-termux/pwdmodule_no_pw_gecos.patch: -------------------------------------------------------------------------------- 1 | diff -u -r ../Python-3.4.0rc1/Modules/pwdmodule.c ./Modules/pwdmodule.c 2 | --- ../Python-3.4.0rc1/Modules/pwdmodule.c 2014-02-10 23:51:50.000000000 +0100 3 | +++ ./Modules/pwdmodule.c 2014-02-13 02:16:12.000000000 +0100 4 | @@ -72,7 +72,12 @@ 5 | SETS(setIndex++, p->pw_passwd); 6 | PyStructSequence_SET_ITEM(v, setIndex++, _PyLong_FromUid(p->pw_uid)); 7 | PyStructSequence_SET_ITEM(v, setIndex++, _PyLong_FromGid(p->pw_gid)); 8 | +#ifdef __ANDROID__ 9 | + SETS(setIndex++, Py_None); 10 | + Py_INCREF(Py_None); 11 | +#else 12 | SETS(setIndex++, p->pw_gecos); 13 | +#endif 14 | SETS(setIndex++, p->pw_dir); 15 | SETS(setIndex++, p->pw_shell); 16 | 17 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/python3/patches-termux/setup.py.patch: -------------------------------------------------------------------------------- 1 | diff -u -r ../Python-3.4.1/setup.py ./setup.py 2 | --- ../Python-3.4.1/setup.py 2014-05-19 07:19:40.000000000 +0200 3 | +++ ./setup.py 2014-06-04 11:12:26.776875501 +0200 4 | @@ -568,7 +568,8 @@ 5 | libraries=math_libs) ) 6 | 7 | # time libraries: librt may be needed for clock_gettime() 8 | - time_libs = [] 9 | + # math_libs is needed by floatsleep() 10 | + time_libs = list(math_libs) 11 | lib = sysconfig.get_config_var('TIMEMODULE_LIB') 12 | if lib: 13 | time_libs.append(lib) 14 | @@ -625,7 +626,8 @@ 15 | missing.append('spwd') 16 | 17 | # select(2); not on ancient System V 18 | - exts.append( Extension('select', ['selectmodule.c']) ) 19 | + # selectmodule.c calls the ceil(3) math function 20 | + exts.append( Extension('select', ['selectmodule.c'], libraries=math_libs) ) 21 | 22 | # Fred Drake's interface to the Python parser 23 | exts.append( Extension('parser', ['parsermodule.c']) ) 24 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/python3/patches-termux/subprocess.py.patch: -------------------------------------------------------------------------------- 1 | diff -u -r ../Python-3.4.1/Lib/subprocess.py ./Lib/subprocess.py 2 | --- ../Python-3.4.1/Lib/subprocess.py 2014-05-19 07:19:38.000000000 +0200 3 | +++ ./Lib/subprocess.py 2014-06-04 11:31:48.708843737 +0200 4 | @@ -1344,7 +1344,7 @@ 5 | args = list(args) 6 | 7 | if shell: 8 | - args = ["/bin/sh", "-c"] + args 9 | + args = ["/system/bin/sh", "-c"] + args 10 | if executable: 11 | args[0] = executable 12 | 13 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/python3/patches/python-3.4.2-android-missing-getdents64-definition.patch: -------------------------------------------------------------------------------- 1 | diff -ru Python-3.3.5/Modules/_posixsubprocess.c Python-3.3.5-android/Modules/_posixsubprocess.c 2 | --- Python-3.3.5/Modules/_posixsubprocess.c 2014-03-09 09:40:26.000000000 +0100 3 | +++ Python-3.3.5-android/Modules/_posixsubprocess.c 2014-08-04 22:19:36.000000000 +0200 4 | @@ -18,6 +18,12 @@ 5 | #include 6 | #endif 7 | 8 | +#if defined(__ANDROID__) 9 | +/* Android doesn't expose syscalls. Let's add the definition manually. */ 10 | +# include 11 | +# define SYS_getdents64 __NR_getdents64 12 | +#endif 13 | + 14 | #if defined(sun) 15 | /* readdir64 is used to work around Solaris 9 bug 6395699. */ 16 | # define readdir readdir64 17 | 18 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/python3/patches/python-3.4.2-libpymodules_loader.patch: -------------------------------------------------------------------------------- 1 | diff --git a/Python/dynload_shlib.c b/Python/dynload_shlib.c 2 | index 7f8f134..bba560f 100644 3 | --- a/Python/dynload_shlib.c 4 | +++ b/Python/dynload_shlib.c 5 | @@ -62,6 +62,20 @@ _PyImport_FindSharedFuncptr(const char *prefix, 6 | char pathbuf[260]; 7 | int dlopenflags=0; 8 | 9 | + static void *libpymodules = NULL; 10 | + void *rv = NULL; 11 | + 12 | + /* Ensure we have access to libpymodules. */ 13 | + if (libpymodules == NULL) { 14 | + printf("ANDROID_PRIVATE = %s\n", getenv("ANDROID_PRIVATE")); 15 | + PyOS_snprintf(pathbuf, sizeof(pathbuf), "%s/libpymodules.so", getenv("ANDROID_PRIVATE")); 16 | + libpymodules = dlopen(pathbuf, RTLD_NOW); 17 | + 18 | + if (libpymodules == NULL) { 19 | + //abort(); 20 | + } 21 | + } 22 | + 23 | if (strchr(pathname, '/') == NULL) { 24 | /* Prefix bare filename with "./" */ 25 | PyOS_snprintf(pathbuf, sizeof(pathbuf), "./%-.255s", pathname); 26 | @@ -71,6 +85,16 @@ _PyImport_FindSharedFuncptr(const char *prefix, 27 | PyOS_snprintf(funcname, sizeof(funcname), 28 | LEAD_UNDERSCORE "%.20s_%.200s", prefix, shortname); 29 | 30 | + 31 | + /* Read symbols that have been linked into the main binary. */ 32 | + 33 | + if (libpymodules) { 34 | + rv = dlsym(libpymodules, funcname); 35 | + if (rv != NULL) { 36 | + return rv; 37 | + } 38 | + } 39 | + 40 | if (fp != NULL) { 41 | int i; 42 | struct _Py_stat_struct status; 43 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/python3crystax/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | from pythonforandroid.recipe import TargetPythonRecipe 3 | from pythonforandroid.toolchain import shprint, current_directory, ArchARM 4 | from pythonforandroid.logger import info 5 | from pythonforandroid.util import ensure_dir 6 | from os.path import exists, join 7 | from os import uname 8 | import glob 9 | import sh 10 | 11 | class Python3Recipe(TargetPythonRecipe): 12 | version = '3.5' 13 | url = '' 14 | name = 'python3crystax' 15 | 16 | depends = ['hostpython3crystax'] 17 | conflicts = ['python2', 'python3'] 18 | 19 | from_crystax = True 20 | 21 | def get_dir_name(self): 22 | name = super(Python3Recipe, self).get_dir_name() 23 | name += '-version{}'.format(self.version) 24 | return name 25 | 26 | def build_arch(self, arch): 27 | info('Extracting CrystaX python3 from NDK package') 28 | 29 | dirn = self.ctx.get_python_install_dir() 30 | ensure_dir(dirn) 31 | 32 | self.ctx.hostpython = 'python{}'.format(self.version) 33 | # ensure_dir(join(dirn, 'lib')) 34 | # ensure_dir(join(dirn, 'lib', 'python{}'.format(self.version), 35 | # 'site-packages')) 36 | 37 | # ndk_dir = self.ctx.ndk_dir 38 | # sh.cp('-r', '/home/asandy/kivytest/crystax_stdlib', join(dirn, 'lib', 'python3.5')) 39 | # sh.cp('-r', '/home/asandy/android/crystax-ndk-10.3.0/sources/python/3.5/libs/armeabi/modules', join(dirn, 'lib', 'python3.5', 'lib-dynload')) 40 | # ensure_dir(join(dirn, 'lib', 'site-packages')) 41 | 42 | recipe = Python3Recipe() 43 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/pytz/__init__.py: -------------------------------------------------------------------------------- 1 | from pythonforandroid.recipe import PythonRecipe 2 | 3 | 4 | class PytzRecipe(PythonRecipe): 5 | name = 'pytz' 6 | version = '2015.7' 7 | url = 'https://pypi.python.org/packages/source/p/pytz/pytz-{version}.tar.bz2' 8 | 9 | depends = [('python2', 'python3crystax')] 10 | 11 | call_hostpython_via_targetpython = False 12 | install_in_hostpython = True 13 | 14 | 15 | recipe = PytzRecipe() 16 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/pyusb/__init__.py: -------------------------------------------------------------------------------- 1 | from pythonforandroid.recipe import PythonRecipe 2 | 3 | 4 | class PyusbRecipe(PythonRecipe): 5 | name = 'pyusb' 6 | version = '1.0.0b1' 7 | url = 'https://pypi.python.org/packages/source/p/pyusb/pyusb-{version}.tar.gz' 8 | depends = [('python2', 'python3')] 9 | site_packages_name = 'usb' 10 | 11 | patches = ['fix-android.patch'] 12 | 13 | 14 | recipe = PyusbRecipe() 15 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/pyusb/fix-android.patch: -------------------------------------------------------------------------------- 1 | --- pyusb-1.0.0b1.orig/usb/backend/libusb1.py 2013-10-21 12:56:10.000000000 -0500 2 | +++ pyusb-1.0.0b1/usb/backend/libusb1.py 2014-12-08 16:49:07.141514148 -0600 3 | @@ -265,13 +265,7 @@ 4 | 5 | def _load_library(): 6 | if sys.platform != 'cygwin': 7 | - candidates = ('usb-1.0', 'libusb-1.0', 'usb') 8 | - for candidate in candidates: 9 | - if sys.platform == 'win32': 10 | - candidate = candidate + '.dll' 11 | - 12 | - libname = ctypes.util.find_library(candidate) 13 | - if libname is not None: break 14 | + libname = '/system/lib/libusb1.0.so' 15 | else: 16 | # corner cases 17 | # cygwin predefines library names with 'cyg' instead of 'lib' 18 | @@ -672,16 +666,21 @@ 19 | 20 | # implementation of libusb 1.0 backend 21 | class _LibUSB(usb.backend.IBackend): 22 | + 23 | + ran_init = False 24 | + 25 | @methodtrace(_logger) 26 | def __init__(self, lib): 27 | usb.backend.IBackend.__init__(self) 28 | self.lib = lib 29 | self.ctx = c_void_p() 30 | _check(self.lib.libusb_init(byref(self.ctx))) 31 | + self.ran_init = True 32 | 33 | @methodtrace(_logger) 34 | def __del__(self): 35 | - self.lib.libusb_exit(self.ctx) 36 | + if self.ran_init is True: 37 | + self.lib.libusb_exit(self.ctx) 38 | 39 | 40 | @methodtrace(_logger) 41 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/sdl/__init__.py: -------------------------------------------------------------------------------- 1 | from pythonforandroid.toolchain import BootstrapNDKRecipe, shprint, ArchARM, current_directory, info 2 | from os.path import exists, join 3 | import sh 4 | 5 | class LibSDLRecipe(BootstrapNDKRecipe): 6 | version = "1.2.14" 7 | url = None 8 | name = 'sdl' 9 | depends = ['python2', 'pygame_bootstrap_components'] 10 | conflicts = ['sdl2'] 11 | 12 | def build_arch(self, arch): 13 | 14 | if exists(join(self.ctx.libs_dir, 'libsdl.so')): 15 | info('libsdl.so already exists, skipping sdl build.') 16 | return 17 | 18 | env = arch.get_env() 19 | 20 | with current_directory(self.get_jni_dir()): 21 | shprint(sh.ndk_build, 'V=1', _env=env, _tail=20, _critical=True) 22 | 23 | libs_dir = join(self.ctx.bootstrap.build_dir, 'libs', arch.arch) 24 | import os 25 | contents = list(os.walk(libs_dir))[0][-1] 26 | for content in contents: 27 | shprint(sh.cp, '-a', join(self.ctx.bootstrap.build_dir, 'libs', arch.arch, content), 28 | self.ctx.libs_dir) 29 | 30 | 31 | recipe = LibSDLRecipe() 32 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/sdl2/__init__.py: -------------------------------------------------------------------------------- 1 | from pythonforandroid.toolchain import BootstrapNDKRecipe, shprint, current_directory, info 2 | from os.path import exists, join 3 | import sh 4 | 5 | 6 | class LibSDL2Recipe(BootstrapNDKRecipe): 7 | version = "2.0.3" 8 | url = "https://www.libsdl.org/release/SDL2-{version}.tar.gz" 9 | 10 | dir_name = 'SDL' 11 | 12 | depends = [('python2', 'python3crystax'), 'sdl2_image', 'sdl2_mixer', 'sdl2_ttf'] 13 | conflicts = ['sdl', 'pygame', 'pygame_bootstrap_components'] 14 | 15 | patches = ['add_nativeSetEnv.patch'] 16 | 17 | def get_recipe_env(self, arch=None): 18 | env = super(LibSDL2Recipe, self).get_recipe_env(arch) 19 | py2 = self.get_recipe('python2', arch.ctx) 20 | env['PYTHON2_NAME'] = py2.get_dir_name() 21 | if 'python2' in self.ctx.recipe_build_order: 22 | env['EXTRA_LDLIBS'] = ' -lpython2.7' 23 | return env 24 | 25 | def build_arch(self, arch): 26 | env = self.get_recipe_env(arch) 27 | 28 | with current_directory(self.get_jni_dir()): 29 | shprint(sh.ndk_build, "V=1", _env=env) 30 | 31 | 32 | recipe = LibSDL2Recipe() 33 | 34 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/sdl2/add_nativeSetEnv.patch: -------------------------------------------------------------------------------- 1 | diff --git a/src/core/android/SDL_android.c b/src/core/android/SDL_android.c 2 | index d806208..0ff801b 100644 3 | --- a/src/core/android/SDL_android.c 4 | +++ b/src/core/android/SDL_android.c 5 | @@ -180,6 +180,19 @@ void Java_org_libsdl_app_SDLActivity_onNativeHat( 6 | Android_OnHat(device_id, hat_id, x, y); 7 | } 8 | 9 | +/* Patched in env var setter for python-for-android */ 10 | +void Java_org_libsdl_app_SDLActivity_nativeSetEnv( 11 | + JNIEnv* env, jclass jcls, 12 | + jstring j_name, jstring j_value) 13 | +{ 14 | + jboolean iscopy; 15 | + const char *name = (*env)->GetStringUTFChars(env, j_name, &iscopy); 16 | + const char *value = (*env)->GetStringUTFChars(env, j_value, &iscopy); 17 | + setenv(name, value, 1); 18 | + (*env)->ReleaseStringUTFChars(env, j_name, name); 19 | + (*env)->ReleaseStringUTFChars(env, j_value, value); 20 | +} 21 | + 22 | 23 | int Java_org_libsdl_app_SDLActivity_nativeAddJoystick( 24 | JNIEnv* env, jclass jcls, 25 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/sdl2_image/__init__.py: -------------------------------------------------------------------------------- 1 | from pythonforandroid.toolchain import BootstrapNDKRecipe 2 | from pythonforandroid.patching import is_arch 3 | 4 | 5 | class LibSDL2Image(BootstrapNDKRecipe): 6 | version = '2.0.0' 7 | url = 'https://www.libsdl.org/projects/SDL_image/release/SDL2_image-{version}.tar.gz' 8 | dir_name = 'SDL2_image' 9 | 10 | patches = ['disable_webp.patch', 11 | ('disable_jpg.patch', is_arch('x86')), 12 | 'extra-cflags.patch', 13 | ('disable-assembler.patch', is_arch('arm64-v8a'))] 14 | 15 | 16 | recipe = LibSDL2Image() 17 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/sdl2_image/disable-assembler.patch: -------------------------------------------------------------------------------- 1 | --- SDL2_image/Android.mk 2016-01-14 14:08:07.989191133 -0600 2 | +++ b/Android.mk 2016-01-14 14:09:53.439136814 -0600 3 | @@ -77,7 +77,7 @@ 4 | $(JPG_LIBRARY_PATH)/jfdctfst.c \ 5 | $(JPG_LIBRARY_PATH)/jfdctint.c \ 6 | $(JPG_LIBRARY_PATH)/jidctflt.c \ 7 | - $(JPG_LIBRARY_PATH)/jidctfst.S \ 8 | + $(JPG_LIBRARY_PATH)/jidctfst.c \ 9 | $(JPG_LIBRARY_PATH)/jidctint.c \ 10 | $(JPG_LIBRARY_PATH)/jquant1.c \ 11 | $(JPG_LIBRARY_PATH)/jquant2.c \ 12 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/sdl2_image/disable_jpg.patch: -------------------------------------------------------------------------------- 1 | diff --git a/Android.mk b/Android.mk 2 | index 31e2118..8cd2cb9 100644 3 | --- a/Android.mk 4 | +++ b/Android.mk 5 | @@ -6,7 +6,7 @@ LOCAL_MODULE := SDL2_image 6 | 7 | # Enable this if you want to support loading JPEG images 8 | # The library path should be a relative path to this directory. 9 | -SUPPORT_JPG := true 10 | +SUPPORT_JPG := false 11 | JPG_LIBRARY_PATH := external/jpeg-9 12 | 13 | # Enable this if you want to support loading PNG images 14 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/sdl2_image/disable_webp.patch: -------------------------------------------------------------------------------- 1 | diff --git a/Android.mk b/Android.mk 2 | index c2080dd..31e2118 100644 3 | --- a/Android.mk 4 | +++ b/Android.mk 5 | @@ -16,7 +16,7 @@ PNG_LIBRARY_PATH := external/libpng-1.6.2 6 | 7 | # Enable this if you want to support loading WebP images 8 | # The library path should be a relative path to this directory. 9 | -SUPPORT_WEBP := true 10 | +SUPPORT_WEBP := false 11 | WEBP_LIBRARY_PATH := external/libwebp-0.3.0 12 | 13 | 14 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/sdl2_image/extra-cflags.patch: -------------------------------------------------------------------------------- 1 | --- SDL2_image/Android.mk 2016-01-14 13:55:28.195171992 -0600 2 | +++ b/Android.mk 2016-01-14 13:55:15.038929244 -0600 3 | @@ -23,7 +23,7 @@ 4 | LOCAL_C_INCLUDES := $(LOCAL_PATH) 5 | LOCAL_CFLAGS := -DLOAD_BMP -DLOAD_GIF -DLOAD_LBM -DLOAD_PCX -DLOAD_PNM \ 6 | -DLOAD_TGA -DLOAD_XCF -DLOAD_XPM -DLOAD_XV 7 | -LOCAL_CFLAGS += -O3 -fstrict-aliasing -fprefetch-loop-arrays 8 | +LOCAL_CFLAGS += -O3 -fstrict-aliasing -fprefetch-loop-arrays $(EXTRA_CFLAGS) 9 | 10 | LOCAL_SRC_FILES := $(notdir $(filter-out %/showimage.c, $(wildcard $(LOCAL_PATH)/*.c))) 11 | 12 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/sdl2_mixer/__init__.py: -------------------------------------------------------------------------------- 1 | from pythonforandroid.toolchain import BootstrapNDKRecipe 2 | 3 | 4 | class LibSDL2Mixer(BootstrapNDKRecipe): 5 | version = '2.0.0' 6 | url = 'https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-{version}.tar.gz' 7 | dir_name = 'SDL2_mixer' 8 | 9 | patches = ['disable_modplug_mikmod_smpeg.patch'] 10 | 11 | 12 | recipe = LibSDL2Mixer() 13 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/sdl2_mixer/disable_modplug_mikmod_smpeg.patch: -------------------------------------------------------------------------------- 1 | diff --git a/Android.mk b/Android.mk 2 | index 81c94b5..357500c 100644 3 | --- a/Android.mk 4 | +++ b/Android.mk 5 | @@ -6,17 +6,17 @@ LOCAL_MODULE := SDL2_mixer 6 | 7 | # Enable this if you want to support loading MOD music via modplug 8 | # The library path should be a relative path to this directory. 9 | -SUPPORT_MOD_MODPLUG := true 10 | +SUPPORT_MOD_MODPLUG := false 11 | MODPLUG_LIBRARY_PATH := external/libmodplug-0.8.8.4 12 | 13 | # Enable this if you want to support loading MOD music via mikmod 14 | # The library path should be a relative path to this directory. 15 | -SUPPORT_MOD_MIKMOD := true 16 | +SUPPORT_MOD_MIKMOD := false 17 | MIKMOD_LIBRARY_PATH := external/libmikmod-3.1.12 18 | 19 | # Enable this if you want to support loading MP3 music via SMPEG 20 | # The library path should be a relative path to this directory. 21 | -SUPPORT_MP3_SMPEG := true 22 | +SUPPORT_MP3_SMPEG := false 23 | SMPEG_LIBRARY_PATH := external/smpeg2-2.0.0 24 | 25 | # Enable this if you want to support loading OGG Vorbis music via Tremor 26 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/sdl2_ttf/__init__.py: -------------------------------------------------------------------------------- 1 | from pythonforandroid.toolchain import BootstrapNDKRecipe 2 | from os.path import exists 3 | 4 | class LibSDL2TTF(BootstrapNDKRecipe): 5 | version = '2.0.12' 6 | url = 'https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-{version}.tar.gz' 7 | dir_name = 'SDL2_ttf' 8 | 9 | recipe = LibSDL2TTF() 10 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/sdl2python3/__init__.py: -------------------------------------------------------------------------------- 1 | from pythonforandroid.toolchain import BootstrapNDKRecipe, shprint, current_directory 2 | import sh 3 | 4 | 5 | class LibSDL2Recipe(BootstrapNDKRecipe): 6 | version = "2.0.3" 7 | url = "https://www.libsdl.org/release/SDL2-{version}.tar.gz" 8 | depends = [('python3', 'crystaxpython3'), 'sdl2_image', 'sdl2_mixer', 'sdl2_ttf'] 9 | # depends = ['python2'] 10 | dir_name = 'SDL' 11 | 12 | patches = ['add_nativeSetEnv.patch'] 13 | 14 | def build_arch(self, arch): 15 | env = self.get_recipe_env(arch) 16 | 17 | with current_directory(self.get_jni_dir()): 18 | shprint(sh.ndk_build, "V=1", _env=env) 19 | 20 | 21 | recipe = LibSDL2Recipe() 22 | 23 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/sdl2python3/add_nativeSetEnv.patch: -------------------------------------------------------------------------------- 1 | diff --git a/src/core/android/SDL_android.c b/src/core/android/SDL_android.c 2 | index d806208..0ff801b 100644 3 | --- a/src/core/android/SDL_android.c 4 | +++ b/src/core/android/SDL_android.c 5 | @@ -180,6 +180,19 @@ void Java_org_libsdl_app_SDLActivity_onNativeHat( 6 | Android_OnHat(device_id, hat_id, x, y); 7 | } 8 | 9 | +/* Patched in env var setter for python-for-android */ 10 | +void Java_org_libsdl_app_SDLActivity_nativeSetEnv( 11 | + JNIEnv* env, jclass jcls, 12 | + jstring j_name, jstring j_value) 13 | +{ 14 | + jboolean iscopy; 15 | + const char *name = (*env)->GetStringUTFChars(env, j_name, &iscopy); 16 | + const char *value = (*env)->GetStringUTFChars(env, j_value, &iscopy); 17 | + setenv(name, value, 1); 18 | + (*env)->ReleaseStringUTFChars(env, j_name, name); 19 | + (*env)->ReleaseStringUTFChars(env, j_value, value); 20 | +} 21 | + 22 | 23 | int Java_org_libsdl_app_SDLActivity_nativeAddJoystick( 24 | JNIEnv* env, jclass jcls, 25 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/sdl2python3crystax/__init__.py: -------------------------------------------------------------------------------- 1 | from pythonforandroid.toolchain import BootstrapNDKRecipe, shprint, current_directory, info 2 | from os.path import exists, join 3 | import sh 4 | 5 | 6 | class LibSDL2Recipe(BootstrapNDKRecipe): 7 | version = "2.0.3" 8 | url = "https://www.libsdl.org/release/SDL2-{version}.tar.gz" 9 | 10 | dir_name = 'SDL' 11 | 12 | depends = ['python3crystax', 'sdl2_image', 'sdl2_mixer', 'sdl2_ttf'] 13 | conflicts = ['sdl', 'sdl2', 'pygame', 'pygame_bootstrap_components'] 14 | 15 | patches = ['add_nativeSetEnv.patch'] 16 | 17 | def get_recipe_env(self, arch=None): 18 | env = super(LibSDL2Recipe, self).get_recipe_env(arch) 19 | py2 = self.get_recipe('python2', arch.ctx) 20 | env['PYTHON2_NAME'] = py2.get_dir_name() 21 | return env 22 | 23 | def build_arch(self, arch): 24 | env = self.get_recipe_env(arch) 25 | 26 | with current_directory(self.get_jni_dir()): 27 | shprint(sh.ndk_build, "V=1", _env=env) 28 | 29 | 30 | recipe = LibSDL2Recipe() 31 | 32 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/sdl2python3crystax/add_nativeSetEnv.patch: -------------------------------------------------------------------------------- 1 | diff --git a/src/core/android/SDL_android.c b/src/core/android/SDL_android.c 2 | index d806208..0ff801b 100644 3 | --- a/src/core/android/SDL_android.c 4 | +++ b/src/core/android/SDL_android.c 5 | @@ -180,6 +180,19 @@ void Java_org_libsdl_app_SDLActivity_onNativeHat( 6 | Android_OnHat(device_id, hat_id, x, y); 7 | } 8 | 9 | +/* Patched in env var setter for python-for-android */ 10 | +void Java_org_libsdl_app_SDLActivity_nativeSetEnv( 11 | + JNIEnv* env, jclass jcls, 12 | + jstring j_name, jstring j_value) 13 | +{ 14 | + jboolean iscopy; 15 | + const char *name = (*env)->GetStringUTFChars(env, j_name, &iscopy); 16 | + const char *value = (*env)->GetStringUTFChars(env, j_value, &iscopy); 17 | + setenv(name, value, 1); 18 | + (*env)->ReleaseStringUTFChars(env, j_name, name); 19 | + (*env)->ReleaseStringUTFChars(env, j_value, value); 20 | +} 21 | + 22 | 23 | int Java_org_libsdl_app_SDLActivity_nativeAddJoystick( 24 | JNIEnv* env, jclass jcls, 25 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/setuptools/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | from pythonforandroid.toolchain import ( 3 | PythonRecipe, 4 | Recipe, 5 | current_directory, 6 | info, 7 | shprint, 8 | ) 9 | from os.path import join 10 | import sh 11 | 12 | 13 | class SetuptoolsRecipe(PythonRecipe): 14 | version = '18.3.1' 15 | url = 'https://pypi.python.org/packages/source/s/setuptools/setuptools-{version}.tar.gz' 16 | 17 | depends = ['python2'] 18 | 19 | call_hostpython_via_targetpython = False 20 | install_in_hostpython = True 21 | 22 | 23 | recipe = SetuptoolsRecipe() 24 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/six/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | from pythonforandroid.toolchain import PythonRecipe 3 | 4 | 5 | class SixRecipe(PythonRecipe): 6 | version = '1.9.0' 7 | url = 'https://pypi.python.org/packages/source/s/six/six-{version}.tar.gz' 8 | depends = [('python2', 'python3crystax')] 9 | 10 | recipe = SixRecipe() 11 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/snappy/__init__.py: -------------------------------------------------------------------------------- 1 | from pythonforandroid.toolchain import Recipe 2 | 3 | class SnappyRecipe(Recipe): 4 | version = '1.1.3' 5 | url = 'https://github.com/google/snappy/releases/download/{version}/snappy-{version}.tar.gz' 6 | 7 | def should_build(self, arch): 8 | # Only download to use in leveldb recipe 9 | return False 10 | 11 | recipe = SnappyRecipe() 12 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/sqlalchemy/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | from pythonforandroid.toolchain import CompiledComponentsPythonRecipe 3 | 4 | 5 | class SQLAlchemyRecipe(CompiledComponentsPythonRecipe): 6 | name = 'sqlalchemy' 7 | version = '1.0.9' 8 | url = 'https://pypi.python.org/packages/source/S/SQLAlchemy/SQLAlchemy-{version}.tar.gz' 9 | 10 | depends = [('python2', 'python3'), 'setuptools'] 11 | 12 | patches = ['zipsafe.patch'] 13 | 14 | 15 | recipe = SQLAlchemyRecipe() 16 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/sqlalchemy/zipsafe.patch: -------------------------------------------------------------------------------- 1 | diff --git a/setup.py b/setup.py 2 | index 09b524c..1e65772 100644 3 | --- a/setup.py 4 | +++ b/setup.py 5 | @@ -125,6 +125,7 @@ def run_setup(with_cext): 6 | setup(name="SQLAlchemy", 7 | version=VERSION, 8 | description="Database Abstraction Library", 9 | + zip_safe=False, 10 | author="Mike Bayer", 11 | author_email="mike_mp@zzzcomputing.com", 12 | url="http://www.sqlalchemy.org", 13 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/twisted/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | import glob 3 | from pythonforandroid.toolchain import ( 4 | CythonRecipe, 5 | Recipe, 6 | current_directory, 7 | info, 8 | shprint, 9 | ) 10 | from os.path import join 11 | import sh 12 | 13 | 14 | class TwistedRecipe(CythonRecipe): 15 | version = '15.4.0' 16 | url = 'https://pypi.python.org/packages/source/T/Twisted/Twisted-{version}.tar.bz2' 17 | 18 | depends = ['setuptools', 'zope_interface'] 19 | 20 | call_hostpython_via_targetpython = False 21 | install_in_hostpython = True 22 | 23 | def prebuild_arch(self, arch): 24 | super(TwistedRecipe, self).prebuild_arch(arch) 25 | # TODO Need to whitelist tty.pyo and termios.so here 26 | print('Should remove twisted tests etc. here, but skipping for now') 27 | 28 | def get_recipe_env(self, arch): 29 | env = super(TwistedRecipe, self).get_recipe_env(arch) 30 | # We add BUILDLIB_PATH to PYTHONPATH so twisted can find _io.so 31 | env['PYTHONPATH'] = ':'.join([ 32 | self.ctx.get_site_packages_dir(), 33 | env['BUILDLIB_PATH'], 34 | ]) 35 | return env 36 | 37 | recipe = TwistedRecipe() 38 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/vispy/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | from pythonforandroid.toolchain import PythonRecipe 3 | 4 | 5 | class VispyRecipe(PythonRecipe): 6 | # version = 'v0.4.0' 7 | version = 'master' 8 | url = 'https://github.com/vispy/vispy/archive/{version}.tar.gz' 9 | # version = 'campagnola-scenegraph-update' 10 | # url = 'https://github.com/campagnola/vispy/archive/scenegraph-update.zip' 11 | # version = '???' 12 | # url = 'https://github.com/inclement/vispy/archive/Eric89GXL-arcball.zip' 13 | 14 | depends = ['python2', 'numpy', 'pysdl2'] 15 | 16 | patches = ['disable_freetype.patch', 17 | 'disable_font_triage.patch', 18 | 'use_es2.patch', 19 | 'remove_ati_check.patch'] 20 | 21 | 22 | recipe = VispyRecipe() 23 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/vispy/disable_font_triage.patch: -------------------------------------------------------------------------------- 1 | diff --git a/vispy/util/fonts/_triage.py b/vispy/util/fonts/_triage.py 2 | index ddbc93d..324c161 100644 3 | --- a/vispy/util/fonts/_triage.py 4 | +++ b/vispy/util/fonts/_triage.py 5 | @@ -9,14 +9,14 @@ import sys 6 | from ._vispy_fonts import _vispy_fonts 7 | if sys.platform.startswith('linux'): 8 | from ._freetype import _load_glyph 9 | - from ...ext.fontconfig import _list_fonts 10 | -elif sys.platform == 'darwin': 11 | - from ._quartz import _load_glyph, _list_fonts 12 | -elif sys.platform.startswith('win'): 13 | - from ._freetype import _load_glyph # noqa, analysis:ignore 14 | - from ._win32 import _list_fonts # noqa, analysis:ignore 15 | -else: 16 | - raise NotImplementedError('unknown system %s' % sys.platform) 17 | + # from ...ext.fontconfig import _list_fonts 18 | +# elif sys.platform == 'darwin': 19 | +# from ._quartz import _load_glyph, _list_fonts 20 | +# elif sys.platform.startswith('win'): 21 | +# from ._freetype import _load_glyph # noqa, analysis:ignore 22 | +# from ._win32 import _list_fonts # noqa, analysis:ignore 23 | +# else: 24 | +# raise NotImplementedError('unknown system %s' % sys.platform) 25 | 26 | _fonts = {} 27 | 28 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/vispy/disable_freetype.patch: -------------------------------------------------------------------------------- 1 | diff --git a/vispy/util/fonts/_freetype.py b/vispy/util/fonts/_freetype.py 2 | index 3b33d0b..229d559 100644 3 | --- a/vispy/util/fonts/_freetype.py 4 | +++ b/vispy/util/fonts/_freetype.py 5 | @@ -12,12 +12,12 @@ import numpy as np 6 | 7 | # Convert face to filename 8 | from ._vispy_fonts import _vispy_fonts, _get_vispy_font_filename 9 | -if sys.platform.startswith('linux'): 10 | - from ...ext.fontconfig import find_font 11 | -elif sys.platform.startswith('win'): 12 | - from ._win32 import find_font # noqa, analysis:ignore 13 | -else: 14 | - raise NotImplementedError 15 | +# if sys.platform.startswith('linux'): 16 | +# from ...ext.fontconfig import find_font 17 | +# elif sys.platform.startswith('win'): 18 | +# from ._win32 import find_font # noqa, analysis:ignore 19 | +# else: 20 | +# raise NotImplementedError 21 | 22 | _font_dict = {} 23 | 24 | @@ -41,6 +41,7 @@ def _load_font(face, bold, italic): 25 | 26 | def _load_glyph(f, char, glyphs_dict): 27 | """Load glyph from font into dict""" 28 | + return 29 | from ...ext.freetype import (FT_LOAD_RENDER, FT_LOAD_NO_HINTING, 30 | FT_LOAD_NO_AUTOHINT) 31 | flags = FT_LOAD_RENDER | FT_LOAD_NO_HINTING | FT_LOAD_NO_AUTOHINT 32 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/vispy/disable_freetype.patch_backup: -------------------------------------------------------------------------------- 1 | diff --git a/vispy/util/fonts/_freetype.py b/vispy/util/fonts/_freetype.py 2 | index 3b33d0b..229d559 100644 3 | --- a/vispy/util/fonts/_freetype.py 4 | +++ b/vispy/util/fonts/_freetype.py 5 | @@ -12,12 +12,12 @@ import numpy as np 6 | 7 | # Convert face to filename 8 | from ._vispy_fonts import _vispy_fonts, _get_vispy_font_filename 9 | -if sys.platform.startswith('linux'): 10 | - from ...ext.fontconfig import find_font 11 | -elif sys.platform.startswith('win'): 12 | - from ._win32 import find_font # noqa, analysis:ignore 13 | -else: 14 | - raise NotImplementedError 15 | +# if sys.platform.startswith('linux'): 16 | +# from ...ext.fontconfig import find_font 17 | +# elif sys.platform.startswith('win'): 18 | +# from ._win32 import find_font # noqa, analysis:ignore 19 | +# else: 20 | +# raise NotImplementedError 21 | 22 | _font_dict = {} 23 | 24 | @@ -41,6 +41,7 @@ def _load_font(face, bold, italic): 25 | 26 | def _load_glyph(f, char, glyphs_dict): 27 | """Load glyph from font into dict""" 28 | + return 29 | from ...ext.freetype import (FT_LOAD_RENDER, FT_LOAD_NO_HINTING, 30 | FT_LOAD_NO_AUTOHINT) 31 | flags = FT_LOAD_RENDER | FT_LOAD_NO_HINTING | FT_LOAD_NO_AUTOHINT 32 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/vispy/remove_ati_check.patch: -------------------------------------------------------------------------------- 1 | diff --git a/vispy/gloo/glir.py b/vispy/gloo/glir.py 2 | index 67419b5..341c13d 100644 3 | --- a/vispy/gloo/glir.py 4 | +++ b/vispy/gloo/glir.py 5 | @@ -878,19 +878,19 @@ class GlirBuffer(GlirObject): 6 | self.activate() 7 | nbytes = data.nbytes 8 | 9 | - # Determine whether to check errors to try handling the ATI bug 10 | - check_ati_bug = ((not self._bufferSubDataOk) and 11 | - (gl.current_backend is gl.gl2) and 12 | - sys.platform.startswith('win')) 13 | - 14 | - # flush any pending errors 15 | - if check_ati_bug: 16 | - gl.check_error('periodic check') 17 | + # # Determine whether to check errors to try handling the ATI bug 18 | + # check_ati_bug = ((not self._bufferSubDataOk) and 19 | + # (gl.current_backend is gl.gl2) and 20 | + # sys.platform.startswith('win')) 21 | + 22 | + # # flush any pending errors 23 | + # if check_ati_bug: 24 | + # gl.check_error('periodic check') 25 | 26 | try: 27 | gl.glBufferSubData(self._target, offset, data) 28 | - if check_ati_bug: 29 | - gl.check_error('glBufferSubData') 30 | + # if check_ati_bug: 31 | + # gl.check_error('glBufferSubData') 32 | self._bufferSubDataOk = True # glBufferSubData seems to work 33 | except Exception: 34 | # This might be due to a driver error (seen on ATI), issue #64. 35 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/vispy/use_es2.patch: -------------------------------------------------------------------------------- 1 | diff --git a/vispy/gloo/gl/__init__.py b/vispy/gloo/gl/__init__.py 2 | index 93813fa..c41859c 100644 3 | --- a/vispy/gloo/gl/__init__.py 4 | +++ b/vispy/gloo/gl/__init__.py 5 | @@ -210,7 +210,7 @@ def check_error(when='periodic check'): 6 | 7 | 8 | # Load default gl backend 9 | -from . import gl2 as default_backend # noqa 10 | +from . import es2 as default_backend # noqa 11 | 12 | # Call use to start using our default backend 13 | -use_gl() 14 | +use_gl('es2') 15 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/zeroconf/__init__.py: -------------------------------------------------------------------------------- 1 | from pythonforandroid.recipe import PythonRecipe 2 | from os.path import join 3 | 4 | 5 | class ZeroconfRecipe(PythonRecipe): 6 | name = 'zeroconf' 7 | version = '0.17.4' 8 | url = 'https://pypi.python.org/packages/source/z/zeroconf/zeroconf-{version}.tar.gz' 9 | depends = ['python2', 'netifaces', 'enum34', 'six'] 10 | 11 | def get_recipe_env(self, arch=None): 12 | env = super(ZeroconfRecipe, self).get_recipe_env(arch) 13 | 14 | # TODO: fix hardcoded path 15 | # This is required to prevent issue with _io.so import. 16 | hostpython = self.get_recipe('hostpython2', self.ctx) 17 | env['PYTHONPATH'] = ( 18 | join(hostpython.get_build_dir(arch.arch), 'build', 19 | 'lib.linux-x86_64-2.7') + ':' + env.get('PYTHONPATH', '') 20 | ) 21 | return env 22 | 23 | 24 | recipe = ZeroconfRecipe() 25 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/zope/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | from pythonforandroid.toolchain import PythonRecipe, shprint, current_directory 3 | from os.path import exists, join 4 | import sh 5 | import glob 6 | 7 | class ZopeRecipe(PythonRecipe): 8 | name = 'zope' 9 | version = '4.1.2' 10 | url = 'http://pypi.python.org/packages/source/z/zope.interface/zope.interface-{version}.tar.gz' 11 | 12 | depends = ['python2'] 13 | 14 | def get_recipe_env(self, arch): 15 | env = super(ZopeRecipe, self).get_recipe_env(arch) 16 | 17 | # These are in the old zope recipe but seem like they shouldn't actually be necessary 18 | env['LDFLAGS'] = env['LDFLAGS'] + ' -L{}'.format( 19 | self.ctx.get_libs_dir(arch.arch)) 20 | env['LDSHARED'] = join(self.ctx.root_dir, 'tools', 'liblink') 21 | 22 | def postbuild_arch(self, arch): 23 | super(ZopeRecipe, self).postbuild_arch(arch) 24 | 25 | # Should do some deleting here 26 | 27 | recipe = ZopeRecipe() 28 | -------------------------------------------------------------------------------- /pythonforandroid/recipes/zope_interface/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | from pythonforandroid.toolchain import PythonRecipe, shprint, current_directory 3 | from os.path import join 4 | import sh 5 | 6 | 7 | class ZopeInterfaceRecipe(PythonRecipe): 8 | name = 'zope_interface' 9 | version = '4.1.2' 10 | url = 'https://pypi.python.org/packages/source/z/zope.interface/zope.interface-{version}.tar.gz' 11 | site_packages_name = 'zope.interface' 12 | 13 | depends = ['python2'] 14 | 15 | def build_arch(self, arch): 16 | super(ZopeInterfaceRecipe, self).build_arch(arch) 17 | print('Should remove zope tests etc. here, but skipping for now') 18 | 19 | recipe = ZopeInterfaceRecipe() 20 | -------------------------------------------------------------------------------- /pythonforandroid/tools/biglink: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from __future__ import print_function 4 | import os 5 | import sys 6 | import subprocess 7 | 8 | sofiles = [ ] 9 | 10 | for directory in sys.argv[2:]: 11 | 12 | for fn in os.listdir(directory): 13 | fn = os.path.join(directory, fn) 14 | 15 | if not fn.endswith(".so.o"): 16 | continue 17 | if not os.path.exists(fn[:-2] + ".libs"): 18 | continue 19 | 20 | sofiles.append(fn[:-2]) 21 | 22 | # The raw argument list. 23 | args = [ ] 24 | 25 | for fn in sofiles: 26 | afn = fn + ".o" 27 | libsfn = fn + ".libs" 28 | 29 | args.append(afn) 30 | with open(libsfn) as fd: 31 | data = fd.read() 32 | args.extend(data.split(" ")) 33 | 34 | unique_args = [ ] 35 | while args: 36 | a = args.pop() 37 | if a in ('-L', ): 38 | continue 39 | if a not in unique_args: 40 | unique_args.insert(0, a) 41 | unique_args = [x for x in unique_args if x] 42 | 43 | print('Biglink create %s library' % sys.argv[1]) 44 | print('Biglink arguments:') 45 | for arg in unique_args: 46 | print(' %s' % arg) 47 | 48 | args = os.environ['CC'].split() + \ 49 | ['-shared', '-O3', '-o', sys.argv[1]] + \ 50 | unique_args 51 | 52 | sys.exit(subprocess.call(args)) 53 | -------------------------------------------------------------------------------- /pythonforandroid/tools/liblink.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | PYTHONPATH= python `dirname $0`/liblink "$@" 4 | -------------------------------------------------------------------------------- /testapps/testapp/colours.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geohot/python-for-android/19500c8c32dd6954a32af9c6eb6bc81cae363e10/testapps/testapp/colours.png -------------------------------------------------------------------------------- /testapps/testapp_nogui/main.py: -------------------------------------------------------------------------------- 1 | 2 | from math import sqrt 3 | print('import math worked') 4 | 5 | import sys 6 | 7 | print('sys.path is', sys.path) 8 | 9 | for i in range(45, 50): 10 | print(i, sqrt(i)) 11 | 12 | print('trying to import six') 13 | try: 14 | import six 15 | except ImportError: 16 | print('import failed') 17 | 18 | 19 | print('trying to import six again') 20 | try: 21 | import six 22 | except ImportError: 23 | print('import failed (again?)') 24 | print('import six worked!') 25 | 26 | print('Just printing stuff apparently worked, trying pyjnius') 27 | 28 | import jnius 29 | 30 | print('Importing jnius worked') 31 | 32 | print('trying to import stuff') 33 | 34 | try: 35 | from jnius import cast 36 | except ImportError: 37 | print('cast failed') 38 | 39 | try: 40 | from jnius import ensureclass 41 | except ImportError: 42 | print('ensureclass failed') 43 | 44 | try: 45 | from jnius import JavaClass 46 | except ImportError: 47 | print('JavaClass failed') 48 | 49 | try: 50 | from jnius import jnius 51 | except ImportError: 52 | print('jnius failed') 53 | 54 | try: 55 | from jnius import reflect 56 | except ImportError: 57 | print('reflect failed') 58 | 59 | try: 60 | from jnius import find_javaclass 61 | except ImportError: 62 | print('find_javaclass failed') 63 | 64 | print('Trying to autoclass activity') 65 | 66 | from jnius import autoclass 67 | 68 | print('Imported autoclass') 69 | 70 | PythonActivity = autoclass('org.kivy.android.PythonActivity') 71 | 72 | print(':o the autoclass worked!') 73 | 74 | -------------------------------------------------------------------------------- /tests/test_graph.py: -------------------------------------------------------------------------------- 1 | 2 | from pythonforandroid.build import Context 3 | from pythonforandroid.graph import get_recipe_order_and_bootstrap 4 | from pythonforandroid.bootstrap import Bootstrap 5 | from itertools import product 6 | 7 | import pytest 8 | 9 | 10 | ctx = Context() 11 | 12 | name_sets = [['python2'], 13 | ['kivy']] 14 | bootstraps = [None, 15 | Bootstrap.get_bootstrap('pygame', ctx), 16 | Bootstrap.get_bootstrap('sdl2', ctx)] 17 | valid_combinations = list(product(name_sets, bootstraps)) 18 | valid_combinations.extend( 19 | [(['python3crystax'], Bootstrap.get_bootstrap('sdl2', ctx)), 20 | (['kivy', 'python3crystax'], Bootstrap.get_bootstrap('sdl2', ctx))]) 21 | 22 | @pytest.mark.parametrize('names,bootstrap', valid_combinations) 23 | def test_valid_recipe_order_and_bootstrap(names, bootstrap): 24 | get_recipe_order_and_bootstrap(ctx, names, bootstrap) 25 | 26 | invalid_combinations = [[['python2', 'python3crystax'], None], 27 | [['python3'], Bootstrap.get_bootstrap('pygame', ctx)]] 28 | 29 | @pytest.mark.parametrize('names,bootstrap', invalid_combinations) 30 | def test_invalid_recipe_order_and_bootstrap(names, bootstrap): 31 | with pytest.raises(SystemExit): 32 | get_recipe_order_and_bootstrap(ctx, names, bootstrap) 33 | 34 | def test_bootstrap_dependency_addition(): 35 | build_order, python_modules, bs = get_recipe_order_and_bootstrap( 36 | ctx, ['kivy'], None) 37 | assert (('hostpython2' in build_order) or ('hostpython3' in build_order)) 38 | 39 | if __name__ == "__main__": 40 | get_recipe_order_and_bootstrap(ctx, ['python3'], Bootstrap.get_bootstrap('sdl2', ctx)) 41 | --------------------------------------------------------------------------------