Installlib

From EventScripts Community Encyclopedia


Module: installlib

Module Overview

EventScripts version: 2.0.0.248a or later

Table of Contents

Contents


Description

Installs ES addons and keeps file information for uninstall

Quick Example

Installing an addon from the ESAM:

>>> import installlib
 
>>> randmaps = installlib.getInstaller('randmaps')
>>> randmaps.install(True) # Install RandMaps with it autoloaded
0 # Install successful
 
>>> randmaps.update()
4 # Already up to date
>>> randmaps.update(True) # Force update
0 # Update successful
 
>>> randmaps.uninstall()
0 # Uninstall successful 

Designating a file as part of your addon:

import es
import installlib
 
basename = 'iptocountry' # Change to the name of your addon
 
# Designate a file as part of your addon, to be cleaned up when updated or uninstalled
if installlib.infomanager.hasInstallInfo(basename):
   installinfo = installlib.infomanager.getInstallInfo(basename)
   installinfo.addFile(es.getAddonPath('_libs') + '/python/iptocountry.db') # This file is generated by IPToCountry
   installlib.infomanager.saveInstallInfo(basename, installinfo)

Module Content

Classes

Methods

installlib.getInstaller(basename, addon_file=None, log=esamlib.dbglog)
Returns an installlib.AddonInstaller instance for installing a raw .zip addon_file. When no file is provided the .zip is retrieved from the ESAM by basename if possible using esamlib.getAddon.
installlib.getInstallerFromPath(basename, path, log=esamlib.dbglog)
Returns an installlib.AddonInstaller instance for installing the .zip pointed to by path.

See Also

Notes

blog comments powered by Disqus