pimlico.core.dependencies.java module

class pimlico.core.dependencies.java.JavaDependency(name, classes=[], jars=[], class_dirs=[], **kwargs)[source]

Bases: pimlico.core.dependencies.base.SoftwareDependency

Base class for Java library dependencies.

In addition to the usual functionality provided by dependencies, subclasses of this provide contributions to the Java classpath in the form of directories of jar files.

The instance has a set of representative Java classes that the checker will try to load to check whether the library is available and functional. It will also check that all jar files exist.

Jar paths and class directory paths are assumed to be relative to the Java lib dir (lib/java), unless they are absolute paths.

Subclasses should provide install() and override installable() if it’s possible to install them automatically.

get_classpath_components()[source]
installable()[source]
problems()[source]
class pimlico.core.dependencies.java.JavaJarsDependency(name, jar_urls, **kwargs)[source]

Bases: pimlico.core.dependencies.java.JavaDependency

Simple way to define a Java dependency where the library is packaged up in a jar, or a series of jars. The jars should be given as a list of (name, url) pairs, where name is the filename the jar should have and url is a url from which it can be downloaded.

URLs may also be given in the form “url->member”, where url is a URL to a tar.gz or zip archive and member is a member to extract from the archive. If the type of the file isn’t clear from the URL (i.e. if it doesn’t have ”.zip” or ”.tar.gz” in it), specify the intended extension in the form “[ext]url->member”, where ext is “tar.gz” or “zip”.

install(trust_downloaded_archives=False)[source]
class pimlico.core.dependencies.java.PimlicoJavaLibrary(name, classes=[], additional_jars=[])[source]

Bases: pimlico.core.dependencies.java.JavaDependency

Special type of Java dependency for the Java libraries provided with Pimlico. These are packages up in jars and stored in the build dir.

class pimlico.core.dependencies.java.Py4JSoftwareDependency[source]

Bases: pimlico.core.dependencies.java.JavaDependency

Java component of Py4J. Use this one as the main dependency, as it depends on the Python component and will install that first if necessary.

dependencies()[source]
install(trust_downloaded_archives=False)[source]
installable()[source]
jars
pimlico.core.dependencies.java.check_java()[source]

Check that the JVM executable can be found. Raises a DependencyError if it can’t be found or can’t be run.

pimlico.core.dependencies.java.check_java_dependency(class_name, classpath=None)[source]

Utility to check that a java class is able to be loaded.

pimlico.core.dependencies.java.get_classpath(deps, as_list=False)[source]

Given a list of JavaDependency subclass instances, returns all the components of the classpath that will make sure that the dependencies are available.

If as_list=True, returned as a list. Get the full classpath by ”:”.join(x) on the list. If as_list=False, returns classpath string.

pimlico.core.dependencies.java.get_module_classpath(module)[source]

Builds a classpath that includes all of the classpath elements specified by Java dependencies of the given module. These include the dependencies from get_software_dependencies() and also any dependencies of the datatype.

Used to ensure that Java modules that depend on particular jars or classes get all of those files included on their classpath when Java is run.