<html><head><title>Python: module pluginconf</title>

<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica,
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a
    <p><tt>#&nbsp;encoding:&nbsp;UTF-8<br>
#&nbsp;api:&nbsp;python<br>
#&nbsp;type:&nbsp;handler<br>
#&nbsp;category:&nbsp;io<br>
#&nbsp;title:&nbsp;Plugin&nbsp;configuration<br>
#&nbsp;description:&nbsp;Read&nbsp;meta&nbsp;data,&nbsp;pyz/package&nbsp;contents,&nbsp;module&nbsp;locating<br>
#&nbsp;version:&nbsp;0.6.8<br>
#&nbsp;priority:&nbsp;core<br>
#&nbsp;docs:&nbsp;<a
#&nbsp;config:&nbsp;-<br>
#<br>
#&nbsp;Provides&nbsp;plugin&nbsp;lookup&nbsp;and&nbsp;meta&nbsp;data&nbsp;extraction&nbsp;utility&nbsp;functions.<br>
#&nbsp;It's&nbsp;used&nbsp;to&nbsp;abstract&nbsp;module+option&nbsp;management&nbsp;in&nbsp;applications.<br>
#&nbsp;For&nbsp;consolidating&nbsp;internal&nbsp;use&nbsp;and&nbsp;external/tool&nbsp;accessibility.<br>
#<br>
#&nbsp;The&nbsp;key:value&nbsp;format&nbsp;is&nbsp;language-agnostic.&nbsp;It's&nbsp;basically&nbsp;YAML&nbsp;in<br>
#&nbsp;a&nbsp;topmost&nbsp;script&nbsp;comment.&nbsp;For&nbsp;Python&nbsp;only&nbsp;#&nbsp;hash&nbsp;comments&nbsp;though.<br>
#&nbsp;Uses&nbsp;common&nbsp;field&nbsp;names,&nbsp;a&nbsp;documentation&nbsp;block,&nbsp;and&nbsp;an&nbsp;obvious<br>
#&nbsp;`config:&nbsp;{&nbsp;..&nbsp;}`&nbsp;spec&nbsp;for&nbsp;options&nbsp;and&nbsp;defaults.<br>
#<br>
#&nbsp;It&nbsp;neither&nbsp;imposes&nbsp;a&nbsp;specific&nbsp;module/plugin&nbsp;API,&nbsp;nor&nbsp;config&nbsp;storage,<br>
#&nbsp;and&nbsp;doesn't&nbsp;fixate&nbsp;module&nbsp;loading.&nbsp;It's&nbsp;really&nbsp;just&nbsp;meant&nbsp;to&nbsp;look<br>
#&nbsp;up&nbsp;meta&nbsp;infos.<br>
#&nbsp;This&nbsp;approach&nbsp;avoids&nbsp;in-code&nbsp;values/inspection,&nbsp;externalized&nbsp;meta<br>
#&nbsp;descriptors,&nbsp;and&nbsp;any&nbsp;hodgepodge&nbsp;or&nbsp;premature&nbsp;module&nbsp;loading&nbsp;just&nbsp;to<br>
#&nbsp;uncover&nbsp;module&nbsp;description&nbsp;fields.<br>
#<br>
#&nbsp;<a href="#-plugin_meta">plugin_meta</a>()<br>
#&nbsp;‾‾‾‾‾‾‾‾‾‾‾‾‾<br>
#&nbsp;&nbsp;Is&nbsp;the&nbsp;primary&nbsp;function&nbsp;to&nbsp;extract&nbsp;a&nbsp;meta&nbsp;dictionary&nbsp;from&nbsp;files.<br>
#&nbsp;&nbsp;It&nbsp;either&nbsp;reads&nbsp;from&nbsp;a&nbsp;given&nbsp;module=&nbsp;name,&nbsp;a&nbsp;literal&nbsp;fn=,&nbsp;or&nbsp;just<br>
#&nbsp;&nbsp;src=&nbsp;code,&nbsp;and&nbsp;as&nbsp;fallback&nbsp;inspects&nbsp;the&nbsp;last&nbsp;stack&nbsp;frame=&nbsp;else.<br>
#<br>
#&nbsp;<a href="#-module_list">module_list</a>()<br>
#&nbsp;‾‾‾‾‾‾‾‾‾‾‾‾‾<br>
#&nbsp;&nbsp;Returns&nbsp;basenames&nbsp;of&nbsp;available/installed&nbsp;plugins.&nbsp;It&nbsp;uses&nbsp;the<br>
#&nbsp;&nbsp;plugin_base=[]&nbsp;list&nbsp;for&nbsp;module&nbsp;relation.&nbsp;Which&nbsp;needs&nbsp;to&nbsp;be&nbsp;set&nbsp;up<br>
#&nbsp;&nbsp;beforehand,&nbsp;or&nbsp;injected.<br>
#<br>
#&nbsp;<a href="#-add_plugin_defaults">add_plugin_defaults</a>()<br>
#&nbsp;‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾<br>
#&nbsp;&nbsp;Populates&nbsp;a&nbsp;config_options{}&nbsp;and&nbsp;plugin_states{}&nbsp;list.&nbsp;Used&nbsp;for<br>
#&nbsp;&nbsp;initial&nbsp;setup,&nbsp;or&nbsp;when&nbsp;adding&nbsp;new&nbsp;plugins,&nbsp;etc.&nbsp;Both&nbsp;dicts&nbsp;might<br>
#&nbsp;&nbsp;also&nbsp;be&nbsp;ConfigParser&nbsp;stores,&nbsp;or&nbsp;implement&nbsp;magic&nbsp;__set__&nbsp;handling<br>
#&nbsp;&nbsp;to&nbsp;act&nbsp;on&nbsp;state&nbsp;changes.<br>
#<br>
#&nbsp;<a href="#-get_data">get_data</a>()<br>
#&nbsp;‾‾‾‾‾‾‾‾‾‾<br>
#&nbsp;&nbsp;Is&nbsp;mostly&nbsp;an&nbsp;alias&nbsp;for&nbsp;pkgutil.<a href="#-get_data">get_data</a>().&nbsp;It&nbsp;abstracts&nbsp;the&nbsp;main<br>
#&nbsp;&nbsp;base&nbsp;path,&nbsp;allows&nbsp;PYZ&nbsp;usage,&nbsp;and&nbsp;adds&nbsp;some&nbsp;convenience&nbsp;flags.‾<br>
#&nbsp;&nbsp;It's&nbsp;somewhat&nbsp;off-scope&nbsp;for&nbsp;plugin&nbsp;management,&nbsp;but&nbsp;used&nbsp;internally.<br>
#<br>
#&nbsp;argparse_map()<br>
#&nbsp;‾‾‾‾‾‾‾‾‾‾‾‾‾‾<br>
#&nbsp;&nbsp;Converts&nbsp;a&nbsp;list&nbsp;of&nbsp;config:&nbsp;options&nbsp;with&nbsp;arg:&nbsp;attribute&nbsp;for&nbsp;use&nbsp;as<br>
#&nbsp;&nbsp;argparser&nbsp;parameters.<br>
#<br>
#&nbsp;<a
#&nbsp;‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾<br>
#&nbsp;&nbsp;Probes&nbsp;a&nbsp;new&nbsp;plugins`&nbsp;depends:&nbsp;list&nbsp;against&nbsp;installed&nbsp;base&nbsp;modules.<br>
#&nbsp;&nbsp;Utilizes&nbsp;each&nbsp;version:&nbsp;fields&nbsp;and&nbsp;allows&nbsp;for&nbsp;virtual&nbsp;modules,&nbsp;or<br>
#&nbsp;&nbsp;alternatives&nbsp;and&nbsp;honors&nbsp;alias:&nbsp;names.<br>
#<br>
#<br>
#&nbsp;Generally&nbsp;this&nbsp;scheme&nbsp;concerns&nbsp;itself&nbsp;more&nbsp;with&nbsp;plugin&nbsp;basenames.<br>
#&nbsp;That&nbsp;is:&nbsp;module&nbsp;scripts&nbsp;in&nbsp;a&nbsp;package&nbsp;like&nbsp;`ext.plg1`&nbsp;and&nbsp;`ext.plg2`.<br>
#&nbsp;It&nbsp;can&nbsp;be&nbsp;initialized&nbsp;by&nbsp;injecting&nbsp;the&nbsp;plugin-package&nbsp;basename&nbsp;into<br>
#&nbsp;plugin_base&nbsp;=&nbsp;[].&nbsp;The&nbsp;associated&nbsp;paths&nbsp;will&nbsp;be&nbsp;used&nbsp;for&nbsp;module<br>
#&nbsp;lookup&nbsp;via&nbsp;pkgutil.iter_modules().<br>
#<br>
#&nbsp;And&nbsp;a&nbsp;central&nbsp;module&nbsp;can&nbsp;be&nbsp;extended&nbsp;with&nbsp;new&nbsp;lookup&nbsp;locations&nbsp;best<br>
#&nbsp;by&nbsp;attaching&nbsp;new&nbsp;locations&nbsp;itself&nbsp;via&nbsp;module.__path__&nbsp;+&nbsp;["./local"]<br>
#&nbsp;for&nbsp;example.<br>
#<br>
#&nbsp;Plugin&nbsp;loading&nbsp;thus&nbsp;becomes&nbsp;as&nbsp;simple&nbsp;as&nbsp;__import__("ext.local").<br>
#&nbsp;The&nbsp;attached&nbsp;plugin_state&nbsp;config&nbsp;dictionary&nbsp;in&nbsp;most&nbsp;cases&nbsp;can&nbsp;just<br>

<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica,

<tr><td
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a

<a
</td><td width="25%" valign=top><a href="os.html">os</a><br>
<a
</td><td width="25%" valign=top><a href="re.html">re</a><br>
<a
</td><td width="25%" valign=top><a

<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica,

<tr><td
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a>

<dl>
<dt><font face="helvetica, arial"><a href="api-pluginconf#dependency">dependency</a>

</dd>
</dl>
 <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="dependency">class

<tr bgcolor="#ffc8d8"><td
<td colspan=2><tt>#&nbsp;Minimal&nbsp;depends:&nbsp;probing<br>
#&nbsp;‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾<br>
#&nbsp;Now&nbsp;this&nbsp;definitely&nbsp;requires&nbsp;customization.&nbsp;Each&nbsp;plugin&nbsp;can&nbsp;carry<br>
#&nbsp;a&nbsp;list&nbsp;of&nbsp;(soft-)&nbsp;<a href="#dependency">dependency</a>&nbsp;names.<br>
#<br>
#&nbsp;&nbsp;&nbsp;depends:&nbsp;config,&nbsp;appcore&nbsp;&gt;=&nbsp;2.0,&nbsp;bin:wkhtmltoimage,&nbsp;python&nbsp;&lt;&nbsp;3.5<br>
#<br>
#&nbsp;Here&nbsp;only&nbsp;in-application&nbsp;modules&nbsp;are&nbsp;honored,&nbsp;system&nbsp;references<br>
#&nbsp;ignored.&nbsp;Unknown&nbsp;plugin&nbsp;names&nbsp;are&nbsp;also&nbsp;skipped.&nbsp;A&nbsp;real&nbsp;install<br>
#&nbsp;helper&nbsp;might&nbsp;want&nbsp;to&nbsp;auto-tick&nbsp;them&nbsp;on,&nbsp;etc.&nbsp;This&nbsp;example&nbsp;is&nbsp;just<br>
#&nbsp;meant&nbsp;for&nbsp;probing&nbsp;downloadable&nbsp;plugins.<br>
#<br>
#&nbsp;The&nbsp;.<a href="#dependency-valid">valid</a>()&nbsp;helper&nbsp;only&nbsp;asserts&nbsp;the&nbsp;api:&nbsp;string,&nbsp;or&nbsp;skips&nbsp;existing<br>
#&nbsp;modules,&nbsp;and&nbsp;if&nbsp;they're&nbsp;more&nbsp;recent.<br>
#&nbsp;While&nbsp;.<a href="#dependency-depends">depends</a>()&nbsp;compares&nbsp;minimum&nbsp;versions&nbsp;against&nbsp;existing&nbsp;modules.<br>
#<br>
#&nbsp;In&nbsp;practice&nbsp;there's&nbsp;little&nbsp;need&nbsp;for&nbsp;full-blown&nbsp;<a href="#dependency">dependency</a>&nbsp;resolving<br>

<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a add<font color="#909090">={}</font>, core<font color="#909090">=['st2', 'uikit', 'config',

<dl><dt><a deps, have, r<font

<dl><dt><a d, have, absent<font

<dl><dt><a

<dl><dt><a type,

<dl><dt><a deps,

<dl><dt><a

<dl><dt><a newpl)</dt><dd><tt>#&nbsp;basic&nbsp;plugin&nbsp;pre-screening&nbsp;(skip&nbsp;__init__,&nbsp;filter&nbsp;by&nbsp;api:,<br>


<hr>
Data descriptors defined here:<br>


</dl>


</dl>

<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#eeaa77">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica,

<tr><td
<td width="100%"><dl><dt><a conf_plugins, meta<font color="#909090">={}</font>, module<font
#&nbsp;‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾<br>
#&nbsp;Utility&nbsp;function&nbsp;which&nbsp;applies&nbsp;plugin&nbsp;meta&nbsp;data&nbsp;to&nbsp;a&nbsp;config<br>
#&nbsp;store.&nbsp;Which&nbsp;in&nbsp;the&nbsp;case&nbsp;of&nbsp;streamtuner2&nbsp;is&nbsp;really&nbsp;just&nbsp;a<br>
#&nbsp;dictionary&nbsp;`conf{}`&nbsp;and&nbsp;a&nbsp;plugin&nbsp;list&nbsp;in&nbsp;`conf.plugins{}`.<br>
#<br>
#&nbsp;Adds&nbsp;each&nbsp;default&nbsp;option&nbsp;value:&nbsp;to&nbsp;conf_options{}.&nbsp;And&nbsp;sets<br>
#&nbsp;first&nbsp;plugin&nbsp;state&nbsp;(enabled/disabled)&nbsp;in&nbsp;conf_plugins{}&nbsp;list,<br>

 <dl><dt><a decode<font color="#909090">=False</font>, gz<font color="#909090">=False</font>, file_base<font
#&nbsp;‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾<br>
#&nbsp;Fetches&nbsp;file&nbsp;content&nbsp;from&nbsp;install&nbsp;path&nbsp;or&nbsp;from&nbsp;within&nbsp;PYZ<br>
#&nbsp;archive.&nbsp;This&nbsp;is&nbsp;just&nbsp;an&nbsp;alias&nbsp;and&nbsp;convenience&nbsp;wrapper&nbsp;for<br>
#&nbsp;pkgutil.<a href="#-get_data">get_data</a>().<br>

 <dl><dt><a
#&nbsp;‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾<br>


 <dl><dt><a color="#909090">=None</font>, src<font color="#909090">=None</font>, module<font color="#909090">=None</font>, frame<font color="#909090">=1</font>, extra_base<font
#&nbsp;‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾<br>
#&nbsp;Can&nbsp;fetch&nbsp;infos&nbsp;from&nbsp;different&nbsp;sources:<br>
#<br>
#&nbsp;&nbsp;&nbsp;fn=&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;read&nbsp;literal&nbsp;files,&nbsp;or&nbsp;.pyz&nbsp;contents<br>
#<br>
#&nbsp;&nbsp;&nbsp;src=&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;already&nbsp;uncovered&nbsp;script&nbsp;code<br>
#<br>
#&nbsp;&nbsp;&nbsp;module=&nbsp;&nbsp;lookup&nbsp;per&nbsp;pkgutil,&nbsp;from&nbsp;plugin&nbsp;bases<br>
#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;or&nbsp;top-level&nbsp;modules<br>
#<br>
#&nbsp;&nbsp;&nbsp;frame=&nbsp;&nbsp;&nbsp;extract&nbsp;comment&nbsp;header&nbsp;of&nbsp;caller<br>


<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica,

<tr><td
<td width="100%"><strong>__all__</strong> = ['get_data', 'module_list', 'plugin_meta', 'dependency',