Skip to content

Merge with distutils @55982565e #4298

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

Merged
merged 110 commits into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
e649e93
Fix accumulating flags after compile/link
dalcinl Feb 28, 2023
ef9a766
CI: Install git on Cygwin CI runner
DWesl Aug 6, 2023
aa3a996
CI: Try to fix Cygwin tox configuration.
DWesl Aug 6, 2023
222b249
Improve test_rfc822_escape, capturing interoperability requirements
abravalheri Aug 30, 2023
157fbfe
Improve TestMetadata, capturing interoperability requirements
abravalheri Aug 30, 2023
0ece987
Fix interoperability of rfc822_escape with stblib's email library
abravalheri Aug 30, 2023
a131f83
GNU: use -Wl,-rpath,<dir> instead of -Wl,-R<dir>
haampie Sep 26, 2023
ee263dc
Update URLs in documentation: http:// → https://
DimitriPapadopoulos Nov 16, 2023
67279f4
Merge https://github.com/jaraco/skeleton
jaraco Dec 1, 2023
35069ad
Merge https://github.com/jaraco/skeleton
jaraco Dec 5, 2023
5855b20
Merge https://github.com/jaraco/skeleton
jaraco Dec 23, 2023
16769f8
Merge https://github.com/jaraco/skeleton
jaraco Dec 26, 2023
ff32ae0
Copy 'missing_compiler_executable from Python 3.12 and customize it f…
jaraco Jan 6, 2024
5b6638d
Remove build and dist from excludes. It appears they are not needed a…
jaraco Jan 7, 2024
0148d7d
Mark this function as uncovered.
jaraco Jan 7, 2024
107eff1
Also disable the check
jaraco Jan 7, 2024
95afa60
Merge pull request #225 from pypa/debt/py312-missing-compiler
jaraco Jan 7, 2024
bc0abc4
Merge https://github.com/jaraco/skeleton
jaraco Jan 7, 2024
8806280
Merge branch 'main' into fix-cygwin-ci
jaraco Jan 7, 2024
c5a16ac
Remove pin on inflect as it's insufficient to avoid the Rust dependency.
jaraco Jan 7, 2024
53bfdb2
Merge pull request #211 from DWesl/fix-cygwin-ci
jaraco Jan 7, 2024
fb5c570
Merge pull request #213 from abravalheri/issue-setuptools-4033
jaraco Jan 7, 2024
ee021a1
Merge https://github.com/jaraco/skeleton
jaraco Feb 7, 2024
d9b4419
Fixes pypa/distutils#219 Use sysconfig.get_config_h_filename() to loc…
zooba Dec 12, 2023
d2ddf06
Also use sysconfig.get_config_h_filename() to implement distutils.sys…
zooba Dec 18, 2023
c976571
Merge remote-tracking branch 'upstream/main' into issue-219
zooba Jan 10, 2024
8ae78da
Merge pull request pypa/distutils#220 from zooba/issue-219
jaraco Feb 12, 2024
1bd78d0
Merge pull request pypa/distutils#218 from DimitriPapadopoulos/http
jaraco Feb 12, 2024
7f70d7d
👹 Feed the hobgoblins (delint).
jaraco Feb 12, 2024
a55a441
Add support for z/OS compilers; Fixes pypa/distutils#215
pitmanst Oct 2, 2023
88eb8cc
Extracted method for resolving python lib dir.
jaraco Oct 15, 2023
06d5663
Merge pull request pypa/distutils#216 from pitmanst/zos
jaraco Feb 12, 2024
7a321f8
Merge branch 'main' into feature/use-wl-rpath-instead-of-wl-r
jaraco Feb 13, 2024
0136c37
👹 Feed the hobgoblins (delint).
jaraco Feb 13, 2024
91cb327
Update more tests to match the new expectation.
jaraco Feb 13, 2024
0f23a0e
Rely on always_iterable to conditionally extend the lib_opts.
jaraco Feb 13, 2024
4504c68
Merge pull request #214 from haampie/feature/use-wl-rpath-instead-of-…
jaraco Feb 13, 2024
dcd70ba
Restore integration test with Setuptools
jaraco Feb 13, 2024
e651e53
Merge pull request pypa/distutils#207 from dalcinl/main
jaraco Feb 13, 2024
073eb37
Merge https://github.com/jaraco/skeleton
jaraco Mar 2, 2024
853d0f5
Extract a method for customizing the compiler for macOS.
jaraco Mar 2, 2024
9ce8a10
Convert comment to docstring; update wording.
jaraco Mar 2, 2024
e58492b
Create a fixture to patch-out compiler customization on macOS.
jaraco Mar 2, 2024
cc455d0
Utilize the fixture for disabling compiler customization on macOS for…
jaraco Mar 2, 2024
9e83319
Limit mutating global state and simply rely on functools.lru_cache to…
jaraco Mar 2, 2024
f60cd62
Merge pull request pypa/distutils#234 from pypa/quality/231-global-state
jaraco Mar 2, 2024
d5e758c
Merge https://github.com/jaraco/skeleton
jaraco Mar 2, 2024
bdbe5e3
In test_build_ext, expose Path objects and use a path builder to buil…
jaraco Mar 2, 2024
5365535
In support, specify encoding. Ref pypa/distutils#232.
jaraco Mar 2, 2024
ba09295
In test_build_py, rely on tree builder to build trees. Ref pypa/distu…
jaraco Mar 2, 2024
f5bc9d2
Specify encoding in util.byte_compile. Ref pypa/distutils#232.
jaraco Mar 2, 2024
66d9341
Rely on tree builder in test_build_scripts. Ref pypa/distutils#232.
jaraco Mar 2, 2024
b114102
Rely on Path object to replace the suffix, open the file, and count t…
jaraco Mar 2, 2024
3dcd436
Fix EncodingWarnings in test_core. Ref pypa/distutils#232.
jaraco Mar 2, 2024
cae489b
Ran pyupgrade for Python 3.8+ followed by ruff format.
jaraco Mar 2, 2024
b060f26
Rely on tree builder in test_dir_util. Ref pypa/distutils#232.
jaraco Mar 2, 2024
438b37a
Rely on tree builder and path objects. Ref pypa/distutils#232.
jaraco Mar 2, 2024
43ee1e2
Remove reliance on TempdirManager in test_file_util.
jaraco Mar 2, 2024
5c99806
Rely on tmp_path fixture directly.
jaraco Mar 2, 2024
e2c4a88
👹 Feed the hobgoblins (delint).
jaraco Mar 2, 2024
1e3fe05
Rely on tree builder. Ref pypa/distutils#232.
jaraco Mar 2, 2024
acff48d
Specify encoding in test_install. Ref pypa/distutils#232.
jaraco Mar 2, 2024
d3f79e2
Re-use write_sample_scripts in test_install_scripts. Ref pypa/distuti…
jaraco Mar 2, 2024
8b7cee8
Use Path objects in test_register. Ref pypa/distutils#232.
jaraco Mar 2, 2024
5377c33
Specify encoding in test_sdist. Ref pypa/distutils#232.
jaraco Mar 2, 2024
deb1593
Fix EncodingWarning in test_spawn. Ref pypa/distutils#232.
jaraco Mar 2, 2024
433bb4a
Fix EncodingWarnings in test_sdist. Ref pypa/distutils#232.
jaraco Mar 2, 2024
b6f0ec3
Rely on tree builder. Ref pypa/distutils#232.
jaraco Mar 2, 2024
826d6fd
Ran pyupgrade for Python 3.8+ followed by ruff format.
jaraco Mar 2, 2024
fb18880
Merge branch 'main' into debt/encoding-warnings
jaraco Mar 2, 2024
592b0d8
Suppress diffcov error.
jaraco Mar 2, 2024
7a7531b
Suppress more diffcov errors.
jaraco Mar 2, 2024
080d30c
Merge pull request pypa/distutils#235 from pypa/debt/encoding-warnings
jaraco Mar 2, 2024
4fd5128
Address EncodingWarning in ccompiler. Ref pypa/distutils#232.
jaraco Mar 2, 2024
03ec237
Fix EncodingWarnings in distutils/command/config.py. Ref pypa/distuti…
jaraco Mar 2, 2024
b894d6f
Fix EncodingWarnings in distutils/config.py. Ref pypa/distutils#232.
jaraco Mar 2, 2024
f0692cf
Fix EncodingWarnings in sdist.py. Ref pypa/distutils#232.
jaraco Mar 2, 2024
b420f2d
Fix EncodingWarnings in text_file.py. Ref pypa/distutils#232.
jaraco Mar 2, 2024
559a4f3
Fix EncodingWarnings in dist.py. Ref pypa/distutils#232.
jaraco Mar 2, 2024
61d103f
Fix EncodingWarning in cygwinccompiler. Ref pypa/distutils#232.
jaraco Mar 2, 2024
2b93ccc
Fix EncodingWarning in file_util. Ref pypa/distutils#232.
jaraco Mar 2, 2024
9508489
Suppress EncodingWarnings in pyfakefs. Ref pypa/distutils#232. Workar…
jaraco Mar 2, 2024
57d567d
Replaced deprecated cgi module with email module. Ref pypa/distutils#…
jaraco Mar 2, 2024
08699b6
Merge pull request pypa/distutils#236 from pypa/debt/encoding-warnings
jaraco Mar 2, 2024
3ff7b64
Fix exception reference in missing_compiler_executable. Ref pypa/dist…
jaraco Mar 3, 2024
38b58a5
Satisfy EncodingWarning by passing the encoding.
jaraco Mar 3, 2024
9b58da5
Revert "Suppress EncodingWarnings in pyfakefs. Ref pypa/distutils#232…
jaraco Apr 7, 2024
8cef624
Merge https://github.com/jaraco/skeleton
jaraco Apr 12, 2024
842cc23
Update readme to reflect current state.
jaraco Apr 12, 2024
62b9a8e
Apply ruff --select UP safe fixes.
jaraco Apr 12, 2024
f8ab1e8
Apply ruff --select UP unsafe fixes.
jaraco Apr 12, 2024
13b1f91
👹 Feed the hobgoblins (delint).
jaraco Apr 12, 2024
2415d50
👹 Feed the hobgoblins (delint).
jaraco Apr 12, 2024
1d11b1c
👹 Feed the hobgoblins (delint).
jaraco Apr 12, 2024
7c006d8
Remove unreachable branch
jaraco Apr 12, 2024
854780a
Extract method for comparing prerelease. Satisfies complexity check.
jaraco Apr 12, 2024
cec4ce5
Re-organize for brevity.
jaraco Apr 12, 2024
47db639
Rely on None==None and handle two cases together.
jaraco Apr 12, 2024
9390f46
Refresh RangeMap from jaraco.collections 5.0.1.
jaraco Apr 12, 2024
7414bc5
Ruff fixes B007.
jaraco Apr 12, 2024
448a2a1
👹 Feed the hobgoblins (delint).
jaraco Apr 12, 2024
a53e425
Fix B026 by moving star arg ahead of keyword arg.
jaraco Apr 12, 2024
db216f4
Extract 'make_iterable' for upload and register commands, avoiding ma…
jaraco Apr 12, 2024
9f2922d
Fix pointless comparison (B015).
jaraco Apr 12, 2024
0543254
Remove Python 3.7 compatibility from build_ext
jaraco Apr 12, 2024
6b6633a
Remove Python 3.7 compatibility from test_sysconfig.
jaraco Apr 12, 2024
5598256
Move comment nearer the skip directive. Update wording.
jaraco Apr 12, 2024
7da5919
Merge https://github.com/pypa/distutils
jaraco Apr 12, 2024
48919ee
Add news fragment.
jaraco Apr 12, 2024
6969162
Omit distutils from coverage checks.
jaraco Apr 12, 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
1 change: 1 addition & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
omit =
# leading `*/` for pytest-dev/pytest-cov#456
*/.tox/*
*/setuptools/_distutils/*
disable_warnings =
couldnt-parse

Expand Down
2 changes: 1 addition & 1 deletion docs/deprecated/distutils/apiref.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,7 @@ directories.

Files in *src* that begin with :file:`.nfs` are skipped (more information on
these files is available in answer D2 of the `NFS FAQ page
<http://nfs.sourceforge.net/#section_d>`_).
<https://nfs.sourceforge.net/#section_d>`_).

.. versionchanged:: 3.3.1
NFS files are ignored.
Expand Down
2 changes: 1 addition & 1 deletion docs/deprecated/distutils/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -335,4 +335,4 @@ loads its values::
.. % \section{Putting it all together}


.. _docutils: http://docutils.sourceforge.net
.. _docutils: https://docutils.sourceforge.io
2 changes: 1 addition & 1 deletion docs/deprecated/distutils/setupscript.rst
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ Notes:

'long string'
Multiple lines of plain text in reStructuredText format (see
http://docutils.sourceforge.net/).
https://docutils.sourceforge.io/).

'list of strings'
See below.
Expand Down
1 change: 1 addition & 0 deletions newsfragments/4298.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Merged with pypa/distutils@55982565e, including interoperability improvements for rfc822_escape (pypa/distutils#213), dynamic resolution of config_h_filename for Python 3.13 compatibility (pypa/distutils#219), added support for the z/OS compiler (pypa/distutils#216), modernized compiler options in unixcompiler (pypa/distutils#214), fixed accumulating flags bug after compile/link (pypa/distutils#207), fixed enconding warnings (pypa/distutils#236), and general quality improvements (pypa/distutils#234).
2 changes: 1 addition & 1 deletion setuptools/_distutils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import sys
import importlib
import sys

__version__, _, _ = sys.version.partition(' ')

Expand Down
17 changes: 13 additions & 4 deletions setuptools/_distutils/_collections.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
from __future__ import annotations

import collections
import functools
import itertools
import operator
from collections.abc import Mapping
from typing import Any


# from jaraco.collections 3.5.1
Expand Down Expand Up @@ -58,7 +62,7 @@ def __len__(self):
return len(list(iter(self)))


# from jaraco.collections 3.7
# from jaraco.collections 5.0.1
class RangeMap(dict):
"""
A dictionary-like object that uses the keys as bounds for a range.
Expand All @@ -70,7 +74,7 @@ class RangeMap(dict):
One may supply keyword parameters to be passed to the sort function used
to sort keys (i.e. key, reverse) as sort_params.

Let's create a map that maps 1-3 -> 'a', 4-6 -> 'b'
Create a map that maps 1-3 -> 'a', 4-6 -> 'b'

>>> r = RangeMap({3: 'a', 6: 'b'}) # boy, that was easy
>>> r[1], r[2], r[3], r[4], r[5], r[6]
Expand All @@ -82,7 +86,7 @@ class RangeMap(dict):
>>> r[4.5]
'b'

But you'll notice that the way rangemap is defined, it must be open-ended
Notice that the way rangemap is defined, it must be open-ended
on one side.

>>> r[0]
Expand Down Expand Up @@ -140,7 +144,12 @@ class RangeMap(dict):

"""

def __init__(self, source, sort_params={}, key_match_comparator=operator.le):
def __init__(
self,
source,
sort_params: Mapping[str, Any] = {},
key_match_comparator=operator.le,
):
dict.__init__(self, source)
self.sort_params = sort_params
self.match = key_match_comparator
Expand Down
52 changes: 52 additions & 0 deletions setuptools/_distutils/_itertools.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# from more_itertools 10.2
def always_iterable(obj, base_type=(str, bytes)):
"""If *obj* is iterable, return an iterator over its items::

>>> obj = (1, 2, 3)
>>> list(always_iterable(obj))
[1, 2, 3]

If *obj* is not iterable, return a one-item iterable containing *obj*::

>>> obj = 1
>>> list(always_iterable(obj))
[1]

If *obj* is ``None``, return an empty iterable:

>>> obj = None
>>> list(always_iterable(None))
[]

By default, binary and text strings are not considered iterable::

>>> obj = 'foo'
>>> list(always_iterable(obj))
['foo']

If *base_type* is set, objects for which ``isinstance(obj, base_type)``
returns ``True`` won't be considered iterable.

>>> obj = {'a': 1}
>>> list(always_iterable(obj)) # Iterate over the dict's keys
['a']
>>> list(always_iterable(obj, base_type=dict)) # Treat dicts as a unit
[{'a': 1}]

Set *base_type* to ``None`` to avoid any special handling and treat objects
Python considers iterable as iterable:

>>> obj = 'foo'
>>> list(always_iterable(obj, base_type=None))
['f', 'o', 'o']
"""
if obj is None:
return iter(())

if (base_type is not None) and isinstance(obj, base_type):
return iter((obj,))

try:
return iter(obj)
except TypeError:
return iter((obj,))
1 change: 0 additions & 1 deletion setuptools/_distutils/_log.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import logging


log = logging.getLogger()
2 changes: 1 addition & 1 deletion setuptools/_distutils/_macos_compat.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import sys
import importlib
import sys


def bypass_compiler_fixup(cmd, args):
Expand Down
2 changes: 1 addition & 1 deletion setuptools/_distutils/_modified.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import functools
import os.path

from ._functools import splat
from .errors import DistutilsFileError
from .py39compat import zip_strict
from ._functools import splat


def _newer(source, target):
Expand Down
16 changes: 8 additions & 8 deletions setuptools/_distutils/_msvccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,28 @@
# ported to VS 2005 and VS 2008 by Christian Heimes
# ported to VS 2015 by Steve Dower

import contextlib
import os
import subprocess
import contextlib
import warnings
import unittest.mock as mock
import warnings

with contextlib.suppress(ImportError):
import winreg

from itertools import count

from ._log import log
from .ccompiler import CCompiler, gen_lib_options
from .errors import (
CompileError,
DistutilsExecError,
DistutilsPlatformError,
CompileError,
LibError,
LinkError,
)
from .ccompiler import CCompiler, gen_lib_options
from ._log import log
from .util import get_platform

from itertools import count


def _find_vc2015():
try:
Expand Down Expand Up @@ -253,7 +253,7 @@ def initialize(self, plat_name=None):
vc_env = _get_vc_env(plat_spec)
if not vc_env:
raise DistutilsPlatformError(
"Unable to find a compatible " "Visual Studio installation."
"Unable to find a compatible Visual Studio installation."
)
self._configure(vc_env)

Expand Down
6 changes: 3 additions & 3 deletions setuptools/_distutils/archive_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@
that sort of thing)."""

import os
from warnings import warn
import sys
from warnings import warn

try:
import zipfile
except ImportError:
zipfile = None


from ._log import log
from .dir_util import mkpath
from .errors import DistutilsExecError
from .spawn import spawn
from .dir_util import mkpath
from ._log import log

try:
from pwd import getpwnam
Expand Down
16 changes: 6 additions & 10 deletions setuptools/_distutils/bcppcompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,20 @@
# someone should sit down and factor out the common code as
# WindowsCCompiler! --GPW


import os
import warnings

from ._log import log
from ._modified import newer
from .ccompiler import CCompiler, gen_preprocess_options
from .errors import (
DistutilsExecError,
CompileError,
DistutilsExecError,
LibError,
LinkError,
UnknownFileError,
)
from .ccompiler import CCompiler, gen_preprocess_options
from .file_util import write_file
from ._modified import newer
from ._log import log


warnings.warn(
"bcppcompiler is deprecated and slated to be removed "
Expand Down Expand Up @@ -239,7 +237,7 @@ def link( # noqa: C901
def_file = os.path.join(temp_dir, '%s.def' % modname)
contents = ['EXPORTS']
for sym in export_symbols or []:
contents.append(' {}=_{}'.format(sym, sym))
contents.append(f' {sym}=_{sym}')
self.execute(write_file, (def_file, contents), "writing %s" % def_file)

# Borland C++ has problems with '/' in paths
Expand Down Expand Up @@ -349,9 +347,7 @@ def object_filenames(self, source_filenames, strip_dir=0, output_dir=''):
# use normcase to make sure '.rc' is really '.rc' and not '.RC'
(base, ext) = os.path.splitext(os.path.normcase(src_name))
if ext not in (self.src_extensions + ['.rc', '.res']):
raise UnknownFileError(
"unknown file type '{}' (from '{}')".format(ext, src_name)
)
raise UnknownFileError(f"unknown file type '{ext}' (from '{src_name}')")
if strip_dir:
base = os.path.basename(base)
if ext == '.res':
Expand Down
Loading