File python-Transcrypt.spec of Package python-Transcrypt

#
# spec file for package python-Transcrypt
#
# Copyright (c) 2023-2025 Georg Pfuetzenreuter <mail+rpm@georg-pfuetzenreuter.net>
#
# 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/
#


%define appname Transcrypt
%define appname2 transcrypt
%{?sle15_python_module_pythons}
Name:           python-%{appname}
Version:        3.9.4
Release:        0
Summary:        Python to JavaScript compiler
License:        Apache-2.0
Group:          Development/Languages/Python
URL:            https://www.transcrypt.org/
Source0:        %{appname}-%{version}.tar.gz
BuildRequires:  %{python_module setuptools}
BuildRequires:  %{pythons}
BuildRequires:  fdupes
BuildRequires:  python-rpm-macros
Requires:       python-setuptools
Requires(post): update-alternatives
Requires(postun): update-alternatives
BuildArch:      noarch
%if 0%{?suse_version} <= 1500
Requires:       mypy
%else
Requires:       python-mypy
%endif
%python_subpackages

%description
Python 3.9 to JavaScript compiler - Lean, fast, open!

%prep
%autosetup -n %{appname}-%{version}
sed -i '1d' transcrypt/modules/unicodedata/__init__.py

# fix wrong-file-end-of-line-encoding
sed -i 's/\r$//' README.rst

%build
%python_build

%install
%python_install
%python_clone -a %{buildroot}%{_bindir}/%{appname2}
%python_expand %fdupes %{buildroot}%{$python_sitelib}/%{appname2}
%python_expand rm -r %{buildroot}%{$python_sitelib}/%{appname2}/{demos,development,docs,tutorials,ts.bat,ts_travis,modules/org/__pycache__,modules/__future__,modules/__pycache__/__init__.*.pyc}
%python_expand find %{buildroot}%{$python_sitelib}/%{appname2} -size 0 -delete

%post
%{python_install_alternative %{appname2}}

%postun
%{python_uninstall_alternative %{appname2}}

%files %{python_files}
%license LICENSE
%doc README.rst
%dir %{python_sitelib}/%{appname2}
%python_alternative %{_bindir}/%{appname2}
%{python_sitelib}/%{appname2}/{__main__.py,favicon.ico,license_reference.txt,ts,modules}
%pycache_only %{python_sitelib}/%{appname2}/__pycache__
%{python_sitelib}/%{appname}-%{version}-py%{python_version}.egg-info

%changelog
openSUSE Build Service is sponsored by