Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include '--index-url' argument for the pip install command for Test PyPI #4941

Merged
merged 3 commits into from
Oct 28, 2018
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions warehouse/templates/packaging/detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,19 @@ <h3 class="package-snippet__title">
</a>
{%- endmacro %}


{%- macro pip_command(release, request_route, test_environment) -%}
{%- if test_environment -%}
{% set index_url = " -i https://test.pypi.org/simple/" %}
{%- endif -%}

{%- if request_route == "packaging.release" -%}
{% set project_version = "==" + release.version %}
{%- endif -%}

pip install{{ index_url }} {{ release.project.name }}{{ project_version }}
{%- endmacro -%}

{% block title %}{{ release.project.name }}{% endblock %}

{% block description %}{{ release.summary }}{% endblock %}
Expand All @@ -79,13 +92,8 @@ <h1 class="package-header__name">
</h1>

{% if files %}
{% if request.matched_route.name == "packaging.release" %}
{% set pip_command = "pip install {release.project.name}=={release.version}".format(release=release) %}
{% else %}
{% set pip_command = "pip install {release.project.name}".format(release=release) %}
{% endif %}
<p class="package-header__pip-instructions">
<span id="pip-command">{{ pip_command }}</span>
<span id="pip-command">{{ pip_command(release, request.matched_route.name, testPyPI) }}</span>
<button class="-js-copy-pip-command tooltipped tooltipped-s" data-clipboard-target="#pip-command" aria-label="Copy to clipboard" data-original-label="Copy to clipboard">
<i class="fa fa-copy" aria-hidden="true"></i>
<span class="sr-only">Copy PIP instructions<span>
Expand Down