Skip to content

Commit 6301f8b

Browse files
authored
Merge pull request pypa#4298 from pypa/feature/distutils-55982565e
Merge with distutils @55982565e
2 parents 92b45e9 + 6969162 commit 6301f8b

File tree

102 files changed

+1447
-1258
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+1447
-1258
lines changed

.coveragerc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
omit =
33
# leading `*/` for pytest-dev/pytest-cov#456
44
*/.tox/*
5+
*/setuptools/_distutils/*
56
disable_warnings =
67
couldnt-parse
78

docs/deprecated/distutils/apiref.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1021,7 +1021,7 @@ directories.
10211021

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

10261026
.. versionchanged:: 3.3.1
10271027
NFS files are ignored.

docs/deprecated/distutils/examples.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,4 +335,4 @@ loads its values::
335335
.. % \section{Putting it all together}
336336
337337
338-
.. _docutils: http://docutils.sourceforge.net
338+
.. _docutils: https://docutils.sourceforge.io

docs/deprecated/distutils/setupscript.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ Notes:
644644

645645
'long string'
646646
Multiple lines of plain text in reStructuredText format (see
647-
http://docutils.sourceforge.net/).
647+
https://docutils.sourceforge.io/).
648648

649649
'list of strings'
650650
See below.

newsfragments/4298.feature.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
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).

setuptools/_distutils/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import sys
21
import importlib
2+
import sys
33

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

setuptools/_distutils/_collections.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
from __future__ import annotations
2+
13
import collections
24
import functools
35
import itertools
46
import operator
7+
from collections.abc import Mapping
8+
from typing import Any
59

610

711
# from jaraco.collections 3.5.1
@@ -58,7 +62,7 @@ def __len__(self):
5862
return len(list(iter(self)))
5963

6064

61-
# from jaraco.collections 3.7
65+
# from jaraco.collections 5.0.1
6266
class RangeMap(dict):
6367
"""
6468
A dictionary-like object that uses the keys as bounds for a range.
@@ -70,7 +74,7 @@ class RangeMap(dict):
7074
One may supply keyword parameters to be passed to the sort function used
7175
to sort keys (i.e. key, reverse) as sort_params.
7276
73-
Let's create a map that maps 1-3 -> 'a', 4-6 -> 'b'
77+
Create a map that maps 1-3 -> 'a', 4-6 -> 'b'
7478
7579
>>> r = RangeMap({3: 'a', 6: 'b'}) # boy, that was easy
7680
>>> r[1], r[2], r[3], r[4], r[5], r[6]
@@ -82,7 +86,7 @@ class RangeMap(dict):
8286
>>> r[4.5]
8387
'b'
8488
85-
But you'll notice that the way rangemap is defined, it must be open-ended
89+
Notice that the way rangemap is defined, it must be open-ended
8690
on one side.
8791
8892
>>> r[0]
@@ -140,7 +144,12 @@ class RangeMap(dict):
140144
141145
"""
142146

143-
def __init__(self, source, sort_params={}, key_match_comparator=operator.le):
147+
def __init__(
148+
self,
149+
source,
150+
sort_params: Mapping[str, Any] = {},
151+
key_match_comparator=operator.le,
152+
):
144153
dict.__init__(self, source)
145154
self.sort_params = sort_params
146155
self.match = key_match_comparator

setuptools/_distutils/_itertools.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# from more_itertools 10.2
2+
def always_iterable(obj, base_type=(str, bytes)):
3+
"""If *obj* is iterable, return an iterator over its items::
4+
5+
>>> obj = (1, 2, 3)
6+
>>> list(always_iterable(obj))
7+
[1, 2, 3]
8+
9+
If *obj* is not iterable, return a one-item iterable containing *obj*::
10+
11+
>>> obj = 1
12+
>>> list(always_iterable(obj))
13+
[1]
14+
15+
If *obj* is ``None``, return an empty iterable:
16+
17+
>>> obj = None
18+
>>> list(always_iterable(None))
19+
[]
20+
21+
By default, binary and text strings are not considered iterable::
22+
23+
>>> obj = 'foo'
24+
>>> list(always_iterable(obj))
25+
['foo']
26+
27+
If *base_type* is set, objects for which ``isinstance(obj, base_type)``
28+
returns ``True`` won't be considered iterable.
29+
30+
>>> obj = {'a': 1}
31+
>>> list(always_iterable(obj)) # Iterate over the dict's keys
32+
['a']
33+
>>> list(always_iterable(obj, base_type=dict)) # Treat dicts as a unit
34+
[{'a': 1}]
35+
36+
Set *base_type* to ``None`` to avoid any special handling and treat objects
37+
Python considers iterable as iterable:
38+
39+
>>> obj = 'foo'
40+
>>> list(always_iterable(obj, base_type=None))
41+
['f', 'o', 'o']
42+
"""
43+
if obj is None:
44+
return iter(())
45+
46+
if (base_type is not None) and isinstance(obj, base_type):
47+
return iter((obj,))
48+
49+
try:
50+
return iter(obj)
51+
except TypeError:
52+
return iter((obj,))

setuptools/_distutils/_log.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
import logging
22

3-
43
log = logging.getLogger()

setuptools/_distutils/_macos_compat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import sys
21
import importlib
2+
import sys
33

44

55
def bypass_compiler_fixup(cmd, args):

0 commit comments

Comments
 (0)