Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge with pypa/distutils@c97a3db2f #4778

Merged
merged 48 commits into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
3fc912a
Use minimum requirement for jaraco.functools
anderstheet Oct 8, 2024
22e845b
use a real boolean (False) default for display_option_names generated…
Avasam Oct 17, 2024
68cb6ba
Accept an `Iterable` at runtime for `Extension`
agriyakhetarpal Nov 6, 2024
115bb67
Add more tests to cover different iterables
agriyakhetarpal Nov 6, 2024
4a467fa
Delegate to `os.fspath` for type checking
agriyakhetarpal Nov 6, 2024
2930193
Fix typo
agriyakhetarpal Nov 6, 2024
ff9c684
Return real boolean from copy_file
Avasam Oct 28, 2024
9c1bec6
Fix test_mkpath_exception_uncached
Avasam Nov 24, 2024
89627a7
Set `Py_GIL_DISABLED=1` for free threading on Windows
colesbury Nov 1, 2024
de1e624
Link to setuptools issue
colesbury Nov 1, 2024
52848a0
Trim the comment a bit.
jaraco Dec 26, 2024
ed45e7b
Merge pull request pypa/distutils#310 from colesbury.
jaraco Dec 26, 2024
ace1ab0
Merge pull request pypa/distutils#301 from anderstheet/feature/300-mi…
jaraco Dec 26, 2024
6608fd5
Merge pull request pypa/distutils#303 from Avasam/patch-1
jaraco Dec 26, 2024
0bf7c1a
Merge pull request pypa/distutils#309 from Avasam/copy_file-return-re…
jaraco Dec 26, 2024
468532e
👹 Feed the hobgoblins (delint).
jaraco Dec 26, 2024
bbee59b
Use alternate spelling for flavor attribute.
jaraco Dec 26, 2024
a7fdc06
Only apply workaround on required Pythons.
jaraco Dec 26, 2024
01fbd65
Let pathlib resolve the flavor.
jaraco Dec 26, 2024
be28187
Merge pull request pypa/distutils#316 from Avasam/fix-test_mkpath_exc…
jaraco Dec 26, 2024
b24919b
👹 Feed the hobgoblins (delint).
jaraco Dec 26, 2024
1bae350
Run Ruff 0.8.0
Avasam Nov 24, 2024
f5b7336
Add review suggestions around code comments
agriyakhetarpal Dec 26, 2024
efeb97c
Use `TypeError` instead of `AssertionError`
agriyakhetarpal Dec 26, 2024
a9f832b
Merge pull request pypa/distutils#314 from Avasam/Ruff-0.8.0
jaraco Dec 26, 2024
a88eace
UP031 manual fixes for Ruff 0.8.0
Avasam Nov 24, 2024
2017969
Make reinitialize_command's return type Generic when "command" argume…
Avasam Oct 28, 2024
2a01f31
Coerce Distribution.script_args to list
Avasam Nov 25, 2024
ac54856
Remove py38 compat modules
Avasam Nov 24, 2024
e6d3191
Merge pull request pypa/distutils#308 from Avasam/Generic-reinitializ…
jaraco Dec 27, 2024
a9bc2fc
Merge branch 'main' into Remove-py38-compat-modules
jaraco Dec 27, 2024
4e6e8fc
Remove UP036 exclusion.
jaraco Dec 27, 2024
fc15d45
Prefer the standard format for imports, even though it's unnecessaril…
jaraco Dec 27, 2024
c375e92
Merge pull request pypa/distutils#315 from Avasam/Remove-py38-compat-…
jaraco Dec 27, 2024
d266359
Merge branch 'main' into Ruff-0.8.0-UP031-manual-fixes
jaraco Dec 27, 2024
22b61d9
Merge pull request pypa/distutils#317 from Avasam/Ruff-0.8.0-UP031-ma…
jaraco Dec 27, 2024
deb1d5a
type `Distribution.get_command_obj` to not return `None` with `create…
Avasam Oct 25, 2024
7a9bbd5
Merge pull request pypa/distutils#320 from Avasam/type-script_args
jaraco Dec 27, 2024
9d9887d
ClassVar classvar mutables and tuple from typeshed
Avasam Dec 27, 2024
b0aea96
Merge pull request pypa/distutils#311 from agriyakhetarpal/types/exte…
jaraco Dec 27, 2024
cebba7f
👹 Feed the hobgoblins (delint).
jaraco Dec 27, 2024
cfc8c4a
Merge pull request pypa/distutils#307 from Avasam/get_command_obj-ove…
jaraco Dec 27, 2024
a8eec20
Merge pull request pypa/distutils#319 from Avasam/classvar-mutables-a…
jaraco Dec 27, 2024
af7fcbb
Use CFLAGS if set as-is, match CXXFLAGS behavior
thesamesam Dec 22, 2024
630551a
👹 Feed the hobgoblins (delint).
jaraco Dec 27, 2024
c97a3db
Merge pull request pypa/distutils#322 from thesamesam/cflags
jaraco Dec 27, 2024
d8e7caa
Merge pypa/distutils@c97a3db2f
jaraco Dec 27, 2024
2296e9f
Add news fragment.
jaraco Dec 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions distutils/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
import os
import re
import sys
from typing import TypeVar, overload
from collections.abc import Callable
from typing import Any, ClassVar, TypeVar, overload

from . import _modified, archive_util, dir_util, file_util, util
from ._log import log
Expand Down Expand Up @@ -49,7 +50,14 @@ class Command:
# 'sub_commands' is usually defined at the *end* of a class, because
# predicates can be unbound methods, so they must already have been
# defined. The canonical example is the "install" command.
sub_commands = []
sub_commands: ClassVar[ # Any to work around variance issues
list[tuple[str, Callable[[Any], bool] | None]]
] = []

user_options: ClassVar[
# Specifying both because list is invariant. Avoids mypy override assignment issues
list[tuple[str, str, str]] | list[tuple[str, str | None, str]]
] = []

# -- Creation/initialization methods -------------------------------

Expand Down
5 changes: 3 additions & 2 deletions distutils/command/bdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import os
import warnings
from typing import ClassVar

from ..core import Command
from ..errors import DistutilsOptionError, DistutilsPlatformError
Expand All @@ -23,7 +24,7 @@ def show_formats():
pretty_printer.print_help("List of available distribution formats:")


class ListCompat(dict):
class ListCompat(dict[str, tuple[str, str]]):
# adapter to allow for Setuptools compatibility in format_commands
def append(self, item):
warnings.warn(
Expand Down Expand Up @@ -70,7 +71,7 @@ class bdist(Command):
]

# The following commands do not take a format option from bdist
no_format_option = ('bdist_rpm',)
no_format_option: ClassVar[tuple[str, ...]] = ('bdist_rpm',)

# This won't do in reality: will need to distinguish RPM-ish Linux,
# Debian-ish Linux, Solaris, FreeBSD, ..., Windows, Mac OS.
Expand Down
3 changes: 2 additions & 1 deletion distutils/command/build_clib.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import os
from distutils._log import log
from typing import ClassVar

from ..core import Command
from ..errors import DistutilsSetupError
Expand All @@ -31,7 +32,7 @@ def show_compilers():
class build_clib(Command):
description = "build C/C++ libraries used by Python extensions"

user_options = [
user_options: ClassVar[list[tuple[str, str, str]]] = [
('build-clib=', 'b', "directory to build C/C++ libraries to"),
('build-temp=', 't', "directory to put temporary build by-products"),
('debug', 'g', "compile with debugging information"),
Expand Down
3 changes: 2 additions & 1 deletion distutils/command/build_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from distutils import sysconfig
from distutils._log import log
from stat import ST_MODE
from typing import ClassVar

from .._modified import newer
from ..core import Command
Expand All @@ -25,7 +26,7 @@
class build_scripts(Command):
description = "\"build\" scripts (copy and fixup #! line)"

user_options = [
user_options: ClassVar[list[tuple[str, str, str]]] = [
('build-dir=', 'd', "directory to \"build\" (copy) to"),
('force', 'f', "forcibly build everything (ignore file timestamps"),
('executable=', 'e', "specify final destination interpreter path"),
Expand Down
3 changes: 2 additions & 1 deletion distutils/command/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""

import contextlib
from typing import ClassVar

from ..core import Command
from ..errors import DistutilsSetupError
Expand Down Expand Up @@ -41,7 +42,7 @@ class check(Command):
"""This command checks the meta-data of the package."""

description = "perform some checks on the package"
user_options = [
user_options: ClassVar[list[tuple[str, str, str]]] = [
('metadata', 'm', 'Verify meta-data'),
(
'restructuredtext',
Expand Down
8 changes: 4 additions & 4 deletions distutils/command/command_template
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ Implements the Distutils 'x' command.
__revision__ = "$Id$"

from distutils.core import Command
from typing import ClassVar


class x(Command):

# Brief (40-50 characters) description of the command
description = ""

# List of option tuples: long name, short name (None if no short
# name), and help string.
user_options = [('', '',
""),
]
user_options: ClassVar[list[tuple[str, str, str]]] = [
('', '', ""),
]

def initialize_options(self):
self. = None
Expand Down
3 changes: 2 additions & 1 deletion distutils/command/install_egg_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import os
import re
import sys
from typing import ClassVar

from .. import dir_util
from .._log import log
Expand All @@ -18,7 +19,7 @@ class install_egg_info(Command):
"""Install an .egg-info file for the package"""

description = "Install package's PKG-INFO metadata as an .egg-info file"
user_options = [
user_options: ClassVar[list[tuple[str, str, str]]] = [
('install-dir=', 'd', "directory to install to"),
]

Expand Down
4 changes: 3 additions & 1 deletion distutils/command/install_headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@
Implements the Distutils 'install_headers' command, to install C/C++ header
files to the Python include directory."""

from typing import ClassVar

from ..core import Command


# XXX force is never used
class install_headers(Command):
description = "install C/C++ header files"

user_options = [
user_options: ClassVar[list[tuple[str, str, str]]] = [
('install-dir=', 'd', "directory to install header files to"),
('force', 'f', "force installation (overwrite existing files)"),
]
Expand Down
3 changes: 2 additions & 1 deletion distutils/command/sdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from distutils._log import log
from glob import glob
from itertools import filterfalse
from typing import ClassVar

from ..core import Command
from ..errors import DistutilsOptionError, DistutilsTemplateError
Expand Down Expand Up @@ -114,7 +115,7 @@ def checking_metadata(self):

sub_commands = [('check', checking_metadata)]

READMES = ('README', 'README.txt', 'README.rst')
READMES: ClassVar[tuple[str, ...]] = ('README', 'README.txt', 'README.rst')

def initialize_options(self):
# 'template' and 'manifest' are, respectively, the names of
Expand Down
3 changes: 2 additions & 1 deletion distutils/tests/test_dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from distutils.cmd import Command
from distutils.dist import Distribution, fix_help_options
from distutils.tests import support
from typing import ClassVar

import jaraco.path
import pytest
Expand All @@ -23,7 +24,7 @@
class test_dist(Command):
"""Sample distutils extension command."""

user_options = [
user_options: ClassVar[list[tuple[str, str, str]]] = [
("sample-option=", "S", "help text"),
]

Expand Down