From a1c25d6fc8c1941239d950b920a93b19094a5700 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Tue, 17 Oct 2017 14:13:24 -0700 Subject: [PATCH] upload-pypi: make repository url optional The current default URL returns an error. The error message suggests that we just omit the URL entirely from the config and let twine handle it. That's what this patch does. Change-Id: I83b2eb30e3c93690dbe03052cd3f20a73c110350 --- roles/upload-pypi/README.rst | 6 +++--- roles/upload-pypi/defaults/main.yaml | 2 +- roles/upload-pypi/templates/.pypirc.j2 | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/roles/upload-pypi/README.rst b/roles/upload-pypi/README.rst index 8c6f3da79..cbcc0dab1 100644 --- a/roles/upload-pypi/README.rst +++ b/roles/upload-pypi/README.rst @@ -19,12 +19,12 @@ Upload python packages to PyPI .. zuul:rolevar:: repository :default: pypi - Name of the repository to upload to + Name of the repository to upload to. .. zuul:rolevar:: repository_url - :default: https://pypi.python.org/pypi + :default: The built-in twine default for the production pypi.org service. - URL of the PyPI repostory + URL of the PyPI repostory. .. zuul:rolevar:: pypi_path :default: src/{{ zuul.project.canonical_name }}/dist diff --git a/roles/upload-pypi/defaults/main.yaml b/roles/upload-pypi/defaults/main.yaml index 4e71e83f5..c0cb93b96 100644 --- a/roles/upload-pypi/defaults/main.yaml +++ b/roles/upload-pypi/defaults/main.yaml @@ -1,5 +1,5 @@ --- pypi_path: "src/{{ zuul.project.canonical_name }}/dist" pypi_repository: "{{ pypi_info.repository|default('pypi') }}" -pypi_repository_url: "{{ pypi_info.repository_url|default('https://pypi.python.org/pypi') }}" +pypi_repository_url: "{{ pypi_info.repository_url|default(None) }}" pypi_twine_executable: twine diff --git a/roles/upload-pypi/templates/.pypirc.j2 b/roles/upload-pypi/templates/.pypirc.j2 index 3cc8ab2a2..03ccded83 100644 --- a/roles/upload-pypi/templates/.pypirc.j2 +++ b/roles/upload-pypi/templates/.pypirc.j2 @@ -3,6 +3,8 @@ index-servers= {{ pypi_repository }} [{{ pypi_repository }}] +{% if pypi_repository_url %} repository:{{ pypi_repository_url }} +{% endif %} username:{{ pypi_info.username }} password:{{ pypi_info.password }}