14
0
forked from pool/micropython

- Add subpackage mpy-tools which contains mpy-cross and mpy-tool

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/micropython?expand=0&rev=36
This commit is contained in:
2025-02-18 11:49:19 +00:00
committed by Git OBS Bridge
parent 9955417dbe
commit d735501d4a
2 changed files with 29 additions and 1 deletions

View File

@@ -1,3 +1,8 @@
-------------------------------------------------------------------
Tue Feb 18 11:48:17 UTC 2025 - Dominik Heidler <dheidler@suse.de>
- Add subpackage mpy-tools which contains mpy-cross and mpy-tool
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Feb 7 10:33:24 UTC 2025 - Dominik Heidler <dheidler@suse.de> Fri Feb 7 10:33:24 UTC 2025 - Dominik Heidler <dheidler@suse.de>

View File

@@ -47,6 +47,11 @@ BuildRequires: %{python_module wheel}
BuildRequires: fdupes BuildRequires: fdupes
BuildRequires: python-rpm-macros BuildRequires: python-rpm-macros
%package -n mpy-tools
Summary: Tools for creating and handling precompiled .mpy files for MicroPython
Provides: mpy-cross
Provides: mpy-tool
%description %description
A lean and efficient Python implementation for microcontrollers and constrained systems A lean and efficient Python implementation for microcontrollers and constrained systems
@@ -54,6 +59,10 @@ A lean and efficient Python implementation for microcontrollers and constrained
This CLI tool provides an integrated set of utilities to remotely interact with This CLI tool provides an integrated set of utilities to remotely interact with
and automate a MicroPython device over a serial connection. and automate a MicroPython device over a serial connection.
%description -n mpy-tools
MicroPython tools like the mpy-cross compiler for compiling.py files to .mpy files.
Also mpy-tool for inspecting .mpy files.
%prep %prep
%autosetup -p1 %autosetup -p1
@@ -62,6 +71,7 @@ sed -i -e "s:/usr/lib/micropython:%{_prefix}/lib/micropython:g" "ports/unix/main
%define make_flags V=1 MICROPY_PY_BTREE=0 MICROPY_PY_USSL=0 %define make_flags V=1 MICROPY_PY_BTREE=0 MICROPY_PY_USSL=0
%build %build
# micropython
export CFLAGS="%optflags -Wno-dangling-pointer" export CFLAGS="%optflags -Wno-dangling-pointer"
%make_build -C mpy-cross %make_build -C mpy-cross
%make_build -C ports/unix STRIP=true %make_build -C ports/unix STRIP=true
@@ -75,16 +85,23 @@ sed -i -e 's_#!/usr/bin/env python3__' mpremote/{__main__,transport,transport_se
popd popd
%install %install
# micropython
install -d %{buildroot}%{_bindir} install -d %{buildroot}%{_bindir}
install -t %{buildroot}%{_bindir} ports/unix/build-standard/micropython install -t %{buildroot}%{_bindir} ports/unix/build-standard/micropython
# mpremote
pushd tools/mpremote pushd tools/mpremote
%pyproject_install %pyproject_install
popd popd
%python3_fix_shebang
%python_expand %fdupes %{buildroot}%{$python_sitelib} %python_expand %fdupes %{buildroot}%{$python_sitelib}
# remove pycache to get rid of rpmlint "W: python-bytecode-inconsistent-mtime" warnings # remove pycache to get rid of rpmlint "W: python-bytecode-inconsistent-mtime" warnings
%python_expand rm -rf %{buildroot}%{$python_sitelib}/mpremote/__pycache__ %python_expand rm -rf %{buildroot}%{$python_sitelib}/mpremote/__pycache__
# mpy-tools
install -m755 -D -v mpy-cross/build/mpy-cross %{buildroot}%{_bindir}/mpy-cross
install -m755 -D -v tools/mpy-tool.py %{buildroot}%{_bindir}/mpy-tool
%python3_fix_shebang
%check %check
%ifnarch x86_64 %ifnarch x86_64
# 2 tests fail: float_parse float_parse_doubleprec # 2 tests fail: float_parse float_parse_doubleprec
@@ -107,4 +124,10 @@ make -C ports/unix PYTHON=%{_bindir}/python%python_version V=1 test
%{_prefix}/lib/python%{python_version}/site-packages/mpremote-%{version}.dist-info %{_prefix}/lib/python%{python_version}/site-packages/mpremote-%{version}.dist-info
%{_bindir}/mpremote %{_bindir}/mpremote
%files -n mpy-tools
%doc mpy-cross/README.md
%license LICENSE
%{_bindir}/mpy-cross
%{_bindir}/mpy-tool
%changelog %changelog