Create pypi_twine_executable

Like we do for bindep and tox roles. Allow a user to manage the twine
binary outside of the upload-pypi role. This allows a user to better
control the path of the executable too.

Change-Id: I5c757b29e185ab76495abf3cfb2d853aada77a50
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2017-08-23 14:43:09 -04:00
parent 6bb8096a0e
commit d292ee658a
No known key found for this signature in database
GPG Key ID: 611A80832067AF38
3 changed files with 8 additions and 11 deletions

View File

@ -30,3 +30,8 @@ Upload python packages to PyPI
:default: src/{{ zuul.project.canonical_name }}/dist
Path containing artifacts to upload.
.. zuul:rolevar:: pypi_twine_executable
:default: twine
Path to twine executable.

View File

@ -2,3 +2,4 @@
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_twine_executable: twine

View File

@ -1,12 +1,3 @@
- name: Check for twine install
command: which twine
ignore_errors: yes
register: twine_command_which
- name: Ensure twine is installed
command: pip install --user twine
when: not twine_command_which|succeeded
- name: Install .pypirc configuration file
template:
dest: ~/.pypirc
@ -20,7 +11,7 @@
register: found_wheels
- name: Upload wheel with twine before tarballs
command: "twine upload -r {{ pypi_repository }} {{ item.path }}"
command: "{{ pypi_twine_executable }} upload -r {{ pypi_repository }} {{ item.path }}"
with_items: "{{ found_wheels.files }}"
when: found_wheels.matched|bool
@ -31,6 +22,6 @@
register: found_tarballs
- name: Upload tarballs with twine
command: "twine upload -r {{ pypi_repository }} {{ item.path }}"
command: "{{ pypi_twine_executable }} upload -r {{ pypi_repository }} {{ item.path }}"
with_items: "{{ found_tarballs.files }}"
when: found_tarballs.matched|bool