Skip to content

Commit 82145bc

Browse files
committed
Merge branch 'main' of https://github.com/pypa/setuptools into typeshed-overload-and-typevar
2 parents 807d7c1 + 2adbd4f commit 82145bc

14 files changed

+137
-56
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 70.0.0
2+
current_version = 70.1.0
33
commit = True
44
tag = True
55

NEWS.rst

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,33 @@
1+
v70.1.0
2+
=======
3+
4+
Features
5+
--------
6+
7+
- Adopted the ``bdist_wheel`` command from the ``wheel`` project -- by :user:`agronholm` (#1386)
8+
- Improve error message when ``pkg_resources.ZipProvider`` tries to extract resources with a missing Egg -- by :user:`Avasam`
9+
10+
Added variables and parameter type annotations to ``pkg_resources`` to be nearly on par with typeshed.\* -- by :user:`Avasam`
11+
\* Excluding ``TypeVar`` and ``overload``. Return types are currently inferred. (#4246)
12+
- Migrated Setuptools' own config to pyproject.toml (#4310)
13+
14+
15+
Bugfixes
16+
--------
17+
18+
- Prevent a ``TypeError: 'NoneType' object is not callable`` when ``shutil_rmtree`` is called without an ``onexc`` parameter on Python<=3.11 -- by :user:`Avasam` (#4382)
19+
- Replace use of mktemp with can_symlink from the stdlib test suite. (#4403)
20+
- Improvement for ``attr:`` directives in configuration to handle
21+
more edge cases related to complex ``package_dir``. (#4405)
22+
- Fix accidental implicit string concatenation. (#4411)
23+
24+
25+
Misc
26+
----
27+
28+
- #4365, #4422
29+
30+
131
v70.0.0
232
=======
333

@@ -109,7 +139,19 @@ v69.3.0
109139
Features
110140
--------
111141

112-
- Support PEP 625 by canonicalizing package name and version in filenames. (#3593)
142+
- Support PEP 625 by canonicalizing package name and version in filenames
143+
per
144+
`the spec <https://packaging.python.org/en/latest/specifications/source-distribution-format/#source-distribution-file-name>`_.
145+
Projects whose names contain uppercase characters, dashes, or periods will
146+
now see their sdist names normalized to match the standard and the format
147+
previously seen in wheels. For example:
148+
149+
- ``zope.interface`` -> ``zope_interface``
150+
- ``CherryPy`` -> ``cherrypy``
151+
- ``foo-bar_baz`` -> ``foo_bar_baz``
152+
153+
Projects are encouraged to adopt this change to align with standards and
154+
other backend build systems. (#3593)
113155

114156

115157
v69.2.0

newsfragments/1386.feature.rst

Lines changed: 0 additions & 1 deletion
This file was deleted.

newsfragments/4246.feature.rst

Lines changed: 0 additions & 4 deletions
This file was deleted.

newsfragments/4310.feature.rst

Lines changed: 0 additions & 1 deletion
This file was deleted.

newsfragments/4365.misc.rst

Lines changed: 0 additions & 1 deletion
This file was deleted.

newsfragments/4382.bugfix.rst

Lines changed: 0 additions & 1 deletion
This file was deleted.

newsfragments/4403.bugfix.rst

Lines changed: 0 additions & 1 deletion
This file was deleted.

newsfragments/4405.bugfix.rst

Lines changed: 0 additions & 2 deletions
This file was deleted.

newsfragments/4411.bugfix.rst

Lines changed: 0 additions & 1 deletion
This file was deleted.

pkg_resources/__init__.py

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3571,6 +3571,38 @@ class PkgResourcesDeprecationWarning(Warning):
35713571
"""
35723572

35733573

3574+
# Ported from ``setuptools`` to avoid introducing an import inter-dependency:
3575+
_LOCALE_ENCODING = "locale" if sys.version_info >= (3, 10) else None
3576+
3577+
3578+
def _read_utf8_with_fallback(file: str, fallback_encoding=_LOCALE_ENCODING) -> str:
3579+
"""See setuptools.unicode_utils._read_utf8_with_fallback"""
3580+
try:
3581+
with open(file, "r", encoding="utf-8") as f:
3582+
return f.read()
3583+
except UnicodeDecodeError: # pragma: no cover
3584+
msg = f"""\
3585+
********************************************************************************
3586+
`encoding="utf-8"` fails with {file!r}, trying `encoding={fallback_encoding!r}`.
3587+
3588+
This fallback behaviour is considered **deprecated** and future versions of
3589+
`setuptools/pkg_resources` may not implement it.
3590+
3591+
Please encode {file!r} with "utf-8" to ensure future builds will succeed.
3592+
3593+
If this file was produced by `setuptools` itself, cleaning up the cached files
3594+
and re-building/re-installing the package with a newer version of `setuptools`
3595+
(e.g. by updating `build-system.requires` in its `pyproject.toml`)
3596+
might solve the problem.
3597+
********************************************************************************
3598+
"""
3599+
# TODO: Add a deadline?
3600+
# See comment in setuptools.unicode_utils._Utf8EncodingNeeded
3601+
warnings.warn(msg, PkgResourcesDeprecationWarning, stacklevel=2)
3602+
with open(file, "r", encoding=fallback_encoding) as f:
3603+
return f.read()
3604+
3605+
35743606
# from jaraco.functools 1.3
35753607
def _call_aside(f, *args, **kwargs):
35763608
f(*args, **kwargs)
@@ -3643,35 +3675,3 @@ def _initialize_master_working_set():
36433675
add_activation_listener = working_set.subscribe
36443676
run_script = working_set.run_script
36453677
run_main = run_script
3646-
3647-
3648-
# ---- Ported from ``setuptools`` to avoid introducing an import inter-dependency ----
3649-
LOCALE_ENCODING = "locale" if sys.version_info >= (3, 10) else None
3650-
3651-
3652-
def _read_utf8_with_fallback(file: str, fallback_encoding=LOCALE_ENCODING) -> str:
3653-
"""See setuptools.unicode_utils._read_utf8_with_fallback"""
3654-
try:
3655-
with open(file, "r", encoding="utf-8") as f:
3656-
return f.read()
3657-
except UnicodeDecodeError: # pragma: no cover
3658-
msg = f"""\
3659-
********************************************************************************
3660-
`encoding="utf-8"` fails with {file!r}, trying `encoding={fallback_encoding!r}`.
3661-
3662-
This fallback behaviour is considered **deprecated** and future versions of
3663-
`setuptools/pkg_resources` may not implement it.
3664-
3665-
Please encode {file!r} with "utf-8" to ensure future builds will succeed.
3666-
3667-
If this file was produced by `setuptools` itself, cleaning up the cached files
3668-
and re-building/re-installing the package with a newer version of `setuptools`
3669-
(e.g. by updating `build-system.requires` in its `pyproject.toml`)
3670-
might solve the problem.
3671-
********************************************************************************
3672-
"""
3673-
# TODO: Add a deadline?
3674-
# See comment in setuptools.unicode_utils._Utf8EncodingNeeded
3675-
warnings.warn(msg, PkgResourcesDeprecationWarning, stacklevel=2)
3676-
with open(file, "r", encoding=fallback_encoding) as f:
3677-
return f.read()
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import platform
2+
from inspect import cleandoc
3+
4+
import jaraco.path
5+
import pytest
6+
7+
pytestmark = pytest.mark.integration
8+
9+
10+
# For the sake of simplicity this test uses fixtures defined in
11+
# `setuptools.test.fixtures`,
12+
# and it also exercise conditions considered deprecated...
13+
# So if needed this test can be deleted.
14+
@pytest.mark.skipif(
15+
platform.system() != "Linux",
16+
reason="only demonstrated to fail on Linux in #4399",
17+
)
18+
def test_interop_pkg_resources_iter_entry_points(tmp_path, venv):
19+
"""
20+
Importing pkg_resources.iter_entry_points on console_scripts
21+
seems to cause trouble with zope-interface, when deprecates installation method
22+
is used. See #4399.
23+
"""
24+
project = {
25+
"pkg": {
26+
"foo.py": cleandoc(
27+
"""
28+
from pkg_resources import iter_entry_points
29+
30+
def bar():
31+
print("Print me if you can")
32+
"""
33+
),
34+
"setup.py": cleandoc(
35+
"""
36+
from setuptools import setup, find_packages
37+
38+
setup(
39+
install_requires=["zope-interface==6.4.post2"],
40+
entry_points={
41+
"console_scripts": [
42+
"foo=foo:bar",
43+
],
44+
},
45+
)
46+
"""
47+
),
48+
}
49+
}
50+
jaraco.path.build(project, prefix=tmp_path)
51+
cmd = ["pip", "install", "-e", ".", "--no-use-pep517"]
52+
venv.run(cmd, cwd=tmp_path / "pkg") # Needs this version of pkg_resources installed
53+
out = venv.run(["foo"])
54+
assert "Print me if you can" in out

pyproject.toml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ backend-path = ["."]
55

66
[project]
77
name = "setuptools"
8-
version = "70.0.0"
8+
version = "70.1.0"
99
authors = [
1010
{ name = "Python Packaging Authority", email = "[email protected]" },
1111
]
@@ -160,15 +160,14 @@ PKG-INFO = "setuptools.command.egg_info:write_pkg_info"
160160
include-package-data = false
161161

162162
[tool.setuptools.packages.find]
163+
include = [
164+
"setuptools*",
165+
"pkg_resources*",
166+
"_distutils_hack*",
167+
]
163168
exclude = [
164169
"*.tests",
165170
"*.tests.*",
166-
"tools*",
167-
"debian*",
168-
"launcher*",
169-
"newsfragments*",
170-
"docs",
171-
"docs.*",
172171
]
173172
namespaces = true
174173

setuptools/command/bdist_wheel.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,9 +284,7 @@ def finalize_options(self):
284284
wheel = self.distribution.get_option_dict("wheel")
285285
if "universal" in wheel:
286286
# please don't define this in your global configs
287-
log.warning(
288-
"The [wheel] section is deprecated. Use [bdist_wheel] instead.",
289-
)
287+
log.warn("The [wheel] section is deprecated. Use [bdist_wheel] instead.")
290288
val = wheel["universal"][1].strip()
291289
if val.lower() in ("1", "true", "yes"):
292290
self.universal = True

0 commit comments

Comments
 (0)