Skip to content

Commit

Permalink
Support --skip-existing with GCP Artifact Registry
Browse files Browse the repository at this point in the history
GCP includes the same "already exist" note as PyPI in a 400 response,
but in `text` rather than `reason`.

Fixes #816.
  • Loading branch information
zware committed Nov 1, 2021
1 parent 658037f commit 34cfed4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog/816.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Allow the ``--skip-existing`` option to work with GCP Artifact Registry.
4 changes: 2 additions & 2 deletions twine/commands/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ def skip_upload(
return (
# pypiserver (https://pypi.org/project/pypiserver)
status == 409
# PyPI / TestPyPI
or (status == 400 and "already exist" in reason)
# PyPI / TestPyPI / GCP Artifact Registry
or (status == 400 and any("already exist" in x for x in [reason, text]))
# Nexus Repository OSS (https://www.sonatype.com/nexus-repository-oss)
or (status == 400 and any("updating asset" in x for x in [reason, text]))
# Artifactory (https://jfrog.com/artifactory/)
Expand Down

0 comments on commit 34cfed4

Please sign in to comment.