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

Add possibility to disable doc build for Fedora by external macro #170

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
13 changes: 13 additions & 0 deletions pyp2rpm/templates/fedora.spec
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
{%- if data.srcname %}
%global srcname {{ data.srcname }}
{%- endif %}
{%- if data.sphinx_dir %}
%if 0%{?_without_doc}
%bcond_with doc
%else
%bcond_without doc
Copy link
Member

@hroncok hroncok Jun 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just keep this line; the if/else part is not needed at all.

%endif
{%- endif %}

Name: {{ data.pkg_name|macroed_pkg_name(data.srcname) }}
Version: {{ data.version }}
Expand Down Expand Up @@ -32,10 +39,12 @@ Summary: %{summary}
{{ data.description|truncate(400)|wordwrap }}
{% endfor -%}
{%- if data.sphinx_dir %}
%if %{with doc}
%package -n {{ data.pkg_name|macroed_pkg_name(data.srcname)|name_for_python_version(None, True) }}-doc
Summary: {{ data.name }} documentation
%description -n {{ data.pkg_name|macroed_pkg_name(data.srcname)|name_for_python_version(None, True) }}-doc
Documentation for {{ data.name }}
%endif
{%- endif %}

%prep
Expand All @@ -50,10 +59,12 @@ rm -rf %{pypi_name}.egg-info
%py{{ pv }}_build
{%- endfor %}
{%- if data.sphinx_dir %}
%if %{with doc}
# generate html docs
PYTHONPATH=${PWD} {{ "sphinx-build"|script_name_for_python_version(data.base_python_version, False, True) }} {{ data.sphinx_dir }} html
# remove the sphinx-build leftovers
rm -rf html/.{doctrees,buildinfo}
%endif
{%- endif %}

%install
Expand Down Expand Up @@ -118,11 +129,13 @@ rm -rf %{buildroot}%{_bindir}/*
{%- endif %}
{% endfor %}
{%- if data.sphinx_dir %}
%if %{with doc}
%files -n {{ data.pkg_name|macroed_pkg_name(data.srcname)|name_for_python_version(None, True) }}-doc
%doc html
{%- if data.doc_license %}
%license {{data.doc_license|join(' ')}}
{%- endif %}
%endif
{% endif %}
%changelog
* {{ data.changelog_date_packager }} - {{ data.version }}-1
Expand Down