mpackmanager Module

mpackmanager.py This file supports discovery and loading of modules by path and filename pattern

Note that our term “pack” here is not referring to python packs (directories).

The pack system here is made up of 3 classes:

  • MewloPackManager - holds a list of Packs.
  • MewloPack - a thin wrapper around a pack object.
  • MewloPackWorker - the object that will be subclassed to do real work.

The MewloPack is the thing that is autocreated on discovery of a .json definition file. It will be instantiated even if this extension is disabled.

The PackWorker is only instantiated when the extension is enabled.

When you code a new plugin/extension, you ONLY create a derived MewloPackWorker class. The MewloPack is created by the manager.

class mewlo.mpacks.core.pack.mpackmanager.MewloPackManager(mewlosite, debugmode)[source]

Bases: mewlo.mpacks.core.manager.manager.MewloManager

The PackManager is a class that can be used to dynamically find modules by path and filename pattern. It manages a collection of Pack objects that represent addonsm, etc. It’s useful for plugin-discovery type things.

calc_packinfofile_pattern()[source]

Given self.filepatternsuffix we create the file match pattern that describes the json info files we need to look for.

check_pack_dependencies(pack, requirer, assumegoodlist)[source]
Check whether this pack has its dependenices met. Return tuple (dependencies_met, reasontext).

In the json file this looks like: “requires”: {

“packs”: [“mouser.mewlotestplug”]

},

classwide_packmodules = {}
create_pack(filepath)[source]

Create an appropriate child pack.

createadd_pack_frominfofile(infofilepath, eventlist)[source]

Given a path to an infofile, create a pack from it.

description = "Manages all 'MewloPacks' which are collections of files that can be updated"
discover_packs(eventlist)[source]

Scan all pack directories and discover packs.

discover_setuptools_entrypoints_infofilepaths()[source]

Discover any setuptools based entry-point plugins that are exposing their info.

do_discover(eventlist)[source]
dumps(indent=0)[source]

Return a string (with newlines and indents) that displays some debugging useful information about the object.

findfilepaths(dirpath, filepattern)[source]

Find recursive list of filepaths matching pattern.

findpack_byid(packid)[source]

Return the pack object for the pack specified by id, or None if not found.

get_allpack_events()[source]

Get combined eventlist for all packs. We merge in fields about the pack so they are available for debugging.

get_mewlosite()[source]
get_settings_forpack(packid)[source]

Given a pack id, lookup its settings.

is_readytoserve()[source]

Check if there were any site prep errors, OR if any packs report they are not ready to run (need update, etc.).

loadimport(path)[source]

Dynamically load an importbypath (or returned cached value of previous import).

set_default_packsettings(default_packsettings)[source]
set_directories(dirlist)[source]
set_filepatternsuffix(filepatternsuffix)[source]
set_flag_loadsetuptoolspacks(val)[source]
set_packsettings(packsettings)[source]
set_setuptools_entrypoint_groupname(setuptools_entrypoint_groupname)[source]
shutdown()[source]

Shutdown the packs.

startup_pack_auto(mewlosite, pack, eventlist)[source]

Before we instantiate a pack, we preprocess it using our settings, which may disable/enabe them.

startup_packs(eventlist)[source]

Startup packs. We do this separately from normal startup() because we may want to check for updates first.

startup_prep(stageid, eventlist)[source]

This is invoked by site strtup, for each stage specified in startup_stages_needed() above.

typestr = 'core'
updatecheck_allpacks()[source]

Check all packs for updates. The packs themselves will store details about update check results. Note this covers not just web updates available, but database updates needed.

updaterun_allpacks()[source]

Check all packs for updates. The packs themselves will store details about update check results. Note this covers not just web updates available, but database updates needed.

want_enable_pack(pack, eventlist)[source]

Do settings say to disable this pack? Return tuple of (flag_enable, reasonstring).

will_enable_pack_byid(packid, requirer, assumegoodlist)[source]

Check if pack will be enabled, by id.

Table Of Contents

This Page