diff --git a/.gitignore b/.gitignore index dac6e91..2c71ced 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ /python-editorconfig-0.12.0.tar.gz +/editorconfig-core-py-0.12.3.tar.gz +/editorconfig-core-test-e407c1592df0f8e91664835324dea85146f20189.tar.gz diff --git a/python-editorconfig.spec b/python-editorconfig.spec index aa9fb7d..af4cfee 100644 --- a/python-editorconfig.spec +++ b/python-editorconfig.spec @@ -1,60 +1,121 @@ -%global srcname editorconfig -%global sum A Python Based distribution of EditorConfig - -Name: python-%{srcname} -Version: 0.12.0 -Release: 22%{?dist} -Summary: %{sum} - +# Sphinx-generated HTML documentation is not suitable for packaging; see +# https://bugzilla.redhat.com/show_bug.cgi?id=2006555 for discussion. +# +# We can generate PDF documentation as a substitute. +%bcond_without doc_pdf + +# The tests are stored in a separate repository, which is normally accessed +# as a git submodule. +%global tests_commit e407c1592df0f8e91664835324dea85146f20189 + +Name: python-editorconfig +Version: 0.12.3 +Release: 1%{?dist} +Summary: EditorConfig File Locator and Interpreter for Python + +# See COPYING: the overall license is BSD, but the following files are derived +# from the Python standard library under the Python license: +# - editorconfig/fnmatch.py +# - editorconfig/ini.py License: Python and BSD -URL: http://editorconfig.org -Source0: https://github.com/editorconfig/editorconfig-core-py/archive/v0.12.0.tar.gz#/%{name}-%{version}.tar.gz +URL: https://github.com/editorconfig/editorconfig-core-py +Source0: %{url}/archive/v%{version}/editorconfig-core-py-%{version}.tar.gz +%global tests_url https://github.com/editorconfig/editorconfig-core-test +Source1: %{tests_url}/archive/%{tests_commit}/editorconfig-core-test-%{tests_commit}.tar.gz BuildArch: noarch -BuildRequires: make -BuildRequires: python3-sphinx + BuildRequires: python3-devel -BuildRequires: python3-setuptools +BuildRequires: python3dist(setuptools) -%description -EditorConfig Python Core provides the same functionality as the EditorConfig C -Core. EditorConfig Python core can be used as a an importable library. +# For tests: +BuildRequires: cmake -%package -n python3-%{srcname} -Summary: %{sum} -%{?python_provide:%python_provide python3-%{srcname}} +%if %{with doc_pdf} +BuildRequires: make +BuildRequires: python3dist(sphinx) +BuildRequires: python3-sphinx-latex +BuildRequires: latexmk +%endif -%description -n python3-%{srcname} +%global common_description %{expand: \ EditorConfig Python Core provides the same functionality as the EditorConfig C -Core. EditorConfig Python core can be used as a an importable library. +Core.} + +%description +%{common_description} + + +%package -n python3-editorconfig +Summary: %{summary} + +%description -n python3-editorconfig +%{common_description} + + +%package doc +Summary: Documentation for python-editorconfig + +%description doc %{common_description} + %prep -%setup -qn %{srcname}-core-py-%{version} +%setup -q -n editorconfig-core-py-%{version} + +rm -vrf tests +%setup -q -n editorconfig-core-py-%{version} -T -D -b 1 +mv ../editorconfig-core-test-%{tests_commit}/ tests/ %build %{py3_build} -cd docs -make SPHINXBUILD=sphinx-build-3 text + +%make_build -C docs text SPHINXOPTS='%{?_smp_mflags}' +%if %{with doc_pdf} +%make_build -C docs latex SPHINXOPTS='%{?_smp_mflags}' +%make_build -C docs/_build/latex LATEXMKOPTS='-quiet' +%endif + +%cmake -DPYTHON_EXECUTABLE='%{python3}' %install %{py3_install} -mkdir -p $RPM_BUILD_ROOT%{_defaultdocdir}/python3-%{srcname} -cp docs/_build/text/* $RPM_BUILD_ROOT%{_defaultdocdir}/python3-%{srcname}/ +# The command-line tool would conflict with the one from the C version of +# EditorConfig. It could be installed under a different name, if any one ever +# reports a need for it. +rm -vf '%{buildroot}%{_bindir}/editorconfig' -# EditorConfig C already places the official binary into /usr/bin. -rm $RPM_BUILD_ROOT%{_bindir}/%{srcname} +%check +export PYTHONPATH='%{buildroot}%{python3_sitelib}' +%ctest -%files -n python3-%{srcname} + +%files -n python3-editorconfig +%license COPYING LICENSE.BSD LICENSE.PSF %doc README.rst -%license LICENSE.txt -%{python3_sitelib}/* -%{_defaultdocdir}/python3-%{srcname}/* +%{python3_sitelib}/editorconfig +%{python3_sitelib}/EditorConfig-%{version}-py%{python3_version}.egg-info + + +%files doc +%license COPYING LICENSE.BSD LICENSE.PSF +%doc README.rst +%doc docs/_build/text +%if %{with doc_pdf} +%doc docs/_build/latex/EditorConfigPythonCore.pdf +%endif %changelog +* Wed Jan 12 2022 Benjamin A. Beasley - 0.12.3-1 +- Update to 0.12.3 (close RHBZ#1876235) +- Modernize spec file (still under “old guidelines” for now) +- Add a -doc subpackage and build PDF +- Add more license files +- Run the tests + * Tue Jul 27 2021 Fedora Release Engineering - 0.12.0-22 - Second attempt - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild diff --git a/sources b/sources index 6b86035..d2e7c7d 100644 --- a/sources +++ b/sources @@ -1 +1,2 @@ -712a6a3ab23f710f683edb090200c714 python-editorconfig-0.12.0.tar.gz +SHA512 (editorconfig-core-py-0.12.3.tar.gz) = 005d0698c410c8865d177a1e891b5c51b15255f36303b116fddbbbc08e309d1d60ca3003d27e6fd8455e53c5956db0c29e298f22f4b10950e1f7c56c7c6e0ab3 +SHA512 (editorconfig-core-test-e407c1592df0f8e91664835324dea85146f20189.tar.gz) = cade0e74074d29595f067614da266df551b5b40ef8621c5ceb09b9f4e99cb42413965fdd5459bfe3ed042dfb8df90cb4d32e28ef4ec30264a8a31c2cb1ad5f0d