Switch from upstream deprecated pytoml to toml

This commit is contained in:
Miro Hrončok 2020-06-19 21:49:54 +02:00 committed by churchyard
parent 9789724e07
commit ed5dd772f3
3 changed files with 9 additions and 6 deletions

View File

@ -57,7 +57,7 @@ fi
%{-e:%{expand:%global toxenv %{-e*}}} %{-e:%{expand:%global toxenv %{-e*}}}
echo 'python3-devel' echo 'python3-devel'
echo 'python3dist(packaging)' echo 'python3dist(packaging)'
echo 'python3dist(pytoml)' echo 'python3dist(toml)'
# setuptools assumes no pre-existing dist-info # setuptools assumes no pre-existing dist-info
rm -rfv *.dist-info/ >&2 rm -rfv *.dist-info/ >&2
if [ -f %{__python3} ]; then if [ -f %{__python3} ]; then

View File

@ -6,7 +6,7 @@ License: MIT
# Keep the version at zero and increment only release # Keep the version at zero and increment only release
Version: 0 Version: 0
Release: 15%{?dist} Release: 16%{?dist}
# Macro files # Macro files
Source001: macros.pyproject Source001: macros.pyproject
@ -39,7 +39,7 @@ Requires: python3-devel
# But those are also always in the output of %%generate_buildrequires # But those are also always in the output of %%generate_buildrequires
# in order to be removable in the future # in order to be removable in the future
Requires: python3dist(packaging) Requires: python3dist(packaging)
Requires: python3dist(pytoml) Requires: python3dist(toml)
# This is not output from %%generate_buildrequires to work around: # This is not output from %%generate_buildrequires to work around:
# https://github.com/rpm-software-management/mock/issues/336 # https://github.com/rpm-software-management/mock/issues/336
@ -54,9 +54,9 @@ BuildRequires: python3dist(packaging)
# https://github.com/rpm-software-management/mock/issues/336 # https://github.com/rpm-software-management/mock/issues/336
BuildRequires: (python3dist(importlib-metadata) if python3 < 3.8) BuildRequires: (python3dist(importlib-metadata) if python3 < 3.8)
%endif %endif
BuildRequires: python3dist(pytoml)
BuildRequires: python3dist(pip) BuildRequires: python3dist(pip)
BuildRequires: python3dist(setuptools) BuildRequires: python3dist(setuptools)
BuildRequires: python3dist(toml)
BuildRequires: python3dist(tox-current-env) >= 0.0.2 BuildRequires: python3dist(tox-current-env) >= 0.0.2
BuildRequires: python3dist(wheel) BuildRequires: python3dist(wheel)
%endif %endif
@ -100,6 +100,9 @@ install -m 644 pyproject_save_files.py %{buildroot}%{_rpmconfigdir}/redhat/
%license LICENSE %license LICENSE
%changelog %changelog
* Fri Jun 19 2020 Miro Hrončok <mhroncok@redhat.com> - 0-16
- Switch from upstream deprecated pytoml to toml
* Thu May 07 2020 Tomas Hrnciar <thrnciar@redhat.com> - 0-15 * Thu May 07 2020 Tomas Hrnciar <thrnciar@redhat.com> - 0-15
- Adapt %%pyproject_install not to create a PEP 610 direct_url.json file - Adapt %%pyproject_install not to create a PEP 610 direct_url.json file

View File

@ -23,7 +23,7 @@ class EndPass(Exception):
try: try:
import pytoml import toml
from packaging.requirements import Requirement, InvalidRequirement from packaging.requirements import Requirement, InvalidRequirement
from packaging.utils import canonicalize_name, canonicalize_version from packaging.utils import canonicalize_name, canonicalize_version
try: try:
@ -129,7 +129,7 @@ def get_backend(requirements):
pyproject_data = {} pyproject_data = {}
else: else:
with f: with f:
pyproject_data = pytoml.load(f) pyproject_data = toml.load(f)
buildsystem_data = pyproject_data.get('build-system', {}) buildsystem_data = pyproject_data.get('build-system', {})
requirements.extend( requirements.extend(