aec742a
# Sphinx-generated HTML documentation is not suitable for packaging; see
aec742a
# https://bugzilla.redhat.com/show_bug.cgi?id=2006555 for discussion.
aec742a
#
aec742a
# We can generate PDF documentation as a substitute.
aec742a
%bcond_without doc_pdf
aec742a
aec742a
# The tests are stored in a separate repository, which is normally accessed
aec742a
# as a git submodule.
aec742a
%global tests_commit e407c1592df0f8e91664835324dea85146f20189
aec742a
aec742a
Name:           python-editorconfig
aec742a
Version:        0.12.3
06227cf
Release:        %autorelease
aec742a
Summary:        EditorConfig File Locator and Interpreter for Python
aec742a
6985973
# See COPYING: the overall license is BSD-2-Clause, but the following files are derived
6985973
# from the Python standard library under the PSF-2.0 license:
aec742a
#   - editorconfig/fnmatch.py
aec742a
#   - editorconfig/ini.py
6985973
License:        BSD-2-Clause AND PSF-2.0
aec742a
URL:            https://github.com/editorconfig/editorconfig-core-py
aec742a
Source0:        %{url}/archive/v%{version}/editorconfig-core-py-%{version}.tar.gz
aec742a
%global tests_url https://github.com/editorconfig/editorconfig-core-test
aec742a
Source1:        %{tests_url}/archive/%{tests_commit}/editorconfig-core-test-%{tests_commit}.tar.gz
c8d1131
c8d1131
BuildArch:      noarch
aec742a
c8d1131
BuildRequires:  python3-devel
c8d1131
aec742a
# For tests:
aec742a
BuildRequires:  cmake
c8d1131
aec742a
BuildRequires:  make
aec742a
BuildRequires:  python3dist(sphinx)
1e53603
%if %{with doc_pdf}
aec742a
BuildRequires:  python3-sphinx-latex
aec742a
BuildRequires:  latexmk
aec742a
%endif
c8d1131
52875c3
%global common_description %{expand:
c8d1131
EditorConfig Python Core provides the same functionality as the EditorConfig C
aec742a
Core.}
aec742a
52875c3
%description %{common_description}
aec742a
aec742a
aec742a
%package     -n python3-editorconfig
aec742a
Summary:        %{summary}
aec742a
52875c3
%description -n python3-editorconfig %{common_description}
aec742a
aec742a
aec742a
%package        doc
aec742a
Summary:        Documentation for python-editorconfig
aec742a
aec742a
%description    doc %{common_description}
aec742a
c8d1131
c8d1131
%prep
aec742a
%setup -q -n editorconfig-core-py-%{version}
aec742a
aec742a
rm -vrf tests
aec742a
%setup -q -n editorconfig-core-py-%{version} -T -D -b 1
aec742a
mv ../editorconfig-core-test-%{tests_commit}/ tests/
c8d1131
c8d1131
d4e75bc
%generate_buildrequires
6985973
%pyproject_buildrequires
d4e75bc
d4e75bc
c8d1131
%build
d4e75bc
%pyproject_wheel
aec742a
3ae7350
%make_build -C docs text SPHINXOPTS='-j%{?_smp_build_ncpus}'
aec742a
%if %{with doc_pdf}
3ae7350
%make_build -C docs latex SPHINXOPTS='-j%{?_smp_build_ncpus}'
aec742a
%make_build -C docs/_build/latex LATEXMKOPTS='-quiet'
aec742a
%endif
aec742a
aec742a
%cmake -DPYTHON_EXECUTABLE='%{python3}'
c8d1131
c8d1131
%install
d4e75bc
%pyproject_install
d4e75bc
%pyproject_save_files editorconfig
c8d1131
aec742a
# The command-line tool would conflict with the one from the C version of
d4e75bc
# EditorConfig. It could be installed under a different name, if anyone ever
aec742a
# reports a need for it.
aec742a
rm -vf '%{buildroot}%{_bindir}/editorconfig'
c8d1131
c8d1131
aec742a
%check
aec742a
export PYTHONPATH='%{buildroot}%{python3_sitelib}'
aec742a
%ctest
c8d1131
aec742a
d4e75bc
%files -n python3-editorconfig -f %{pyproject_files}
d4e75bc
# pyproject_files handles COPYING and LICENSE.*; verify with “rpm -qL -p …”
655d135
%doc README.rst
aec742a
aec742a
aec742a
%files doc
aec742a
%license COPYING LICENSE.BSD LICENSE.PSF
aec742a
%doc README.rst
139a8a3
%doc docs/_build/text/
aec742a
%if %{with doc_pdf}
aec742a
%doc docs/_build/latex/EditorConfigPythonCore.pdf
aec742a
%endif
c8d1131
c8d1131
c8d1131
%changelog
06227cf
%autochangelog