pimlico.core.dependencies.base module¶
Base classes for defining software dependencies for module types and routines for fetching them.
-
class
pimlico.core.dependencies.base.
SoftwareDependency
(name, url=None, dependencies=None)[source]¶ Bases:
object
Base class for all Pimlico module software dependencies.
-
all_dependencies
()[source]¶ Recursively fetch all dependencies of this dependency (not including itself).
-
available
()[source]¶ Return True if the dependency is satisfied, meaning that the software/library is installed and ready to use.
-
dependencies
()[source]¶ Returns a list of instances of :class:SoftwareDependency subcalsses representing this library’s own dependencies. If the library is already available, these will never be consulted, but if it is to be installed, we will check first that all of these are available (and try to install them if not).
-
get_installed_version
()[source]¶ If available() returns True, this method should return a SoftwareVersion object (or subclass) representing the software’s version.
The base implementation returns an object representing an unknown version number.
If available() returns False, the behaviour is undefined and may raise an error.
-
install
(trust_downloaded_archives=False)[source]¶ Should be overridden by any subclasses whose library is automatically installable. Carries out the actual installation.
You may assume that all dependencies returned by :method:dependencies have been satisfied prior to calling this.
-
installable
()[source]¶ Return True if it’s possible to install this library automatically. If False, the user will have to install it themselves. Instructions for doing this may be provided by installation_instructions(), which will only generally be called if installable() returns False.
This might be the case, for example, if the software is not available to download freely, or if it requires a system-wide installation.
-
installation_instructions
()[source]¶ Where a dependency can’t be installed programmatically, we typically want to be able to output instructions for the user to tell them how to go about doing it themselves. Any subclass that doesn’t provide an automatic installation routine should override this to provide instructions.
-
-
class
pimlico.core.dependencies.base.
SystemCommandDependency
(name, test_command, **kwargs)[source]¶ Bases:
pimlico.core.dependencies.base.SoftwareDependency
Dependency that tests whether a command is available on the command line. Generally requires system-wide installation.
-
pimlico.core.dependencies.base.
check_and_install
(deps, trust_downloaded_archives=False)[source]¶ Check whether dependencies are available and try to install those that aren’t. Returns a list of dependencies that can’t be installed.