{% macro describe_source(source_type_text, source_json_dict, is_package=False) %}
  <dt>Source Type:</dt>
  {% if is_package and (source_type_text == "link" or source_type_text == "upload") %}
    <dd>No default source</dd> {# source types link & upload only make sense for builds, not for packages #}
  {% else %}
    <dd>{{ source_type_text | build_source_description }}</dd>
  {% endif %}

  {% if source_type_text == "link" and not is_package %}
  <dt>Package URL:</dt>
  <dd>
    <a href="{{ source_json_dict["url"] }}">{{ source_json_dict["url"] }}</a>
  </dd>

  {% elif source_type_text == "upload" and not is_package %}
  <dt>File Name:</dt>
  <dd>{{ source_json_dict["pkg"] }}</dd>

  {% elif source_type_text == "scm" %}
  <dt>SCM type:</dt>
  <dd>{{ source_json_dict["type"] }}</dd>

  <dt>Clone URL:</dt>
  <dd>{{ source_json_dict["clone_url"] }}</dd>

  {% if source_json_dict["committish"] %}
  <dt>Committish:</dt>
  <dd>{{ source_json_dict["committish"] }}</dd>
  {% endif %}

  {% if source_json_dict["subdirectory"] %}
  <dt>Subdirectory:</dt>
  <dd>{{ source_json_dict["subdirectory"] }}</dd>
  {% endif %}

  {% if source_json_dict["spec"] %}
  <dt>Path to .spec file:</dt>
  <dd>{{ source_json_dict["spec"] }}</dd>
  {% endif %}

  {% if source_json_dict["srpm_build_method"] %}
  <dt>Build SRPM with:</dt>
  <dd>{{ source_json_dict["srpm_build_method"] }}</dd>
  {% endif %}

  {% elif source_type_text == "pypi" %}
  <dt>PyPI package name</dt>
  <dd>{{ source_json_dict["pypi_package_name"] }}</dd>

  {% if source_json_dict["pypi_package_version"] %}
  <dt>PyPI package version</dt>
  <dd>{{ source_json_dict["pypi_package_version"] }}</dd>
  {% endif %}

  {% if source_json_dict["spec_generator"] %}
  <dt>Spec generator</dt>
  <dd>{{ source_json_dict["spec_generator"] }}</dd>
  {% endif %}

  {# These options are not available for pyp2spec #}
  {% if source_json_dict["spec_generator"] == "pyp2rpm" %}
    {% if source_json_dict["spec_template"] %}
    <dt>Spec template</dt>
    <dd>{{ source_json_dict["spec_template"] }}</dd>
    {% endif %}

    <dt>for Python</dt>
    <dd>{{ ', '.join(source_json_dict["python_versions"]).strip(', ') }}</dd>
    {% endif %}
  {% endif %}

  {% if source_type_text == "rubygems" %}
  <dt>Gem name:</dt>
  <dd>{{ source_json_dict["gem_name"] }}</dd>
  {% endif %}

{% if source_type_text == "distgit" %}
  {% for info in ["distgit", "committish", "clone_url"] %}
  {% if source_json_dict.get(info) %}
  <dt>{{ info.title() }}:</dt>
  <dd>{{ source_json_dict[info] }}</dd>
  {% endif %}
  {% endfor %}
{% endif %}


{% endmacro %}
