Blame python-libsass.spec

108a2ea
# Sphinx-generated HTML documentation is not suitable for packaging; see
108a2ea
# https://bugzilla.redhat.com/show_bug.cgi?id=2006555 for discussion.
108a2ea
#
108a2ea
# We can generate PDF documentation as a substitute.
108a2ea
%bcond doc 1
108a2ea
04a2989
Name:           python-libsass
d9591c6
Version:        0.22.0
39e0e12
Release:        %autorelease
04a2989
Summary:        Sass for Python: A straightforward binding of libsass for Python
Marcel Plch da788b8
10791d8
# SPDX
Marcel Plch da788b8
License:        MIT
Marcel Plch da788b8
URL:            https://github.com/dahlia/libsass-python
27bf690
Source:         %{url}/archive/%{version}/libsass-python-%{version}.tar.gz
4095807
d9591c6
# 0.22.0: documentation seems is not ready for sphinx 6.1.3
a4320af
# https://github.com/sass/libsass-python/issues/424
d9591c6
#
d9591c6
# doc: support sphinx 6.0 ext.extlinks
d9591c6
# https://github.com/sass/libsass-python/pull/433
d9591c6
Patch:          %{url}/pull/433.patch
89df710
# Add a missing word “to” in the description
89df710
# https://github.com/sass/libsass-python/pull/442
d9591c6
Patch:          %{url}/pull/442.patch
8aca435
# Replace deprecated license_file with license_files in setup.cfg
8aca435
# https://github.com/sass/libsass-python/pull/441
10d27ba
Patch:          %{url}/pull/441.patch
Marcel Plch da788b8
Marcel Plch da788b8
BuildRequires:  python3-devel
04a2989
04a2989
# Selected test dependencies from requirements-dev.txt; most entries in that
04a2989
# file are for linters, code coverage, etc.
04a2989
BuildRequires:  %{py3_dist pytest}
04a2989
BuildRequires:  (%{py3_dist werkzeug} with %{py3_dist werkzeug} >= 0.9)
04a2989
04a2989
BuildRequires:  make
Marcel Plch ea841ec
BuildRequires:  gcc-c++
04a2989
10d27ba
BuildRequires:  libsass-devel >= 3.6.5
04a2989
29fe739
BuildRequires:  help2man
108a2ea
%if %{with doc}
29fe739
BuildRequires:  %{py3_dist sphinx}
108a2ea
BuildRequires:  python3-sphinx-latex
108a2ea
BuildRequires:  latexmk
108a2ea
%endif
Marcel Plch da788b8
04a2989
%global common_description %{expand:
04a2989
This package provides a simple Python extension module sass which is binding
04a2989
LibSass (written in C/C++ by Hampton Catlin and Aaron Leung). It’s very
89df710
straightforward and there isn’t any headache related to Python
04a2989
distribution/deployment. That means you can add just libsass into your
04a2989
setup.py’s install_requires list or requirements.txt file. No need for Ruby nor
04a2989
Node.js.}
04a2989
04a2989
%description %{common_description}
Marcel Plch da788b8
04a2989
04a2989
%package -n python3-libsass
Marcel Plch da788b8
Summary:        %{summary}
Marcel Plch da788b8
f16f93f
# https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/
f16f93f
#   #_provides_for_importable_modules
f16f93f
# This package is messy; it occupies quite a few top-level names.
f16f93f
%py_provides python3-sass
f16f93f
%py_provides python3-pysassc
f16f93f
%py_provides python3-sasstests
f16f93f
%py_provides python3-sassutils
f16f93f
04a2989
%description -n python3-libsass %{common_description}
Marcel Plch da788b8
Marcel Plch da788b8
108a2ea
%if %{with doc}
108a2ea
%package        doc
108a2ea
Summary:        Documentation for python-libsass
108a2ea
108a2ea
%description    doc %{common_description}
108a2ea
%endif
108a2ea
108a2ea
Marcel Plch da788b8
%prep
10d27ba
%autosetup -n libsass-python-%{version} -p1
d93a2d0
d93a2d0
# While upstream has the executable bit set, we will install this in
d93a2d0
# site-packages without executable permissions; therefore, the shebang becomes
d93a2d0
# useless, and we should remove it downstream.
d93a2d0
sed -r -i '1{/^#!/d}' pysassc.py
Marcel Plch da788b8
04a2989
04a2989
%generate_buildrequires
04a2989
export SYSTEM_SASS='1'
04a2989
%pyproject_buildrequires
04a2989
04a2989
Marcel Plch da788b8
%build
04a2989
export SYSTEM_SASS='1'
04a2989
%pyproject_wheel
04a2989
108a2ea
%if %{with doc}
29fe739
LIB='lib.%{python3_platform}-cpython-%{python3_version_nodots}'
29fe739
PYTHONPATH="${PWD}/build/${LIB}" %make_build -C docs latex \
29fe739
    SPHINXOPTS='-j%{?_smp_build_ncpus}'
108a2ea
%make_build -C docs/_build/latex LATEXMKOPTS='-quiet'
108a2ea
%endif
04a2989
Marcel Plch da788b8
Marcel Plch da788b8
%install
04a2989
export SYSTEM_SASS='1'
04a2989
%pyproject_install
a6e9b43
%pyproject_save_files -l sass pysassc sasstests sassutils _sass
04a2989
29fe739
# We build the man page in %%install rather than %%build because we need to use
29fe739
# the entry point in %%{buildroot}/%%{_bindir}.
29fe739
install -d '%{buildroot}%{_mandir}/man1'
29fe739
PYTHONPATH='%{buildroot}%{python3_sitearch}' \
29fe739
    help2man --no-info --output='%{buildroot}%{_mandir}/man1/pysassc.1' \
29fe739
    '%{buildroot}%{_bindir}/pysassc'
04a2989
Marcel Plch da788b8
Marcel Plch da788b8
%check
04a2989
%pytest -v sasstests.py
Marcel Plch da788b8
04a2989
04a2989
%files -n python3-libsass -f %{pyproject_files}
108a2ea
%if %{without doc}
Marcel Plch da788b8
%doc README.rst
c2d762e
%doc docs/changes.rst
108a2ea
%endif
Marcel Plch da788b8
%{_bindir}/pysassc
04a2989
%{_mandir}/man1/pysassc.1*
04a2989
Marcel Plch da788b8
108a2ea
%if %{with doc_pdf}
108a2ea
%files doc
108a2ea
%license LICENSE
108a2ea
%doc README.rst
c2d762e
%doc docs/changes.rst
108a2ea
%doc docs/_build/latex/libsass.pdf
108a2ea
%endif
108a2ea
108a2ea
Marcel Plch da788b8
%changelog
39e0e12
%autochangelog