diff options
author | 2023-01-26 15:13:00 +0100 | |
---|---|---|
committer | 2023-01-26 15:33:20 +0100 | |
commit | ba351131189efe64238463e2d8b8403f3f29d0ac (patch) | |
tree | 7b7b2d3902375200cd5a0c41b9523a8e8aaa880b | |
parent | package.mask: Last rite www-misc/wsmake (diff) | |
download | gentoo-ba351131189efe64238463e2d8b8403f3f29d0ac.tar.gz gentoo-ba351131189efe64238463e2d8b8403f3f29d0ac.tar.bz2 gentoo-ba351131189efe64238463e2d8b8403f3f29d0ac.zip |
dev-python/sip: Port to tomllib/tomli
Bug: https://bugs.gentoo.org/878671
Signed-off-by: Michał Górny <mgorny@gentoo.org>
-rw-r--r-- | dev-python/sip/files/sip-6.7.5-tomli.patch | 93 | ||||
-rw-r--r-- | dev-python/sip/sip-6.7.5-r1.ebuild (renamed from dev-python/sip/sip-6.7.5.ebuild) | 14 |
2 files changed, 105 insertions, 2 deletions
diff --git a/dev-python/sip/files/sip-6.7.5-tomli.patch b/dev-python/sip/files/sip-6.7.5-tomli.patch new file mode 100644 index 000000000000..c785e41f265a --- /dev/null +++ b/dev-python/sip/files/sip-6.7.5-tomli.patch @@ -0,0 +1,93 @@ +diff --git a/setup.py b/setup.py +index 586606d..312a431 100644 +--- a/setup.py ++++ b/setup.py +@@ -51,7 +51,7 @@ setup( + version=version, + license='SIP', + python_requires='>=3.7', +- install_requires=['packaging', 'ply', 'setuptools', 'toml'], ++ install_requires=['packaging', 'ply', 'setuptools', 'tomli; python_version<"3.11"'], + packages=find_packages(), + package_data={ + 'sipbuild.module': ['source/*/*'], +diff --git a/sip.egg-info/requires.txt b/sip.egg-info/requires.txt +index b465c08..8547535 100644 +--- a/sip.egg-info/requires.txt ++++ b/sip.egg-info/requires.txt +@@ -1,4 +1,4 @@ + packaging + ply + setuptools +-toml ++tomli; python_version<"3.11" +diff --git a/sipbuild/bindings_configuration.py b/sipbuild/bindings_configuration.py +index 8197e27..a942f3f 100644 +--- a/sipbuild/bindings_configuration.py ++++ b/sipbuild/bindings_configuration.py +@@ -22,11 +22,16 @@ + + + import os +-import toml ++import sys + + from .exceptions import UserFileException, UserParseException + from .module import resolve_abi_version + ++if sys.version_info >= (3, 11): ++ import tomllib ++else: ++ import tomli as tomllib ++ + + def get_bindings_configuration(abi_major, sip_file, sip_include_dirs): + """ Get the configuration of a set of bindings. """ +@@ -47,7 +52,8 @@ def get_bindings_configuration(abi_major, sip_file, sip_include_dirs): + + # Read the configuration. + try: +- cfg = toml.load(toml_file) ++ with open(toml_file, "rb") as f: ++ cfg = tomllib.load(f) + except Exception as e: + raise UserParseException(toml_file, detail=str(e)) + +diff --git a/sipbuild/pyproject.py b/sipbuild/pyproject.py +index 1ba2223..6e4a7c6 100644 +--- a/sipbuild/pyproject.py ++++ b/sipbuild/pyproject.py +@@ -22,11 +22,16 @@ + + + from collections import OrderedDict +-import toml ++import sys + + from .exceptions import UserFileException + from .py_versions import OLDEST_SUPPORTED_MINOR + ++if sys.version_info >= (3, 11): ++ import tomllib ++else: ++ import tomli as tomllib ++ + + class PyProjectException(UserFileException): + """ An exception related to a pyproject.toml file. """ +@@ -69,7 +74,8 @@ class PyProject: + self.toml_error = None + + try: +- self._pyproject = toml.load('pyproject.toml', _dict=OrderedDict) ++ with open('pyproject.toml', 'rb') as f: ++ self._pyproject = tomllib.load(f) + except FileNotFoundError: + self.toml_error = "there is no such file in the current directory" + except Exception as e: +@@ -174,4 +180,4 @@ class PyProject: + def _is_section(value): + """ Returns True if a section value is itself a section. """ + +- return isinstance(value, (OrderedDict, list)) ++ return isinstance(value, (OrderedDict, dict, list)) diff --git a/dev-python/sip/sip-6.7.5.ebuild b/dev-python/sip/sip-6.7.5-r1.ebuild index 139b26e4f7c4..a839024c9fa8 100644 --- a/dev-python/sip/sip-6.7.5.ebuild +++ b/dev-python/sip/sip-6.7.5-r1.ebuild @@ -5,10 +5,14 @@ EAPI=8 PYTHON_COMPAT=( python3_{9..11} ) DISTUTILS_USE_PEP517=setuptools + inherit distutils-r1 DESCRIPTION="Python bindings generator for C/C++ libraries" -HOMEPAGE="https://www.riverbankcomputing.com/software/sip/ https://pypi.org/project/sip/" +HOMEPAGE=" + https://www.riverbankcomputing.com/software/sip/ + https://pypi.org/project/sip/ +" MY_P=${PN}-${PV/_pre/.dev} if [[ ${PV} == *_pre* ]]; then @@ -28,7 +32,13 @@ RDEPEND=" dev-python/packaging[${PYTHON_USEDEP}] dev-python/ply[${PYTHON_USEDEP}] dev-python/setuptools[${PYTHON_USEDEP}] - dev-python/toml[${PYTHON_USEDEP}] + $(python_gen_cond_dep ' + dev-python/tomli[${PYTHON_USEDEP}] + ' 3.{8..10}) " distutils_enable_sphinx doc --no-autodoc + +PATCHES=( + "${FILESDIR}"/${P}-tomli.patch +) |