summaryrefslogtreecommitdiff
path: root/dev-python/meson-python/files/meson-python-0.5.0-pyproject-metadata.patch
blob: fd96d942eb73bd99cef20c1bee668bebc1a49381 (plain)
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
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
106
107
108
109
110
https://github.com/FFY00/meson-python/commit/678a586427088a58dfac15bb3fe89b3d7ff0178e
https://github.com/FFY00/meson-python/commit/c01645aa3617ccd424ef3ec052d13ac25e7df433

From 678a586427088a58dfac15bb3fe89b3d7ff0178e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Filipe=20La=C3=ADns?= <lains@riseup.net>
Date: Thu, 9 Jun 2022 20:24:32 +0100
Subject: [PATCH] mesonpy: replace pep621 dependency with pyproject-metadata
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Fixes #33

Signed-off-by: Filipe Laíns <lains@riseup.net>
--- a/mesonpy/__init__.py
+++ b/mesonpy/__init__.py
@@ -46,7 +46,7 @@
 
 
 if typing.TYPE_CHECKING:  # pragma: no cover
-    import pep621 as _pep621  # noqa: F401
+    import pyproject_metadata  # noqa: F401
     import wheel.wheelfile  # noqa: F401
 
 
@@ -353,7 +353,7 @@ class Project():
     _ALLOWED_DYNAMIC_FIELDS: ClassVar[List[str]] = [
         'version',
     ]
-    _metadata: Optional[_pep621.StandardMetadata]
+    _metadata: Optional[pyproject_metadata.StandardMetadata]
 
     def __init__(
         self,
@@ -372,11 +372,11 @@ def __init__(
         self._pep621 = 'project' in self._config
         if self.pep621:
             try:
-                import pep621  # noqa: F811
+                import pyproject_metadata  # noqa: F811
             except ModuleNotFoundError:  # pragma: no cover
                 self._metadata = None
             else:
-                self._metadata = pep621.StandardMetadata.from_pyproject(self._config, self._source_dir)
+                self._metadata = pyproject_metadata.StandardMetadata.from_pyproject(self._config, self._source_dir)
         else:
             print(
                 '{yellow}{bold}! Using Meson to generate the project metadata '
@@ -550,8 +550,8 @@ def metadata(self) -> bytes:  # noqa: C901
                 Name: {self.name}
                 Version: {self.version}
             ''').strip().encode()
-        # re-import pep621 to raise ModuleNotFoundError if it is really missing
-        import pep621  # noqa: F401, F811
+        # re-import pyproject_metadata to raise ModuleNotFoundError if it is really missing
+        import pyproject_metadata  # noqa: F401, F811
         assert self._metadata
         # use self.version as the version may be dynamic -- fetched from Meson
         core_metadata = self._metadata.as_rfc822()
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,7 +4,7 @@ backend-path = ['.']
 requires = [
   'meson>=0.62.0',
   'ninja',
-  'pep621>=0.3.0',
+  'pyproject-metadata>=0.5.0',
   'tomli>=1.0.0',
   'typing-extensions>=3.7.4; python_version<"3.8"',
 ]
@@ -29,7 +29,7 @@ dependencies = [
   'colorama; os_name == "nt"',
   'meson>=0.60.0',
   'ninja',
-  'pep621>=0.3.0', # not a hard dependency, only needed for projects that use PEP 621 metadata
+  'pyproject-metadata>=0.5.0', # not a hard dependency, only needed for projects that use PEP 621 metadata
   'tomli>=1.0.0',
   'typing-extensions>=3.7.4; python_version<"3.8"',
 ]
@@ -41,7 +41,6 @@ test = [
   'pytest-mock',
   'GitPython',
   'auditwheel',
-  'pep621 >= 0.4.0',
 ]
 docs = [
   'furo>=2021.08.31',

From c01645aa3617ccd424ef3ec052d13ac25e7df433 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Filipe=20La=C3=ADns?= <lains@riseup.net>
Date: Thu, 9 Jun 2022 20:27:49 +0100
Subject: [PATCH] mesonpy: update code to pyproject-metadata 0.5.0
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Filipe Laíns <lains@riseup.net>
--- a/mesonpy/__init__.py
+++ b/mesonpy/__init__.py
@@ -424,9 +424,6 @@ def __init__(
         # set version if dynamic (this fetches it from Meson)
         if self._metadata and 'version' in self._metadata.dynamic:
             self._metadata.version = self.version
-            # version is no longer dynamic
-            # XXX: Should this be automatically handled by pep621/pyproject-metadata?
-            self._metadata.dynamic.remove('version')
 
     def _proc(self, *args: str) -> None:
         print('{cyan}{bold}+ {}{reset}'.format(' '.join(args), **_STYLES))