Bug 2403562

Summary: python-astroid: Fails to build with setuptools 80.9.0 [ERROR in tests: UserWarning: pkg_resources is deprecated as an API]
Product: [Fedora] Fedora Reporter: Miro Hrončok <mhroncok>
Component: python-astroidAssignee: Gwyn Ciesla <gwync>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: gwync, orion
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2025-10-13 20:07:31 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2362565    

Description Miro Hrončok 2025-10-13 15:41:38 UTC
Dear package maintainer,

We want to update python-setuptools to 80.9.0 or newer.

However, your package fails to build with it, in our testing Copr:

https://copr.fedorainfracloud.org/coprs/churchyard/setuptools-80.9.0/package/python-astroid

To reproduce, try to build your package in mock with:

 $ fedpkg --release rawhide mockbuild -N -- --addrepo=https://download.copr.fedorainfracloud.org/results/churchyard/setuptools-80.9.0/fedora-rawhide-x86_64

As the number of failures is rather high, I have not yet tried to look into the details about each individual failure.
When you do, please feel free to post relevant part of the logs as comments.

Thank you. Let me know if you need help.

Comment 1 Miro Hrončok 2025-10-13 16:10:50 UTC
=================================== FAILURES ===================================
_______ AstroidManagerTest.test_identify_old_namespace_package_protocol ________

self = <tests.test_manager.AstroidManagerTest testMethod=test_identify_old_namespace_package_protocol>

    def test_identify_old_namespace_package_protocol(self) -> None:
        # Like the above cases, this package follows the old namespace package protocol
        # astroid currently assumes such packages are in sys.modules, so import it
        # pylint: disable-next=import-outside-toplevel
>       import tests.testdata.python3.data.path_pkg_resources_1.package.foo as _  # noqa

tests/test_manager.py:124: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/testdata/python3/data/path_pkg_resources_1/package/__init__.py:5: in <module>
    __import__("pkg_resources").declare_namespace(__name__)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    """
    Package resource API
    --------------------
    
    A resource is a logical file contained within a package, or a logical
    subdirectory thereof.  The package resource API expects resource names
    to have their path parts separated with ``/``, *not* whatever the local
    path separator is.  Do not use os.path operations to manipulate resource
    names being passed into the API.
    
    The package resource API is designed to work with normal filesystem packages,
    .egg files, and unpacked .egg files.  It can also work in a limited way with
    .zip files and with custom PEP 302 loaders that support the ``get_data()``
    method.
    
    This module is deprecated. Users are directed to :mod:`importlib.resources`,
    :mod:`importlib.metadata` and :pypi:`packaging` instead.
    """
    
    from __future__ import annotations
    
    import sys
    
    if sys.version_info < (3, 9):  # noqa: UP036 # Check for unsupported versions
        raise RuntimeError("Python 3.9 or later is required")
    
    import _imp
    import collections
    import email.parser
    import errno
    import functools
    import importlib
    import importlib.abc
    import importlib.machinery
    import inspect
    import io
    import ntpath
    import operator
    import os
    import pkgutil
    import platform
    import plistlib
    import posixpath
    import re
    import stat
    import tempfile
    import textwrap
    import time
    import types
    import warnings
    import zipfile
    import zipimport
    from collections.abc import Iterable, Iterator, Mapping, MutableSequence
    from pkgutil import get_importer
    from typing import (
        TYPE_CHECKING,
        Any,
        BinaryIO,
        Callable,
        Literal,
        NamedTuple,
        NoReturn,
        Protocol,
        TypeVar,
        Union,
        overload,
    )
    
    sys.path.extend(((vendor_path := os.path.join(os.path.dirname(os.path.dirname(__file__)), 'setuptools', '_vendor')) not in sys.path) * [vendor_path])  # fmt: skip
    # workaround for #4476
    sys.modules.pop('backports', None)
    
    # capture these to bypass sandboxing
    from os import open as os_open, utime  # isort: skip
    from os.path import isdir, split  # isort: skip
    
    try:
        from os import mkdir, rename, unlink
    
        WRITE_SUPPORT = True
    except ImportError:
        # no write support, probably under GAE
        WRITE_SUPPORT = False
    
    import packaging.markers
    import packaging.requirements
    import packaging.specifiers
    import packaging.utils
    import packaging.version
    from jaraco.text import drop_comment, join_continuation, yield_lines
    from platformdirs import user_cache_dir as _user_cache_dir
    
    if TYPE_CHECKING:
        from _typeshed import BytesPath, StrOrBytesPath, StrPath
        from _typeshed.importlib import LoaderProtocol
        from typing_extensions import Self, TypeAlias
    
>   warnings.warn(
        "pkg_resources is deprecated as an API. "
        "See https://setuptools.pypa.io/en/latest/pkg_resources.html. "
        "The pkg_resources package is slated for removal as early as "
        "2025-11-30. Refrain from using this package or pin to "
        "Setuptools<81.",
        UserWarning,
        stacklevel=2,
    )
E   UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.

/usr/lib/python3.14/site-packages/pkg_resources/__init__.py:98: UserWarning
=========================== short test summary info ============================
FAILED tests/test_manager.py::AstroidManagerTest::test_identify_old_namespace_package_protocol
=========== 1 failed, 1612 passed, 81 skipped, 15 xfailed in 19.89s ============