File python-rshell.spec of Package python-rshell
#
# spec file for package python-rshell
#
# Copyright (c) 2025 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-rshell
Version: 0.0.36
Release: 0
Summary: Remote MicroPython shell
License: MIT
URL: https://github.com/dhylands/rshell
Source0: https://github.com/dhylands/rshell/archive/refs/tags/v0.0.36.tar.gz#/rshell-%{version}.tar.gz
BuildArch: noarch
BuildRequires: %{python_module base >= 3.6}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-pyserial
Requires: python-pyudev
Requires(post): update-alternatives
Requires(postun): update-alternatives
%python_subpackages
%description
This is a simple shell which runs on the host and uses MicroPython's raw-REPL to send python snippets to the pyboard in order to get filesystem information, and to copy files to and from MicroPython's filesystem.
It also has the ability to invoke the regular REPL, so rshell can be used as a terminal emulator as well.
%prep
%autosetup -n rshell-%{version}
# don't package tests
sed -i -e "s/, 'tests'//" setup.py
# remove useless shebangs
sed -i -e 's_#!/usr/bin/env python3__' rshell/*.py
%build
%pyproject_wheel
# tests can't run as they require a micropython board connected via USB
%install
%pyproject_install
%python_clone -a %{buildroot}%{_bindir}/rshell
%python_clone -a %{buildroot}%{_bindir}/pyboard
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%pre
%python_libalternatives_reset_alternative rshell pyboard
%post
%{python_install_alternative rshell pyboard}
%postun
%python_uninstall_alternative rshell pyboard
%files %{python_files}
%license LICENSE
%doc README.rst
%{python_sitelib}/rshell
%{python_sitelib}/rshell-%{version}.dist-info
%python_alternative %{_bindir}/rshell
%python_alternative %{_bindir}/pyboard
%changelog