From c789d66237eb9b3a12683d428ed5451d89549368 Mon Sep 17 00:00:00 2001 From: Scott K Logan Date: Thu, 27 Aug 2026 17:50:06 -0500 Subject: [PATCH] Address several flake8 issues Two classes here: 1. Drop unnecessary scope qualifiers identified by newer versions 2. Deal with the fact that distutils is no longer part of the stdlib --- .../package_augmentation/python_setup_py.py | 1 - .../package_identification/python_setup_py.py | 7 +++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/colcon_python_setup_py/package_augmentation/python_setup_py.py b/colcon_python_setup_py/package_augmentation/python_setup_py.py index b401440..99cb7b6 100644 --- a/colcon_python_setup_py/package_augmentation/python_setup_py.py +++ b/colcon_python_setup_py/package_augmentation/python_setup_py.py @@ -55,7 +55,6 @@ def augment_package( # noqa: D102 desc.dependencies) def getter(env): - nonlocal setup_py return get_setup_information(setup_py, env=env) desc.metadata['get_python_setup_options'] = getter diff --git a/colcon_python_setup_py/package_identification/python_setup_py.py b/colcon_python_setup_py/package_identification/python_setup_py.py index 466e68d..07c6898 100644 --- a/colcon_python_setup_py/package_identification/python_setup_py.py +++ b/colcon_python_setup_py/package_identification/python_setup_py.py @@ -6,9 +6,9 @@ with suppress(ImportError): # needed before importing distutils # to avoid warning introduced in setuptools 49.2.0 - import setuptools -import distutils.core -import os + import setuptools # noqa: I100 +import distutils.core # noqa: I100, I201, I202 +import os # noqa: I100, I201, I202 from pathlib import Path import runpy import subprocess @@ -238,7 +238,6 @@ def get_setup_information(setup_py, *, env=None): :return: dictionary of data describing the package. :raise: RuntimeError if the setup script encountered an error """ - global _setup_information_cache if env is None: env = os.environ if 'DISTUTILS_DEBUG' in env: