|
20 | 20 | import requests
|
21 | 21 | from rich import print
|
22 | 22 |
|
23 |
| -from twine import commands |
24 |
| -from twine import exceptions |
| 23 | +from twine import commands, exceptions, settings, utils |
25 | 24 | from twine import package as package_file
|
26 |
| -from twine import settings |
27 |
| -from twine import utils |
28 | 25 |
|
29 | 26 | logger = logging.getLogger(__name__)
|
30 | 27 |
|
@@ -124,17 +121,25 @@ def upload(upload_settings: settings.Settings, dists: List[str]) -> None:
|
124 | 121 | _make_package(filename, signatures, upload_settings) for filename in uploads
|
125 | 122 | ]
|
126 | 123 |
|
127 |
| - # Warn the user if they're trying to upload a PGP signature to PyPI |
128 |
| - # or TestPyPI, which will (as of May 2023) ignore it. |
129 |
| - # This check is currently limited to just those indices, since other |
130 |
| - # indices may still support PGP signatures. |
131 |
| - if any(p.gpg_signature for p in packages_to_upload) and repository_url.startswith( |
132 |
| - (utils.DEFAULT_REPOSITORY, utils.TEST_REPOSITORY) |
133 |
| - ): |
134 |
| - logger.warning( |
135 |
| - "One or more packages has an associated PGP signature; " |
136 |
| - "these will be silently ignored by the index" |
137 |
| - ) |
| 124 | + if any(p.gpg_signature for p in packages_to_upload): |
| 125 | + if repository_url.startswith((utils.DEFAULT_REPOSITORY, utils.TEST_REPOSITORY)): |
| 126 | + # Warn the user if they're trying to upload a PGP signature to PyPI |
| 127 | + # or TestPyPI, which will (as of May 2023) ignore it. |
| 128 | + # This warning is currently limited to just those indices, since other |
| 129 | + # indices may still support PGP signatures. |
| 130 | + logger.warning( |
| 131 | + "One or more packages has an associated PGP signature; " |
| 132 | + "these will be silently ignored by the index" |
| 133 | + ) |
| 134 | + else: |
| 135 | + # On other indices, warn the user that twine is considering |
| 136 | + # removing PGP support outright. |
| 137 | + logger.warning( |
| 138 | + "One or more packages has an associated PGP signature; " |
| 139 | + "a future version of twine may silently ignore these. " |
| 140 | + "See https://github.com/pypa/twine/issues/1009 for more " |
| 141 | + "information" |
| 142 | + ) |
138 | 143 |
|
139 | 144 | repository = upload_settings.create_repository()
|
140 | 145 | uploaded_packages = []
|
|
0 commit comments