Differences From Artifact [2a83c6ef38]:

To Artifact [fd547f8d0f]:


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

39




40



41
42





43
44
45
46
47
48

49
50
51
52
53
54
55
1
2
3
4
5
6
7
8
9
10
11
12
13











14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

29
30
31
32
33
34
35
36


37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55













-
-
-
-
-
-
-
-
-
-
-














+
-
+
+
+
+

+
+
+
-
-
+
+
+
+
+






+







# encoding: utf-8
# api: pep517
# title: flit backend
# description: wraps flit_core.buildapi
# version: 0.3
# depends: python:flit (>=3.0, <4.0)
# license: BSD-3-Clause
# priority: extra
# pylint: disable=unused-import, wrong-import-position, wrong-import-order
#
# As alternative to pluginconf.setup, this module is using flit as
# pep517 build backend. But adding automagic field lookup of course.
#
# It can be invoked per `flit-pluginconfig build` and advises
# a `pyproject.toml` like:
#
#       [build-system]
#       requires = ["pluginconf>=0.8", "flit>=3.2", "setuptools"]
#       build-backend = "pluginconf.flit"
#
#       [project]
#       name = "foobar"
#       dynamic = ["version", "description"]
#
# Injecting attributes between ini reading and parameter collection
# turned out easier than expanding on flit_core.buildapi functions.
# And lastly, this just chains to flit.main() to handle collect and
# build tasks.
#
# Dynamic handling currently violates all the package tool requirements:
# <https://packaging.python.org/en/latest/specifications/declaring-project-metadata/#dynamic>
# But it does have some interesting side effects.
#  * mixes the override text and file inclusion
#    license = { file = "LICENSE" }
#  * for setuptools compat a long dynamic field is required (but flit hates it)
#    dynamic = ["version", "description", "readme", "requires-python",
#              "license", "keywords", "classifiers", "urls", "entry-points"]
# Not sure yet if the pyproject.toml specs allow for reconcilation here.
# <https://github.com/pypa/flit/issues/605>
#

"""
monkeypatches flit to use pluginconf sources for packaging with a
`pyproject.toml` like:

    [build-system]
    requires = ["pluginconf", "flit"]
    build-backend = "pluginconf.flit"
"""
monkeypatches flint to use pluginconf sources for packaging

    [project]
    name = "foobar"

Can be invoked per `flit-pluginconf build` or `python -m build`.

![flit - can't believe it's not setup.py!!](https://i.imgur.com/82cTkcq.gif)
"""


import sys
import os
import re
import functools

import flit_core.common
import flit_core.config

import pluginconf
170
171
172
173
174
175
176

177
178
179
180
181
182
183

184
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186







+







+

    get_requires_for_build_editable,
    prepare_metadata_for_build_wheel,
    prepare_metadata_for_build_editable,
    build_wheel,
    build_editable,
    build_sdist,
)
import flit_core.buildapi  # also permit backend="pluginconf.flit:buildapi"

del inject  # omit from docs

#-- invocation point
from flit import main

if __name__ == "__main__":
    # os.environ["FLIT_ALLOW_INVALID"] = 1  # alternative to patch_flit_config?
    main(sys.argv)