com.xiaopy.python.GenericPlatform Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of chaquopy_java Show documentation
Show all versions of chaquopy_java Show documentation
The Python SDK for Android
package com.xiaopy.python;
import org.jetbrains.annotations.*;
/** Platform for a generic Python installation. */
public class GenericPlatform extends Python.Platform {
private String mPath = System.getenv("PYTHONPATH");
public GenericPlatform() {
if (System.getProperty("java.vendor").toLowerCase().contains("android")) {
throw new RuntimeException("Cannot use GenericPlatform on Android. Call Python.start" +
"(new AndroidPlatform(context)) before using Python, or " +
"use PyApplication to do this automatically.");
}
System.loadLibrary("chaquopy_java");
}
@Override
public String getPath() {
return mPath;
}
/** Sets the value to assign to {@code PYTHONPATH}. */
public @NotNull GenericPlatform setPath(String path) {
mPath = path;
return this;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy