Differences From Artifact [bc5328f2e0]:

To Artifact [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


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


    return wrapped

@inject(flit_core.config)
def read_flit_config(path):
    """ read_flit_config() with preset 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 """
    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 """
    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,







>
>




|


















|



















|







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):
    """ @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):
    """ @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.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
        "provides_dist": (),
        "requires_dist": pmd.install_requires().get("install_requires") or (),
        "obsoletes_dist": (),
        "requires_external": (),
        "provides_extra": (),
    }
    print(meta)


    # 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()
            })







>







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()
            })