This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from django.conf.urls import include | |
def decorated_include(urls, decorator) | |
"""Used to decorate all urls in a 3rd party app with a specific decorator""" | |
urls_to_decorate = include(urls) | |
for url_pattern in urls_to_decorate | |
url_pattern._callback = decorator(url_pattern._callback) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_original_import = __import__ | |
def store_loader(name, module, storage): | |
try: | |
spec = module.__spec__ | |
loader = spec.loader if type(spec.loader) == type else spec.loader.__class__ | |
except Exception as err: | |
loader = type(err) | |
module = err |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# /var/runtime/awslambda/bootstrap.py | |
""" | |
aws_lambda.bootstrap.py | |
Amazon Lambda | |
Copyright (c) 2013 Amazon. All rights reserved. | |
Lambda runtime implemention | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#coding: utf-8 | |
from pythonforandroid.toolchain import CompiledComponentsPythonRecipe, PythonRecipe | |
class PyCryptodomeRecipe(PythonRecipe): | |
version = '3.1' | |
url = 'https://pypi.python.org/packages/source/p/pycryptodome/pycryptodome-{version}.zip' | |
site_packages_name= 'pycrypto' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
09-26 00:18:56.167: I/python(10572): PATH: ['/data/app/org.test.minimalcalc-1.apk/assets', '/data/app/org.test.minimalcalc-1.apk/assets/lib/python2.7/', '/data/app/org.test.minimalcalc-1.apk/assets/lib/python2.7/site-packages/'] | |
09-26 00:18:56.168: I/python(10572): PWD: / | |
09-26 00:18:56.168: I/python(10572): PWD: / | |
09-26 00:18:56.170: I/python(10572): Traceback (most recent call last): | |
09-26 00:18:56.170: I/python(10572): File "/data/data/org.test.minimalcalc/files/_bootstrap.py", line 127, in <module> | |
09-26 00:18:56.170: I/python(10572): runpy._run_module_as_main(main_module, False) | |
09-26 00:18:56.170: I/python(10572): File "/Users/alanjds/src/git/python-for-android/dist/default/private/lib/python2.7/runpy.py", line 162, in _run_module_as_main | |
09-26 00:18:56.171: I/python(10572): File "/Users/alanjds/src/git/python-for-android/dist/default/private/lib/python2.7/runpy.py", line 72, in _run_code | |
09-26 00:18:56.171: I/python(10572): File "/Users/alanjds/src/git/p4a-minimal-shell/main.py", line 44, i |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
P4A_pyjnius_DIR=~/code/pyjnius ./distribute.sh -b minimal -m 'pyjnius python' -u pyjnius | |
cd .; ./build.py --package org.minimal.test --name _MINIMAL --version 1 --private ~/code/testmininal --asset debug installd | |
adb logcat *:S python:D | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
P4A_pyjnius_DIR=~/code/pyjnius ./distribute.sh -b minimal -m 'pyjnius python' -u pyjnius | |
cd .; ./build.py --package org.minimal.test --name _MINIMAL --version 1 --private ~/code/testmininal --asset debug installd | |
adb logcat *:S python:D | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
P4A_pyjnius_DIR=~/code/pyjnius ./distribute.sh -b minimal -m 'pyjnius python' -u pyjnius | |
cd .; ./build.py --package org.minimal.test --name _MINIMAL --version 1 --private ~/code/testmininal --asset debug installd | |
adb logcat *:S python:D | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/bootstrap/minimal/jni/main.c b/bootstrap/minimal/jni/main.c | |
index ca1a7de..252059e 100644 | |
--- a/bootstrap/minimal/jni/main.c | |
+++ b/bootstrap/minimal/jni/main.c | |
@@ -1,5 +1,7 @@ | |
#include <jni.h> | |
#include <errno.h> | |
+#include <sys/stat.h> | |
+#include <sys/types.h> | |
#include <android/log.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Adapted from: https://bitbucket.org/pypy/pypy/src/f2bf94943a41/lib_pypy/binascii.py | |
"""A pure Python implementation of binascii. | |
Rather slow and buggy in corner cases. | |
PyPy provides an RPython version too. | |
""" | |
try: | |
from _binascii import * |
NewerOlder