forked from pool/python-validate-pyproject
- Convert to libalternatives on SLE-16-based and newer systems
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-validate-pyproject?expand=0&rev=11
This commit is contained in:
102
python-validate-pyproject.spec
Normal file
102
python-validate-pyproject.spec
Normal file
@@ -0,0 +1,102 @@
|
||||
#
|
||||
# spec file for package python-validate-pyproject
|
||||
#
|
||||
# Copyright (c) 2025 SUSE LLC and contributors
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
# upon. The license for this file, and modifications and additions to the
|
||||
# file, is the same license as for the pristine package itself (unless the
|
||||
# license for the pristine package is not an Open Source License, in which
|
||||
# case the license is the MIT License). An "Open Source License" is a
|
||||
# license that conforms to the Open Source Definition (Version 1.9)
|
||||
# published by the Open Source Initiative.
|
||||
|
||||
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
||||
#
|
||||
|
||||
|
||||
%if 0%{?suse_version} > 1500
|
||||
%bcond_without libalternatives
|
||||
%else
|
||||
%bcond_with libalternatives
|
||||
%endif
|
||||
%{?sle15_python_module_pythons}
|
||||
Name: python-validate-pyproject
|
||||
Version: 0.15
|
||||
Release: 0
|
||||
Summary: Validation library and CLI tool for checking on 'pyprojecttoml'
|
||||
License: BSD-3-Clause AND MIT AND MPL-2.0
|
||||
URL: https://github.com/abravalheri/validate-pyproject/
|
||||
Source: https://files.pythonhosted.org/packages/source/v/validate-pyproject/validate-pyproject-%{version}.tar.gz
|
||||
BuildRequires: %{python_module fastjsonschema}
|
||||
BuildRequires: %{python_module pip}
|
||||
BuildRequires: %{python_module setuptools_scm}
|
||||
BuildRequires: %{python_module setuptools}
|
||||
BuildRequires: %{python_module wheel}
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: python-rpm-macros
|
||||
Requires: python-fastjsonschema
|
||||
Provides: python-validate_pyproject = %{version}-%{release}
|
||||
BuildArch: noarch
|
||||
%if 0%{python_version_nodots} < 38
|
||||
Requires: python-importlib-metadata
|
||||
%endif
|
||||
%if 0%{python_version_nodots} < 37
|
||||
Requires: python-importlib-resources
|
||||
%endif
|
||||
%if %{with libalternatives}
|
||||
BuildRequires: alts
|
||||
Requires: alts
|
||||
%else
|
||||
Requires(post): update-alternatives
|
||||
Requires(postun): update-alternatives
|
||||
%endif
|
||||
# SECTION test
|
||||
BuildRequires: %{python_module importlib-metadata if %python-base < 3.8}
|
||||
BuildRequires: %{python_module importlib-resources if %python-base < 3.7}
|
||||
BuildRequires: %{python_module packaging >= 20.4}
|
||||
BuildRequires: %{python_module pytest}
|
||||
BuildRequires: %{python_module tomli >= 1.2.1 if %python-base < 3.11}
|
||||
BuildRequires: %{python_module trove-classifiers >= 2021.10.20}
|
||||
# /SECTION
|
||||
%python_subpackages
|
||||
|
||||
%description
|
||||
Validation library and CLI tool for checking on 'pyproject.toml' files using JSON Schema
|
||||
|
||||
%prep
|
||||
%setup -q -n validate-pyproject-%{version}
|
||||
sed -i '/--cov/d' setup.cfg
|
||||
|
||||
%build
|
||||
# have to use PEP517: gh#abravalheri/validate-pyproject#52
|
||||
%pyproject_wheel
|
||||
|
||||
%install
|
||||
%pyproject_install
|
||||
%python_clone -a %{buildroot}%{_bindir}/validate-pyproject
|
||||
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
||||
|
||||
%check
|
||||
# Ignore test_pre_compile that fails because how fastjsonschema and
|
||||
# validate-pyproject packages are installed
|
||||
%pytest --ignore tests/test_pre_compile.py --ignore tests/test_vendoring.py -k "not downloaded"
|
||||
|
||||
%post
|
||||
%python_install_alternative validate-pyproject
|
||||
|
||||
%postun
|
||||
%python_uninstall_alternative validate-pyproject
|
||||
|
||||
%pre
|
||||
%python_libalternatives_reset_alternative validate-pyproject
|
||||
|
||||
%files %{python_files}
|
||||
%doc AUTHORS.rst CHANGELOG.rst README.rst
|
||||
%license LICENSE.txt
|
||||
%python_alternative %{_bindir}/validate-pyproject
|
||||
%{python_sitelib}/validate_pyproject
|
||||
%{python_sitelib}/validate_pyproject-%{version}*-info
|
||||
|
||||
%changelog
|
||||
Reference in New Issue
Block a user