File python-pysim.spec of Package python-pysim
#
# spec file for package python-pysim
#
# Copyright (c) 2016-2025, Martin Hauke <mardnh@gmx.de>
#
# 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 binaries pySim-prog pySim-read pySim-shell pySim-smpp2sim pySim-trace
Name: python-pysim
Version: 1.0.1242
Release: 0
Summary: A python tool to program magic SIMs
License: GPL-2.0-only
URL: https://gitea.osmocom.org/sim-card/pysim
Source: pysim-%{version}.tar.xz
BuildRequires: %{python_module setuptools}
# SECTION Test requirements
BuildRequires: %{python_module asn1tools}
BuildRequires: %{python_module cmd2 >= 1.5.0}
BuildRequires: %{python_module construct >= 2.9.51}
BuildRequires: %{python_module jsonpath-ng}
BuildRequires: %{python_module pyscard}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module pyserial}
BuildRequires: %{python_module pytlv}
BuildRequires: %{python_module gsm0338}
BuildRequires: %{python_module bidict}
BuildRequires: %{python_module pycryptodomex}
BuildRequires: %{python_module cryptography}
BuildRequires: %{python_module PyYAML >= 5.1}
BuildRequires: %{python_module asn1tools}
BuildRequires: %{python_module termcolor}
BuildRequires: %{python_module colorlog}
BuildRequires: %{python_module smpp.pdu}
BuildRequires: %{python_module pyosmocom >= 0.0.3}
# /SECTION
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-asn1tools
Requires: python-cmd2 >= 1.5.0
Requires: python-construct >= 2.9.51
Requires: python-jsonpath-ng
Requires: python-PyYAML >= 5.1
Requires: python-pyscard
Requires: python-pytest
Requires: python-pyserial
Requires: python-packaging
Requires: python-termcolor
Requires: python-colorlog
Requires: python-cryptography
Requires: python-pytlv
Requires: python-gsm0338
Requires: python-bidict
Requires: python-pycryptodomex
Requires: python-smpp.pdu
Requires: python-pyosmocom >= 0.0.3
BuildArch: noarch
Requires(post): update-alternatives
Requires(postun):update-alternatives
%python_subpackages
%description
Python tool to program a variety of SIM/USIM cards with Ki/ICCID/IMSI/...
%prep
%autosetup -n pysim-%{version}
#drop shebang
sed -i -e '/^#!\//, 1d' pySim/ts_102_222.py
%build
%pyproject_wheel
%install
%pyproject_install
%python_expand cd %{buildroot}%{_bindir} && find . -name "*.py" -exec sh -c 'mv $0 `basename "$0" .py`' '{}' \;
for b in %{binaries}; do
%python_clone -a %{buildroot}%{_bindir}/$b
done
#
%python_expand %fdupes %{buildroot}%{$python_sitelib}
#
%python_expand rm %{buildroot}%{_bindir}/_current_flavor
%post
%{lua:for b in rpm.expand("%{binaries}"):gmatch("%S+") do
print(rpm.expand("%python_install_alternative " .. b .. "\n"))
end}
%postun
%{lua:for b in rpm.expand("%{binaries}"):gmatch("%S+") do
print(rpm.expand("%python_uninstall_alternative " .. b .. "\n"))
end}
%check
#%# HACK: remove non working tests
#%rm tests/unittests/test_esim.py
#%rm tests/unittests/test_esim_bsp.py
#%rm tests/unittests/test_esim_saip.py
#%%pytest
%files %{python_files}
%license COPYING
%doc README.md csv-format
%{lua:for b in rpm.expand("%{binaries}"):gmatch("%S+") do
print(rpm.expand("%python_alternative %{_bindir}/" .. b .. "\n"))
end}
%{python_sitelib}/pySim
%{python_sitelib}/pysim-*.dist-info
%changelog