All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.xiaopy.python.GenericPlatform Maven / Gradle / Ivy

There is a newer version: 12.1.13
Show newest version
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