File python-trubar.spec of Package python-trubar

#
# spec file for package python-trubar
#
# Copyright (c) 2024 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/
#


Name:           python-trubar
Version:        0.3.4
Release:        0
Summary:        Utility for translation of strings and f-strings in Python files
License:        MIT
URL:            https://github.com/janezd/trubar
Source:         https://files.pythonhosted.org/packages/source/t/trubar/trubar-%{version}.tar.gz
# missing test file
Source1:        https://raw.githubusercontent.com/janezd/trubar/refs/heads/master/trubar/tests/test_module/baz_module/not-python.js
BuildRequires:  python-rpm-macros
BuildRequires:  %{python_module PyYAML}
BuildRequires:  %{python_module libcst}
BuildRequires:  %{python_module pip}
BuildRequires:  %{python_module setuptools}
BuildRequires:  fdupes
Requires:       python-PyYAML
Requires:       python-libcst
Requires(post): update-alternatives
Requires(postun): update-alternatives
BuildArch:      noarch
%python_subpackages

%description
A tool for translation and localization of Python programs via modification of source files.

Trubar supports f-strings and does not require any changes to the original source code, such as marking strings for translation.

%prep
%autosetup -p1 -n trubar-%{version}
cp %{SOURCE1} trubar/tests/test_module/baz_module/

%build
%pyproject_wheel

%install
%pyproject_install
%python_clone -a %{buildroot}%{_bindir}/trubar
%python_expand %fdupes %{buildroot}%{$python_sitelib}

%check
%pyunittest

%post
%python_install_alternative trubar

%postun
%python_uninstall_alternative trubar

%files %{python_files}
%doc README.md
%license LICENSE
%python_alternative %{_bindir}/trubar
%{python_sitelib}/trubar
%{python_sitelib}/trubar-%{version}.dist-info

%changelog
openSUSE Build Service is sponsored by