15
0
forked from pool/python-pylint

Fix .changes file, osc service runall source_validator

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pylint?expand=0&rev=173
This commit is contained in:
2025-06-12 12:41:56 +00:00
committed by Git OBS Bridge
commit 68125fbbf2
11 changed files with 3185 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.osc

3
pylint-3.2.5-gh.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7860e1f334c338e8400567df893ebe0934c162737f9bc22eb6f0a9c530a52cfc
size 1446535

3
pylint-3.2.6-gh.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:66c917c27c74b84d44aecacd9725defeb3ef51bdf916213e52c647f5545dda75
size 1447684

BIN
pylint-3.3.1-gh.tar.gz LFS Normal file

Binary file not shown.

3
pylint-3.3.6-gh.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a5a0f3da7beb89ef03fa4353e52fbf742daf2dea3dc57ef401957c2201dfeea5
size 1456483

BIN
pylint-3.3.7-gh.tar.gz LFS Normal file

Binary file not shown.

206
pytest-8.patch Normal file
View File

@@ -0,0 +1,206 @@
Index: pylint-3.2.6/pylint/testutils/configuration_test.py
===================================================================
--- pylint-3.2.6.orig/pylint/testutils/configuration_test.py
+++ pylint-3.2.6/pylint/testutils/configuration_test.py
@@ -12,7 +12,6 @@ import logging
import unittest
from pathlib import Path
from typing import Any, Dict
-from unittest.mock import Mock
from pylint.lint import Run
@@ -135,18 +134,15 @@ def get_expected_output(
def run_using_a_configuration_file(
configuration_path: Path | str, file_to_lint: str = __file__
-) -> tuple[Mock, Mock, Run]:
+) -> Run:
"""Simulate a run with a configuration without really launching the checks."""
configuration_path = str(configuration_path)
args = ["--rcfile", configuration_path, file_to_lint]
- # We do not capture the `SystemExit` as then the `runner` variable
- # would not be accessible outside the `with` block.
- with unittest.mock.patch("sys.exit") as mocked_exit:
- # Do not actually run checks, that could be slow. We don't mock
- # `PyLinter.check`: it calls `PyLinter.initialize` which is
- # needed to properly set up messages inclusion/exclusion
- # in `_msg_states`, used by `is_message_enabled`.
- check = "pylint.lint.pylinter.check_parallel"
- with unittest.mock.patch(check) as mocked_check_parallel:
- runner = Run(args)
- return mocked_exit, mocked_check_parallel, runner
+ # Do not actually run checks, that could be slow. We don't mock
+ # `PyLinter.check`: it calls `PyLinter.initialize` which is
+ # needed to properly set up messages inclusion/exclusion
+ # in `_msg_states`, used by `is_message_enabled`.
+ check = "pylint.lint.pylinter.check_parallel"
+ with unittest.mock.patch(check):
+ runner = Run(args, exit=False)
+ return runner
Index: pylint-3.2.6/requirements_test_min.txt
===================================================================
--- pylint-3.2.6.orig/requirements_test_min.txt
+++ pylint-3.2.6/requirements_test_min.txt
@@ -3,7 +3,7 @@
astroid==3.2.4 # Pinned to a specific version for tests
typing-extensions~=4.11
py~=1.11.0
-pytest~=7.4
+pytest~=8.2
pytest-benchmark~=4.0
pytest-timeout~=2.3
towncrier~=23.11
Index: pylint-3.2.6/tests/config/test_config.py
===================================================================
--- pylint-3.2.6.orig/tests/config/test_config.py
+++ pylint-3.2.6/tests/config/test_config.py
@@ -55,10 +55,8 @@ reports = "yes"
)
env_var = "tmp_path_env"
os.environ[env_var] = str(config_file)
- mock_exit, _, runner = run_using_a_configuration_file(
- f"${env_var}", file_to_lint_path
- )
- mock_exit.assert_called_once_with(0)
+ runner = run_using_a_configuration_file(f"${env_var}", file_to_lint_path)
+ assert runner.linter.msg_status == 0
check_configuration_file_reader(runner)
@@ -226,7 +224,7 @@ def test_disable_before_enable_all_takes
runner = Run(["--disable=fixme", "--enable=all", str(FIXME_MODULE)], exit=False)
assert not runner.linter.stats.by_msg
- _, _, toml_runner = run_using_a_configuration_file(
+ toml_runner = run_using_a_configuration_file(
HERE
/ "functional"
/ "toml"
@@ -239,7 +237,7 @@ def test_enable_before_disable_all_takes
runner = Run(["--enable=fixme", "--disable=all", str(FIXME_MODULE)], exit=False)
assert runner.linter.stats.by_msg
- _, _, toml_runner = run_using_a_configuration_file(
+ toml_runner = run_using_a_configuration_file(
HERE
/ "functional"
/ "toml"
Index: pylint-3.2.6/tests/config/test_functional_config_loading.py
===================================================================
--- pylint-3.2.6.orig/tests/config/test_functional_config_loading.py
+++ pylint-3.2.6/tests/config/test_functional_config_loading.py
@@ -57,10 +57,8 @@ def default_configuration(
) -> PylintConfiguration:
empty_pylintrc = tmp_path / "pylintrc"
empty_pylintrc.write_text("")
- mock_exit, _, runner = run_using_a_configuration_file(
- str(empty_pylintrc), file_to_lint_path
- )
- mock_exit.assert_called_once_with(0)
+ runner = run_using_a_configuration_file(str(empty_pylintrc), file_to_lint_path)
+ assert runner.linter.msg_status == 0
return runner.linter.config.__dict__
@@ -88,10 +86,8 @@ def test_functional_config_loading(
warnings.filterwarnings(
"ignore", message="The use of 'MASTER'.*", category=UserWarning
)
- mock_exit, _, runner = run_using_a_configuration_file(
- configuration_path, file_to_lint_path
- )
- mock_exit.assert_called_once_with(expected_code)
+ runner = run_using_a_configuration_file(configuration_path, file_to_lint_path)
+ assert runner.linter.msg_status == expected_code
out, err = capsys.readouterr()
# 'rstrip()' applied, so we can have a final newline in the expected test file
assert expected_output.rstrip() == out.rstrip(), msg
Index: pylint-3.2.6/tests/lint/unittest_lint.py
===================================================================
--- pylint-3.2.6.orig/tests/lint/unittest_lint.py
+++ pylint-3.2.6/tests/lint/unittest_lint.py
@@ -20,6 +20,7 @@ from pathlib import Path
from shutil import copy, rmtree
from unittest import mock
+import astroid
import platformdirs
import pytest
from astroid import nodes
@@ -1053,7 +1054,9 @@ def test_finds_pyi_file() -> None:
exit=False,
)
assert run.linter.current_file is not None
- assert run.linter.current_file.endswith("foo.pyi")
+ assert run.linter.current_file.endswith(
+ "a_module_that_we_definitely_dont_use_in_the_functional_tests.pyi"
+ )
def test_recursive_finds_pyi_file() -> None:
@@ -1068,7 +1071,9 @@ def test_recursive_finds_pyi_file() -> N
exit=False,
)
assert run.linter.current_file is not None
- assert run.linter.current_file.endswith("foo.pyi")
+ assert run.linter.current_file.endswith(
+ "a_module_that_we_definitely_dont_use_in_the_functional_tests.pyi"
+ )
def test_no_false_positive_from_pyi_stub() -> None:
@@ -1126,6 +1131,9 @@ def test_recursive_ignore(ignore_paramet
):
module = os.path.abspath(join(REGRTEST_DATA_DIR, *regrtest_data_module))
assert module in linted_file_paths
+ # We lint the modules in `regrtest` in other tests as well. Prevent test pollution by
+ # explicitly clearing the astroid caches.
+ astroid.MANAGER.clear_cache()
def test_source_roots_globbing() -> None:
Index: pylint-3.2.6/tests/regrtest_data/pyi/a_module_that_we_definitely_dont_use_in_the_functional_tests.pyi
===================================================================
--- /dev/null
+++ pylint-3.2.6/tests/regrtest_data/pyi/a_module_that_we_definitely_dont_use_in_the_functional_tests.pyi
@@ -0,0 +1,5 @@
+# This module is named in a particular way to prevent test pollution. It was previously named 'foo' and
+# all mentions of 'foo' were wrongly resolved to this stub file.
+foo = 1
+
+def three_item_iterable(): ...
Index: pylint-3.2.6/tests/regrtest_data/pyi/foo.pyi
===================================================================
--- pylint-3.2.6.orig/tests/regrtest_data/pyi/foo.pyi
+++ /dev/null
@@ -1,4 +0,0 @@
-foo = 1
-
-def three_item_iterable():
- ...
Index: pylint-3.2.6/tests/regrtest_data/uses_module_with_stub.py
===================================================================
--- pylint-3.2.6.orig/tests/regrtest_data/uses_module_with_stub.py
+++ pylint-3.2.6/tests/regrtest_data/uses_module_with_stub.py
@@ -1,5 +1,5 @@
"""If the stub is preferred over the .py, this might emit not-an-iterable"""
-from pyi.foo import three_item_iterable
+from pyi.a_module_that_we_definitely_dont_use_in_the_functional_tests import three_item_iterable
for val in three_item_iterable():
print(val)
Index: pylint-3.2.6/tests/regrtest_data/pyi/a_module_that_we_definitely_dont_use_in_the_functional_tests.py
===================================================================
--- /dev/null
+++ pylint-3.2.6/tests/regrtest_data/pyi/a_module_that_we_definitely_dont_use_in_the_functional_tests.py
@@ -0,0 +1,2 @@
+def three_item_iterable():
+ return [1, 2, 3]
Index: pylint-3.2.6/tests/regrtest_data/pyi/foo.py
===================================================================
--- pylint-3.2.6.orig/tests/regrtest_data/pyi/foo.py
+++ /dev/null
@@ -1,2 +0,0 @@
-def three_item_iterable():
- return [1, 2, 3]

2769
python-pylint.changes Normal file

File diff suppressed because it is too large Load Diff

136
python-pylint.spec Normal file
View File

@@ -0,0 +1,136 @@
#
# spec file for package python-pylint
#
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%bcond_without tests
%{?sle15_python_module_pythons}
Name: python-pylint
Version: 3.3.7
Release: 0
Summary: Syntax and style checker for Python code
License: GPL-2.0-or-later
URL: https://github.com/pylint-dev/pylint
# Tests are no longer packaged in the PyPI sdist, use GitHub archive
Source: https://github.com/pylint-dev/pylint/archive/refs/tags/v%{version}.tar.gz#/pylint-%{version}-gh.tar.gz
BuildRequires: %{python_module base >= 3.7.2}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-dill >= 0.3.7
Requires: python-platformdirs >= 2.2
Requires: python-tomlkit >= 0.10.1
Requires: (python-astroid >= 3.3.8 with python-astroid < 4.0.0~dev0)
Requires: (python-isort >= 4.2.5 with python-isort < 7)
Requires: (python-mccabe >= 0.6 with python-mccabe < 0.8)
%if 0%{?python_version_nodots} < 311
Requires: python-tomli >= 1.1.0
%endif
%if 0%{?python_version_nodots} < 310
Requires: python-typing-extensions >= 3.10
%endif
%if %{with tests}
# SECTION pylint deps
BuildRequires: %{python_module astroid >= 3.3.8 with %python-astroid < 4.0.0~dev0}
BuildRequires: %{python_module dill >= 0.3.7}
BuildRequires: %{python_module enchant}
BuildRequires: %{python_module isort >= 4.2.5 with %python-isort < 7}
BuildRequires: %{python_module mccabe >= 0.6 with %python-mccabe < 0.8}
BuildRequires: %{python_module platformdirs >= 2.2}
BuildRequires: %{python_module tomli >= 1.1.0 if %python-base < 3.11}
BuildRequires: %{python_module tomlkit >= 0.10.1}
BuildRequires: %{python_module typing-extensions >= 3.10 if %python-base < 3.10}
# /SECTION
# SECTION test deps
BuildRequires: %{python_module GitPython > 3}
BuildRequires: %{python_module pytest-rerunfailures}
BuildRequires: %{python_module pytest-timeout >= 2.2}
BuildRequires: %{python_module pytest-xdist}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module requests}
# /SECTION
%endif
Requires(post): update-alternatives
Requires(postun): update-alternatives
BuildArch: noarch
%python_subpackages
%description
Pylint analyzes Python source code looking for bugs and signs of poor
quality.
Pylint is a python tool that checks if a module satisfies a coding
standard. Pylint can be seen as another PyChecker since nearly all
tests you can do with PyChecker can also be done with Pylint. But
Pylint offers some more features, like checking line-code's length,
checking if variable names are well-formed according to your coding
standard, or checking if declared interfaces are truly implemented, and
much more (see the complete check list).
The big advantage with Pylint is that it is highly configurable,
customizable, and you can easily write a small plugin to add a personal
feature.
%prep
%autosetup -p1 -n pylint-%{version}
sed -i '1{/^#!/ d}' pylint/__main__.py
%build
export LC_ALL="en_US.UTF-8"
%pyproject_wheel
%install
export LC_ALL="en_US.UTF-8"
%pyproject_install
for p in pylint pyreverse symilar pylint-config ; do
%python_clone -a %{buildroot}%{_bindir}/$p
done
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%if %{with tests}
%check
export LC_ALL="en_US.UTF-8"
# reruns: tests/pyreverse is incredibly non-deterministic in failures
donttest="test_linter_with_unpickleable_plugins_is_pickleable"
# Fails with pytest-8 gh#pylint-dev/pylint#9545
donttest+=" or recursion_error_3159"
# Fails with python 3.12
donttest+=" or test_functional_relation_extraction"
# Broken upstream
donttest+=" or test_functional"
%pytest -n auto --ignore tests/benchmark --reruns 5 -rsfER -k "not ($donttest)"
%endif
%post
%python_install_alternative pylint pyreverse symilar pylint-config
%postun
%python_uninstall_alternative pylint
%files %{python_files}
%license LICENSE
%doc README.rst
%doc examples/
%python_alternative %{_bindir}/pylint
%python_alternative %{_bindir}/pylint-config
%python_alternative %{_bindir}/pyreverse
%python_alternative %{_bindir}/symilar
%{python_sitelib}/pylint/
%{python_sitelib}/pylint-%{version}.dist-info
%changelog

35
support-astroid-3.3.patch Normal file
View File

@@ -0,0 +1,35 @@
From 8afd218a922b9b572c508ada228b7ed27a607014 Mon Sep 17 00:00:00 2001
From: Jacob Walls <jacobtylerwalls@gmail.com>
Date: Sun, 4 Aug 2024 11:46:21 -0400
Subject: [PATCH 2/4] Bump astroid to 3.3.0
---
pyproject.toml | 2 +-
requirements_test_min.txt | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
Index: pylint-3.2.6/pyproject.toml
===================================================================
--- pylint-3.2.6.orig/pyproject.toml
+++ pylint-3.2.6/pyproject.toml
@@ -41,7 +41,7 @@ dependencies = [
# Also upgrade requirements_test_min.txt.
# Pinned to dev of second minor update to allow editable installs and fix primer issues,
# see https://github.com/pylint-dev/astroid/issues/1341
- "astroid>=3.2.4,<=3.3.0-dev0",
+ "astroid>=3.3.0,<=3.4.0-dev0",
"isort>=4.2.5,<6,!=5.13.0",
"mccabe>=0.6,<0.8",
"tomli>=1.1.0;python_version<'3.11'",
Index: pylint-3.2.6/requirements_test_min.txt
===================================================================
--- pylint-3.2.6.orig/requirements_test_min.txt
+++ pylint-3.2.6/requirements_test_min.txt
@@ -1,6 +1,6 @@
.[testutils,spelling]
# astroid dependency is also defined in pyproject.toml
-astroid==3.2.4 # Pinned to a specific version for tests
+astroid==3.3.0 # Pinned to a specific version for tests
typing-extensions~=4.11
py~=1.11.0
pytest~=8.2