File python-python-hcl2.spec of Package python-python-hcl2
#
# spec file for package python-python-hcl2
#
# Copyright (c) 2023 SUSE LLC
#
# 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/
#
%{?sle15_python_module_pythons}
Name: python-python-hcl2
Version: 5.1.1
Release: 0
Summary: A parser for HCL2
License: MIT
URL: https://github.com/amplify-education/python-hcl2
# PyPI tarball does not contain tests...
Source: python-hcl2-%{version}.tar.gz
BuildRequires: python-rpm-macros
BuildRequires: git-core
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools >= 61.2.0}
BuildRequires: %{python_module setuptools_scm >= 3.4.3}
BuildRequires: %{python_module wheel}
BuildRequires: %{python_module lark >= 1}
# SECTION test requirements
BuildRequires: %{python_module pytest}
# /SECTION
BuildRequires: fdupes
Requires(post): update-alternatives
Requires(postun): update-alternatives
Requires: python-lark >= 1
BuildArch: noarch
%python_subpackages
%description
A parser for HCL2
%prep
%autosetup -p1 -n python-hcl2-%{version}
%build
%pyproject_wheel
%install
%pyproject_install
%python_clone -a %{buildroot}%{_bindir}/hcl2tojson
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%python_expand sed -i 's#/env python.*$#/python%{$python_version}#g' %{buildroot}%{$python_sitelib}/hcl2/__main__.py
%python_expand chmod 755 %{buildroot}%{$python_sitelib}/hcl2/__main__.py
%check
%pytest
%post
%python_install_alternative hcl2tojson
%postun
%python_uninstall_alternative hcl2tojson
%files %{python_files}
%doc CHANGELOG.md README.md
%license LICENSE
%python_alternative %{_bindir}/hcl2tojson
%{python_sitelib}/hcl2
%{python_sitelib}/python_hcl2-%{version}.dist-info
%changelog