Commit ab42b2e
committed
Merge bitcoin/bitcoin#28347: lint: replace deprecated pkg_resources with importlib.metadata
6c008a2 script: replace deprecated pkg_resources with importlib.metadata (Jon Atack)
Pull request description:
Running our python linter with a recent python and the latest release of setuptools [v68.1.2](https://setuptools.pypa.io/en/stable/history.html):
```
$ python3 --version
Python 3.11.5
$ ./test/lint/lint-python.py:12: DeprecationWarning: pkg_resources is deprecated as an API.
See https://setuptools.pypa.io/en/latest/pkg_resources.html
import pkg_resources
```
Using `pkg_resources` was [deprecated](pypa/setuptools#3843) earlier in [v67.5.0](https://setuptools.pypa.io/en/stable/history.html#id55): "Although pkg_resources has been discouraged for use, some projects still consider pkg_resources viable for usage. This change makes it clear that pkg_resources should not be used, emitting a DeprecationWarning when imported."
The `importlib.metadata` library requires Python 3.8, which is currently our minimum-supported Python version.
For more details about `importlib.metadata` and the two methods imported and used here, see:
- https://docs.python.org/3/library/importlib.metadata.html
- https://importlib-metadata.readthedocs.io/en/latest/api.html#importlib_metadata.metadata
- https://importlib-metadata.readthedocs.io/en/latest/api.html#importlib_metadata.PackageNotFoundError
ACKs for top commit:
MarcoFalke:
lgtm ACK 6c008a2 (review only, did not test)
Tree-SHA512: f5258d37043fcc9744f85641a60a3395ad43822c72d030dea8c39fa7f48ec3d7790cdeeb832f96e8f38046adb7c62fbc577c975ef0c77c8047c0c8f2353ce5401 file changed
+6
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | 12 | | |
14 | 13 | | |
15 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
| |||
99 | 101 | | |
100 | 102 | | |
101 | 103 | | |
102 | | - | |
103 | | - | |
104 | 104 | | |
105 | | - | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
106 | 108 | | |
107 | 109 | | |
108 | 110 | | |
| |||
0 commit comments