Skip to content

Commit 34cfed4

Browse files
committed
Support --skip-existing with GCP Artifact Registry
GCP includes the same "already exist" note as PyPI in a 400 response, but in `text` rather than `reason`. Fixes #816.
1 parent 658037f commit 34cfed4

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

changelog/816.feature.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Allow the ``--skip-existing`` option to work with GCP Artifact Registry.

twine/commands/upload.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ def skip_upload(
5858
return (
5959
# pypiserver (https://pypi.org/project/pypiserver)
6060
status == 409
61-
# PyPI / TestPyPI
62-
or (status == 400 and "already exist" in reason)
61+
# PyPI / TestPyPI / GCP Artifact Registry
62+
or (status == 400 and any("already exist" in x for x in [reason, text]))
6363
# Nexus Repository OSS (https://www.sonatype.com/nexus-repository-oss)
6464
or (status == 400 and any("updating asset" in x for x in [reason, text]))
6565
# Artifactory (https://jfrog.com/artifactory/)

0 commit comments

Comments
 (0)