mirror of https://github.com/kivy/pyjnius.git
Merge branch 'master' into extend_class_support
Conflicts: jnius/jnius_export_class.pxi
This commit is contained in:
commit
82b703c0c1
|
@ -53,10 +53,9 @@ class MetaJavaClass(type):
|
|||
|
||||
jcs.j_env = get_jnienv()
|
||||
if jcs.j_env == NULL:
|
||||
raise JavaException('Unable to get the Android JNI Environment')
|
||||
raise JavaException('Unable to get the JNI Environment')
|
||||
|
||||
if __javainterfaces__ and __javabaseclass__:
|
||||
Proxy = jcs.j_env[0].FindClass(jcs.j_env, <char*>'java.lang.reflect.Proxy')
|
||||
baseclass = jcs.j_env[0].FindClass(jcs.j_env, <char*>__javabaseclass__)
|
||||
interfaces = <jclass *>malloc(sizeof(jclass) * len(__javainterfaces__))
|
||||
|
||||
|
|
|
@ -16,15 +16,39 @@ cdef extern from "jni.h":
|
|||
|
||||
cdef JNIEnv *default_env = NULL
|
||||
|
||||
def classpath():
|
||||
import platform
|
||||
from glob import glob
|
||||
from os import environ
|
||||
from os.path import realpath
|
||||
|
||||
if 'CLASSPATH' not in environ:
|
||||
return realpath('.')
|
||||
cp = environ.get('CLASSPATH')
|
||||
if platform.system() == 'Windows':
|
||||
split_char = ';'
|
||||
else:
|
||||
split_char = ':'
|
||||
pre_paths = cp.split(split_char)
|
||||
# deal with wildcards
|
||||
paths = []
|
||||
for path in pre_paths:
|
||||
if not path.endswith('*'):
|
||||
paths.append(path)
|
||||
else:
|
||||
paths.extend(glob(path + '.jar'))
|
||||
paths.extend(glob(path + '.JAR'))
|
||||
result = split_char.join(paths)
|
||||
return result
|
||||
|
||||
|
||||
cdef void create_jnienv():
|
||||
cdef JavaVM* jvm
|
||||
cdef JavaVMInitArgs args
|
||||
cdef JavaVMOption options[1]
|
||||
cdef bytes py_bytes
|
||||
|
||||
from os import environ
|
||||
from os.path import realpath
|
||||
cp = environ.get('CLASSPATH') or realpath('.')
|
||||
cp = classpath()
|
||||
py_bytes = <bytes>('-Djava.class.path={0}'.format(cp))
|
||||
options[0].optionString = py_bytes
|
||||
options[0].extraInfo = NULL
|
||||
|
|
Loading…
Reference in New Issue