mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-09-24 04:59:14 -07:00
dev-python/meson-python: add gentoo defaults; fix pyproject-python support
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
See https://github.com/FFY00/meson-python/blob/main/mesonpy/__init__.py#L452.
|
||||
|
||||
(Also: https://github.com/FFY00/meson-python/issues/54)
|
||||
--- a/mesonpy/__init__.py
|
||||
+++ b/mesonpy/__init__.py
|
||||
@@ -452,7 +452,7 @@ class Project():
|
||||
f'--native-file={os.fspath(self._meson_native_file)}',
|
||||
# TODO: Allow configuring these arguments
|
||||
'-Ddebug=false',
|
||||
- '-Dstrip=true',
|
||||
+ '-Dstrip=false',
|
||||
'-Doptimization=2',
|
||||
*setup_args,
|
||||
)
|
||||
@@ -464,7 +464,7 @@ class Project():
|
||||
|
||||
@functools.lru_cache(maxsize=None)
|
||||
def build(self) -> None:
|
||||
- self._meson('compile')
|
||||
+ self._meson('compile', '--verbose')
|
||||
self._meson('install', '--destdir', os.fspath(self._install_dir))
|
||||
|
||||
@classmethod
|
||||
@@ -0,0 +1,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))
|
||||
|
||||
46
dev-python/meson-python/meson-python-0.5.0-r1.ebuild
Normal file
46
dev-python/meson-python/meson-python-0.5.0-r1.ebuild
Normal file
@@ -0,0 +1,46 @@
|
||||
# Copyright 2022 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
DISTUTILS_USE_PEP517=standalone
|
||||
PYTHON_COMPAT=( python3_{8..10} )
|
||||
|
||||
inherit distutils-r1
|
||||
|
||||
DESCRIPTION="Meson PEP 517 Python build backend"
|
||||
HOMEPAGE="
|
||||
https://pypi.org/project/meson-python/
|
||||
https://github.com/FFY00/meson-python/
|
||||
"
|
||||
SRC_URI="
|
||||
https://github.com/FFY00/meson-python/archive/${PV}.tar.gz
|
||||
-> ${P}.gh.tar.gz
|
||||
"
|
||||
|
||||
LICENSE="EUPL-1.2"
|
||||
SLOT="0"
|
||||
KEYWORDS="~amd64"
|
||||
|
||||
RDEPEND="
|
||||
>=dev-python/pyproject-metadata-0.3.0[${PYTHON_USEDEP}]
|
||||
>=dev-python/tomli-1.0.0[${PYTHON_USEDEP}]
|
||||
>=dev-util/meson-0.60.0[${PYTHON_USEDEP}]
|
||||
"
|
||||
BDEPEND="
|
||||
test? (
|
||||
dev-python/GitPython[${PYTHON_USEDEP}]
|
||||
dev-python/pytest-mock[${PYTHON_USEDEP}]
|
||||
dev-util/patchelf
|
||||
)
|
||||
"
|
||||
|
||||
PATCHES=(
|
||||
"${FILESDIR}"/${P}-pyproject-metadata.patch
|
||||
"${FILESDIR}"/${PN}-0.5.0-defaults.patch
|
||||
)
|
||||
|
||||
distutils_enable_sphinx docs \
|
||||
dev-python/furo \
|
||||
dev-python/sphinx-autodoc-typehints
|
||||
distutils_enable_tests pytest
|
||||
Reference in New Issue
Block a user