Remove support for Python 3.7 from %pyproject_buildrequires

Fedora 31 is EOL and was the last one with Python 3.7 packages.
EL 8 has Python 3.6 but doesn'T have %generate_buildrequires.
This commit is contained in:
Miro Hrončok 2021-02-02 23:03:27 +01:00
parent 59d092e9dd
commit 390b9713aa
4 changed files with 9 additions and 22 deletions

View File

@ -85,10 +85,6 @@ fi
echo 'python%{python3_pkgversion}-devel'
echo 'python%{python3_pkgversion}dist(pip) >= 19'
echo 'python%{python3_pkgversion}dist(packaging)'
# The first part is for cases when %%{python3_version_nodots} is not yet available
if [ ! -z "%{?python3_version_nodots}" ] && [ %{python3_version_nodots} -lt 38 ]; then
echo 'python%{python3_pkgversion}dist(importlib-metadata)'
fi
# Check if we can generate dependencies on Python extras
if [ "%{py_dist_name []}" == "[]" ]; then
extras_flag=%{?!_python_no_extras_requires:--generate-extras}

View File

@ -6,7 +6,7 @@ License: MIT
# Keep the version at zero and increment only release
Version: 0
Release: 36%{?dist}
Release: 37%{?dist}
# Macro files
Source001: macros.pyproject
@ -39,11 +39,6 @@ BuildArch: noarch
BuildRequires: python3dist(pytest)
BuildRequires: python3dist(pyyaml)
BuildRequires: python3dist(packaging)
%if 0%{fedora} < 32
# The %%if should not be needed, it works around:
# https://github.com/rpm-software-management/mock/issues/336
BuildRequires: (python3dist(importlib-metadata) if python3 < 3.8)
%endif
BuildRequires: python3dist(pip)
BuildRequires: python3dist(setuptools)
BuildRequires: python3dist(toml)
@ -109,6 +104,9 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856
%license LICENSE
%changelog
* Tue Feb 02 2021 Miro Hrončok <mhroncok@redhat.com> - 0-37
- Remove support for Python 3.7 from %%pyproject_buildrequires
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0-36
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

View File

@ -1,6 +1,6 @@
import os
import sys
import importlib
import importlib.metadata
import argparse
import functools
import traceback
@ -25,10 +25,6 @@ class EndPass(Exception):
try:
from packaging.requirements import Requirement, InvalidRequirement
from packaging.utils import canonicalize_name, canonicalize_version
try:
import importlib.metadata as importlib_metadata
except ImportError:
import importlib_metadata
except ImportError as e:
print_err('Import error:', e)
# already echoed by the %pyproject_buildrequires macro
@ -100,7 +96,7 @@ class Requirements:
try:
# TODO: check if requirements with extras are satisfied
installed = self.get_installed_version(requirement.name)
except importlib_metadata.PackageNotFoundError:
except importlib.metadata.PackageNotFoundError:
print_err(f'Requirement not satisfied: {requirement_str}')
installed = None
if installed and installed in requirement.specifier:
@ -282,7 +278,7 @@ def python3dist(name, op=None, version=None, python3_pkgversion="3"):
def generate_requires(
*, include_runtime=False, toxenv=None, extras=None,
get_installed_version=importlib_metadata.version, # for dep injection
get_installed_version=importlib.metadata.version, # for dep injection
generate_extras=False, python3_pkgversion="3",
):
"""Generate the BuildRequires for the project in the current directory

View File

@ -1,4 +1,5 @@
from pathlib import Path
import importlib.metadata
import io
import pytest
@ -6,10 +7,6 @@ import yaml
from pyproject_buildrequires import generate_requires
try:
import importlib.metadata as importlib_metadata
except ImportError:
import importlib_metadata
testcases = {}
with Path(__file__).parent.joinpath('pyproject_buildrequires_testcases.yaml').open() as f:
@ -35,7 +32,7 @@ def test_data(case_name, capsys, tmp_path, monkeypatch):
try:
return str(case['installed'][dist_name])
except (KeyError, TypeError):
raise importlib_metadata.PackageNotFoundError(
raise importlib.metadata.PackageNotFoundError(
f'info not found for {dist_name}'
)