Overview
Comment:resurrect functions for doc
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: f0163c8621a843d45194aa9654d9e82fd133f797f245543d5a0dc7526b8e8bd4
User & Date: mario on 2022-10-27 07:58:50
Other Links: manifest | tags
Context
2022-10-27
10:43
pylint fixes, doc additions check-in: a88ee41164 user: mario tags: trunk
07:58
resurrect functions for doc check-in: f0163c8621 user: mario tags: trunk
07:47
update Check check-in: 2568a72ca8 user: mario tags: trunk
Changes

Modified html/flit.html from [59c947f140] to [5f3e858fb2].

33
34
35
36
37
38
39






40
41
42
43
44







45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64

65

66
67
68
69
70
71
72
73
74
75
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89







+
+
+
+
+
+




-
+
+
+
+
+
+
+




















+

+










<dl>
<dt id="pluginconf.flit.inject"><code class="name flex">
<span>def <span class="ident">inject</span></span>(<span>where)</span>
</code></dt>
<dd>
<div class="desc"><p>monkeypatch into module</p></div>
</dd>
<dt id="pluginconf.flit.make_metadata"><code class="name flex">
<span>def <span class="ident">make_metadata</span></span>(<span>module, ini_info)</span>
</code></dt>
<dd>
<div class="desc"><p>@inject different sourcing order to apply plugin meta fields</p></div>
</dd>
<dt id="pluginconf.flit.pmd_meta"><code class="name flex">
<span>def <span class="ident">pmd_meta</span></span>(<span>pmd, ini)</span>
</code></dt>
<dd>
<div class="desc"><p>enjoin PMD fields with flit meta data</p></div>
<div class="desc"><p>enjoin PMD fields with flit.common.MetaData</p></div>
</dd>
<dt id="pluginconf.flit.read_flit_config"><code class="name flex">
<span>def <span class="ident">read_flit_config</span></span>(<span>path)</span>
</code></dt>
<dd>
<div class="desc"><p>@inject read_flit_config() with forced dynamic fields</p></div>
</dd>
</dl>
</section>
<section>
</section>
</article>
<nav id="sidebar">
<h1>Index</h1>
<div class="toc">
<ul></ul>
</div>
<ul id="index">
<li><h3>Super-module</h3>
<ul>
<li><code><a title="pluginconf" href="index.html">pluginconf</a></code></li>
</ul>
</li>
<li><h3><a href="#header-functions">Functions</a></h3>
<ul class="">
<li><code><a title="pluginconf.flit.inject" href="#pluginconf.flit.inject">inject</a></code></li>
<li><code><a title="pluginconf.flit.make_metadata" href="#pluginconf.flit.make_metadata">make_metadata</a></code></li>
<li><code><a title="pluginconf.flit.pmd_meta" href="#pluginconf.flit.pmd_meta">pmd_meta</a></code></li>
<li><code><a title="pluginconf.flit.read_flit_config" href="#pluginconf.flit.read_flit_config">read_flit_config</a></code></li>
</ul>
</li>
</ul>
</nav>
</main>
<footer id="footer">
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.10.0</a>.</p>
</footer>
</body>
</html>

Modified pluginconf/flit.py from [bc5328f2e0] to [dff91eb86b].

46
47
48
49
50
51
52


53
54
55
56
57

58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76

77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96

97
98
99
100
101
102
103
46
47
48
49
50
51
52
53
54
55
56
57
58

59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77

78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97

98
99
100
101
102
103
104
105







+
+




-
+


















-
+



















-
+









#-- patchy patch
def inject(where):
    """ monkeypatch into module """
    def wrapped(func):
        setattr(where, func.__name__, func)
        wrapped.__doc__ = func.__doc__
        return func
    return wrapped

@inject(flit_core.config)
def read_flit_config(path):
    """ read_flit_config() with preset dynamic fields """
    """ @inject read_flit_config() with forced dynamic fields """
    ini = flit_core.config.tomli.loads(path.read_text('utf-8'))

    # make fields dynamic
    if not "dynamic" in ini["project"]:
        ini["project"]["dynamic"] = []
    for dyn in ['description', 'version']:
        if dyn in ini["project"]:
            del ini["project"][dyn]
        if not dyn in ini["project"]["dynamic"]:
            ini["project"]["dynamic"].append(dyn)
    print(ini)

    # turn it into LoadedConfig
    return flit_core.config.prep_toml_config(ini, path)

# override make_metadata
@inject(flit_core.common)
def make_metadata(module, ini_info):
    """ different order, and obviously sources """
    """ @inject different sourcing order to apply plugin meta fields """
    meta = {
        "name": module.name,
        "provides": [module.name]
    }
    meta.update(ini_info.metadata)
    meta.update(
        pmd_meta(
            pluginconf.plugin_meta(filename=module.file),
            ini_info
        )
    )
    if not meta.get("version"):
        meta.update(
            flit_core.common.get_info_from_module(module.file, ['version'])
        )
    return flit_core.common.Metadata(meta)

# map plugin meta to flit Metadata
def pmd_meta(pmd, ini):
    """ enjoin PMD fields with flit meta data """
    """ enjoin PMD fields with flit.common.MetaData """
    pmd = psetup.MetaUtils(pmd)
    meta = {
        "summary": pmd.description,
        "version": pmd.version,
        "home_page": pmd.url,
        "author": pmd.author,  # should split this into mail and name
        "author_email": None,
117
118
119
120
121
122
123

124
125
126
127
128
129
130
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133







+







        "provides_dist": (),
        "requires_dist": pmd.install_requires().get("install_requires") or (),
        "obsoletes_dist": (),
        "requires_external": (),
        "provides_extra": (),
    }
    print(meta)
    print(pmd.install_requires())

    # comment/readme
    for docs in pmd.plugin_doc(), psetup.get_readme():
        if docs["long_description"]:
            meta.update({  # with "long_" prefix cut off
                k[5:]: v for k, v in docs.items()
            })