Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package micropython-lib for openSUSE:Factory
checked in at 2025-03-21 20:21:53
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/micropython-lib (Old)
and /work/SRC/openSUSE:Factory/.micropython-lib.new.2696 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "micropython-lib"
Fri Mar 21 20:21:53 2025 rev:2 rq:1254704 version:1.24.1
Changes:
--------
--- /work/SRC/openSUSE:Factory/micropython-lib/micropython-lib.changes
2024-11-06 16:57:26.493711419 +0100
+++
/work/SRC/openSUSE:Factory/.micropython-lib.new.2696/micropython-lib.changes
2025-03-21 20:22:11.790196407 +0100
@@ -1,0 +2,485 @@
+Fri Feb 7 11:48:45 UTC 2025 - Dominik Heidler <[email protected]>
+
+- Update to 1.24.1
+ * aioble: Pass additional connection arguments to gap_connect.
+ * usb-device: Allow signaling capability of remote_wakeup.
+ * lora-sx127x: Fix configuring the implicit header option in the _SX127x.
+ * base64: Remove struct dependency from manifest.
+ * usb: Tidy up the description of TinyUSB callbacks.
+ * usb: Add a note about buffer thread safety.
+ * usb: Fix race if transfers are submitted by a thread.
+ * umqtt.robust: Remove reference to missing example.
+ * CONTRIBUTING: Add extra explanation of "Publish packages for branch".
+ * tools/ci.sh: Add sqlite3 tests to CI.
+ * unix-ffi/sqlite3: Bump version to 0.3.0.
+ * unix-ffi/sqlite3: Add commit and rollback functionality like CPython.
+ * unix-ffi/sqlite3: Change to use close and prepare v2 versions, clean-up.
+ * unix-ffi/sqlite3: Add optional parameter for URI support.
+ * unix-ffi/sqlite3: Fix statements not being finalized.
+ * unix-ffi/sqlite3: Fix bytes to accommodate for different pointer sizes.
+ * tools/build.py: Add "path" entry to index.json.
+ * lora-sx126x: Change to class-level memoryview for _cmd buf.
+ * usb-device-keyboard: Fix ; and ` keycode names.
+ * usb-device-cdc: Fix lost data in read() path if short reads happened.
+ * logging: Fix StreamHandler to call parent constructor.
+ * unittest-discover: Avoid adding test parent dir to sys.path.
+ * github/workflows: Add workflow to run package tests.
+ * hashlib: Only import pure Python hashlib when running test.
+ * fnmatch: Don't require test.support, which no longer exists.
+ * datetime: Skip tests that require the host to be in UTC timezone.
+ * contextlib: Use a list instead of deque for exit callbacks.
+ * quopri: Remove dependency on test.support and subprocess in unit test.
+ * aioble/multitests: Store a reference to tasks and cancel when done.
+ * all: Use non-u versions of built-in modules.
+ * all: Change use of "uasyncio" to "asyncio".
+ * requests: Make possible to override headers and allow raw data upload.
+ * pyusb: Add MicroPython implementation of PyUSB library.
+ * aioble/multitests: Use multitest.output_metric for perf results.
+ * aioble/multitests: Adjust expected output for write capture test.
+ * aioble/multitests: Add test for advertising and scanning services.
+ * aioble/central.py: Fix ScanResult.services when decoding UUIDs.
+ * aioble/peripheral.py: Place multiple UUIDs in single advertisement LTV.
+ * aioble/device.py: Make default timeout None for disconnected() method.
+ * aioble/device.py: Always create connection._event.
+ * aioble/examples/temp_client.py: Check connection before reading temp.
+ * pathlib: Add __rtruediv__ magic method to pathlib.Path.
+ * aioble/examples/temp_sensor.py: Wait forever for client to disconnect.
+ * aioble/examples/temp_sensor.py: Properly notify on update.
+ * aiohttp: Fix type of header's Sec-WebSocket-Key.
+ * all: Enable ruff E401 and E402 import lints.
+ * all: Enable Ruff lint F541 'f-string without any placeholders'.
+ * all: Enable ruff F841 'Local variable is assigned to but never used'.
+ * ntptime: Fix Year 2036 bug.
+ * collections: Remove micropython-lib Python implementation of deque.
+ * mip: Bump minor version.
+ * mip: Add support to mip install from GitLab.
+ * usb: Add USB device support packages.
+ * ssl: Use "from tls import *" to be compatible with axtls.
+ * senml: Use the updated cbor2 API.
+ * cbor2: Deprecate decoder and encoder modules.
+ * json: Move to unix-ffi.
+ * unix-ffi: Remove "unix_ffi" argument from require().
+ * gzip: Fix recursion error in open() function.
+ * lora-sx126x: Clean up some struct formatting.
+ * lora-sx126x: Fix syncword setting.
+ * lora-sx127x: Implement missing syncword support.
+ * lora-sync: Fix race with fast or failed send().
+ * lora-sx126x: Fix invalid default configuration after reset.
+ * tools/ci.sh: Add unix-ffi library when testing unix-ffi subdirectory.
+ * tarfile-write: Fix permissions when adding to archive.
+ * aiohttp: Fix binary data treatment.
+ * hmac: Fix passing in a string for digestmod argument.
+ * ssl: Restructure micropython SSL interface to a new tls module.
+ * umqtt.simple: Simplify check for user being unused.
+ * aiohttp: Add new aiohttp package.
+ * aioble: Fix advertising variable name to use us not ms.
+ * uaiohttpclient: Update example client code.
+ * uaiohttpclient: Update "yield from" to "await".
+ * uaiohttpclient: Make flake8 inspired improvements.
+ * uaiohttpclient: Fix hard coded port 80.
+ * os-path: Implement os.path.isfile().
+ * aiorepl: Add support for raw mode (ctrl-a).
+ * aiorepl: Add cursor left/right support.
+ * aiorepl: Add support for paste mode (ctrl-e).
+ * aiorepl: Update import of asyncio.
+ * base64: Implement custom maketrans and translate methods.
+ * time: Add README to explain the purpose of the time extension library.
+ * lcd160cr: Remove support for options in manifest.
+ * all: Replace "black" with "ruff format".
+ * tools/verifygitlog.py: Add git commit message checking.
+ * unix-ffi/re: Convert to PCRE2.
+ * .github/workflows/ruff.yml: Pin to 0.1.0.
+ * requests: Fix detection of iterators in chunked data requests.
+ * aioble/server.py: Allow BufferedCharacteristic to support all ops.
+ * aioble/server.py: Add data arg for indicate.
+ * __future__: Add "annotations".
+ * all: Remove unnecessary start argument in range.
+ * lora/sx126x: Fix busy timeout handling.
+ * lora: Note known issue with STM32WL5 HP antenna.
+ * lora: Add STM32WL55 subghz LoRa modem class.
+ * lora: Remove the pin parameter from IRQ callback.
+ * wm8960: Bump patch version.
+ * lsm6dsox: Bump patch version.
+ * top: Enable Ruff linter to check undefined-name (F821).
+ * uaiohttpclient: Fix missing name in unreachable example code.
+ * iperf3: Pre-declare some variables set in the loop.
+ * cbor2: Improve decoder to pass Ruff F821 undefined-name.
+ * all: Add missing const imports
+ * wm8960: Add missing self reference for sample table.
+ * lsm6dsox: Add missing time import.
+ * bmm150: Remove broken reset function.
+ * drivers/display/lcd160cr: Use isinstance() for type checking.
+ * iperf3: Add compatibility for servers pre version 3.2.
+ * github/workflows: Split ruff into its own action.
+ * tools/codeformat.py: Fix ruff warnings.
+ * top: Add pre-commit config.
+ * tools/codeformat.py: Remove git state detection.
+ * zlib: Add zlib module.
+ * all: Lint Python code with ruff.
+ * github/workflows: Build all example .py files as part of CI.
+ * all: Standardise x.y.z versioning for all packages.
+ * logging: Bump minor version.
+ * copy: Bump patch version.
+ * xmltok: Bump patch version.
+ * aiorepl: Bump patch version.
+ * requests: Rename urequests to requests.
+ * tarfile: Rename from utarfile.
+ * fnmatch: Fix compatibility with ure -> re.
+ * all: Remove __version__ from .py files.
+ * aiorepl: Replace f-string with str.format.
+ * copy: Declare dependency on types.
+ * logging: Add full support for logging exception tracebacks.
+ * keyword: Add manifest file.
+ * json: Add manifest file.
+ * bisect: Add manifest file.
+ * types: Add manifest file.
+ * aiorepl/README.md: More info about globals.
+ * xmltok: Change StopIteration to EOFError due to PEP-479.
+ * cmd: Remove comments about using the string module.
+ * utarfile: Fix read/write handling of nulls in tar header.
+ * hashlib: Refactor, split, and optimise.
+ * lora: Workaround SX1262 bug with GetStatus.
+ * lora: Add lora modem drivers for SX127x and SX126x.
+ * utarfile: Support creating/appending tar files.
+ * aioespnow: Add library providing asyncio support for espnow module.
+ * aioble: Fix descriptor flag handling.
+ * senml: Allow publishing to PyPI as micropython-senml.
+ * tools/makepyproject.py: Add tool to generate PyPI package.
+ * micropython: Add missing metadata for packages.
+ * python-ecosys: Add pypi= to metadata.
+ * unittest-discover: Print results when no tests are found/run.
+ * iperf3: Support devices without os.urandom().
+ * senml: Fix data record encoding to use binascii instead of base64.
+ * senml: Remove u-module prefix from imports.
+ * cbor2: Remove u-module prefix from imports.
+ * github/workflows: Attach built packages to GitHub workflow artifacts.
+ * tools/ci.sh: Support publishing package and index files to GitHub Pages.
+ * senml: Add SenML library.
+ * cbor2: Add cbor2 library.
+ * aioble: Add short name support to scan results.
+ * unittest: Add subtest usage examples.
+ * bmm150: Add new magnetometer driver.
+ * bmi270: Add new IMU driver.
+ * lsm9ds1: Refactor driver.
+ * lsm6dsox: Refactor driver.
+ * hs3003: Add new relative humidity and temperature sensor driver.
+ * top: Update Python formatting to black "2023 stable style".
+ * github/workflows: Add workflow to build all packages.
+ * bundle-networking: Fix metadata to correctly use "description" field.
+ * glob: Fix require of os-path.
+ * urllib.parse: Fix require of collections-defaultdict.
+ * micropython/bundles: Add a bundle-networking meta-package.
+ * unittest: Remove dependence on sys.exc_info.
+ * aioble/README.md: Demostrate optional args to aioble.scan().
+ * logging: Bump version to 0.5.
+ * logging: Simplify check for strftime.
+ * logging: Fall back to root logger level for unset child.
+ * top: Update top-level docs.
+ * time: Add unit test for time.strftime.
+ * time: Add time module to provide strftime.
+ * logging: Improve the logging module.
+ * pathlib: Add initial pathlib implementation.
+ * nrf24l01: Improve test to add RP2 support, fix ESP32.
+ * sensor/mhz19: Add driver for MH-Z19 (CO2 sensor).
+ * sdcard: Set MISO high before readblocks/writeblocks.
+ * tempfile: Add manifest.py file at version 0.0.1.
+ * tempfile: Add unit tests for tempfile, and don't use os.path.join.
+ * shutil: Add unit tests for shutil.
+ * shutil: Don't allow an empty string in rmtree.
+ * shutil: Fix shutil.rmtree to use os.ilistdir instead of os.walk.
+ * tempfile: Add initial tempfile implementation.
+ * dht: Fix regression importing dht_readinto from pyb.
+ * unittest: Convert to a package.
+ * shutil: Add disk_usage function.
+ * venv: Add a command-line package for creating virtual environments.
+ * mip: Set opt=3 by default.
+ * micropython/mip: Add command-line functionality for the Unix port.
+ * aiorepl: Fix ordering of saving previous character.
+ * aiorepl: Ignore duplicate LFLF after converting CRLF from Windows.
+ * aioble/client.py: Fix default for the `response` arg to char.write().
+ * espflash: Add a minimal ESP32 bootloader protocol implementation.
+ * dht: Change the sequence for importing dht_readinto.
+ * ntptime: Allow overriding default NTP timeout.
+ * aioble: Split into optional components.
+ * umqtt.robust: Fix check_msg blocking after reconnect.
+ * umqtt.simple: Return op from wait_msg() as indication of reception.
+ * unittest: Make AssertRaisesContext store exception for later retrieval.
+ * os.path: Remove external / ffi dependencies in os.path.
+ * tools/build.py: Make build.py work without f-strings.
+ * micropython/mip: Add a new `mip` library for on-device installation.
+ * tools/build.py: Add script for deploying to a static web server.
+ * uu: Fix dependency on os-path.
+ * aioble/server.py: Maintain write order for captured characteristics.
+ * aioble/l2cap: Fix psm variable name.
+ * micropython/aiorepl: Initial version of an asyncio REPL.
+ * os: Import `path` automatically if available.
+ * collections: Rename collections.* to collections-*.
+ * os: Rename os.path to os-path.
+ * unittest: Move back to python-stdlib.
+ * argparse: Move back to python-stdlib.
+ * python-stdlib: Remove pystone (and variants).
+ * aioble/multitests: Add descriptor multitest.
+ * aioble/client.py: Make read/write events work for descriptors.
+ * aioble/server.py: Fix registration for descriptors.
+ * aioble/client.py: Use characteristic end handle (when available).
+ * micropython/net: Add "ntptime" client from main repo.
+ * micropython/net: Add "webrepl" server from main repo.
+ * micropython/drivers: Move "sdcard" driver from main repo.
+ * micropython/drivers: Move "lps22h" sensor driver from main repo.
+ * micropython/drivers: Move "hts221" sensor driver from main repo.
+ * micropython/drivers: Move "dx18x20" sensor driver from main repo.
+ * micropython/drivers: Move "dht" sensor driver from main repo.
+ * micropython/drivers: Move "nrf24l01" radio driver from main repo.
+ * micropython/drivers: Move "neopixel" led driver from main repo.
+ * micropython/drivers: Move "lsm6sox" imu driver from main repo.
+ * micropython/drivers: Move "lsm9ds1" imu driver from main repo.
+ * micropython/drivers: Move "ssd1306" display driver from main repo.
+ * micropython/drivers: Move "lcd160cr" display driver from main repo.
+ * micropython/drivers: Move "wm8960" codec driver from main repo.
+ * micropython/drivers: Move "onewire" bus driver from main repo.
+ * unix-ffi: Move more unix-only packages to unix-ffi.
+ * all: Replace metadata.txt with manifest.py.
+ * micropython/upip: Remove upip library.
+ * all: Remove all setup.py files.
+ * aioble: Make l2cap chunk size configurable to allow optimization by app.
+ * aioble: Fix missing GattError import in server.py.
+ * aioble: Add timeout to device.exchange_mtu.
+ * python-ecosys/pyjwt/jwt.py: Fix missing whitespace.
+ * python-stdlib/hmac: Update to work with built-in hash functions.
+ * python-ecosys/pyjwt: Add pyjwt-compatible module.
+ * urequests: Release 0.7.0.
+ * urequests: Add timeout, passed to underlying socket if supported.
+ * urequests: Raise error when server doesn't respond with valid http.
+ * urequests: Always open sockets in SOCK_STREAM mode.
+ * urequests: Add support for redirects.
+ * urequests: Add support for requests with chunked upload data.
+ * binascii: Implement newline param in function b2a_base64.
+ * urequests: Add Basic Authentication support.
+ * urequests: Fix raising unsupported Transfer-Encoding exception.
+ * urequests: Explicitly add "Connection: close" to request headers.
+ * urequests: Add ability to parse response headers.
+ * unittest: Version 0.9.0
+ * unittest: Add support for specifying custom TestRunner.
+ * unittest: Add setUpClass and tearDownClass handling.
+ * unittest: Improve failure text consistency with cpython.
+ * unittest: Add exception capturing for subTest.
+ * unittest: Reset python env between tests.
+ * unittest: Add test for environment isolation.
+ * unittest: Add discover function.
+ * unittest: Run test_* functions as well as TestCase classes.
+ * unittest: Print module name on result lines.
+ * unittest: Support TestCase subclasses with own runTest() method.
+ * unittest: Add TextTestRunner as alias for TestRunner.
+ * unittest: Print no. of skipped tests in a way compatible with CPython.
+ * unittest: test_unittest: Add tests for expectedFailure decorator.
+ * unittest: Add expectedFailure decorator.
+ * unittest: Support recursive TestSuite's.
+ * unittest: Properly handle failures vs errors.
+ * unittest: Implement basic addCleanup()/doCleanup().
+ * unittest: TestSuite: Add run() method.
+ * unittest: Add dummy TestCase.assertWarns() context manager.
+ * unittest: Add dummy TestCase.subTest() context manager.
+ * unittest: Add TestCase.skipTest() method.
+ * unittest: TestCase: Add (dummy) __init__.
+ * unittest: Support both test classes and class instances.
+ * unittest: Only treat callable fields as test methods.
+ * unittest: TestSuite: Add undescore to internal field, self._tests.
+ * unittest: Reinstate useful debugger helper.
+ * unittest: Add assertLessEqual, assertGreaterEqual methods.
+ * unittest: AssertRaisesContext: Store exception value as self.exception.
+ * unittest: test_unittest: Typo fix.
+ * unittest: test_unittest: Add test for .assertRaises(AssertionError).
+ * unittest: Allow to catch AssertionError with assertRaises().
+ * unittest: test_unittest.py: Fix typo in method name.
+ * unittest: Log failure tracebacks at test end.
+ * unittest: Allow passing module name or instance into unittest.main()
+ * fnmatch: Release 0.6.0.
+ * fnmatch: Remove dependency on os.path.
++++ 188 more lines (skipped)
++++ between /work/SRC/openSUSE:Factory/micropython-lib/micropython-lib.changes
++++ and
/work/SRC/openSUSE:Factory/.micropython-lib.new.2696/micropython-lib.changes
Old:
----
_multibuild
micropython-lib-1.9.3.tar.gz
New:
----
access_index_from_local_fs.patch
manifestfile.py
micropython-lib-1.24.1.tar.gz
mpy_cross.py
BETA DEBUG BEGIN:
New: * Install all packages from local index using mip
* Backport access_index_from_local_fs.patch to avoid using http for serving
the index
BETA DEBUG END:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ micropython-lib.spec ++++++
--- /var/tmp/diff_new_pack.pfpAmc/_old 2025-03-21 20:22:12.394221536 +0100
+++ /var/tmp/diff_new_pack.pfpAmc/_new 2025-03-21 20:22:12.394221536 +0100
@@ -1,7 +1,7 @@
#
-# spec file
+# spec file for package micropython-lib
#
-# Copyright (c) 2022 SUSE LLC
+# 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
@@ -16,26 +16,22 @@
#
-%define flavor @BUILD_FLAVOR@%{nil}
-%if "%{flavor}" != "testsuite"
-%define name_suffix %{nil}
-%else
-%define name_suffix -%{flavor}
-%endif
-Name: micropython-lib%{name_suffix}
-Version: 1.9.3
+Name: micropython-lib
+Version: 1.24.1
Release: 0
Summary: Core Python libraries ported to MicroPython
License: MIT AND Python-2.0
Group: Development/Libraries/Python
URL: https://github.com/micropython/micropython-lib
Source:
https://github.com/micropython/micropython-lib/archive/v%{version}.tar.gz#/micropython-lib-%{version}.tar.gz
+Source1:
https://raw.githubusercontent.com/micropython/micropython/refs/tags/v%{version}/tools/manifestfile.py
+Source2:
https://raw.githubusercontent.com/micropython/micropython/refs/tags/v%{version}/mpy-cross/mpy_cross/__init__.py#/mpy_cross.py
+Patch1: access_index_from_local_fs.patch
BuildRequires: fdupes
BuildArch: noarch
-%if "%{flavor}" == "testsuite"
BuildRequires: micropython
-BuildRequires: micropython-lib
-%endif
+BuildRequires: mpy-tools
+BuildRequires: python3
%description
micropython-lib is a project to develop a non-monolothic standard library for
MicroPython.
@@ -43,33 +39,43 @@
Each module is either written from scratch or ported from CPython.
%prep
-%setup -q -n micropython-lib-%{version}
+%autosetup -p1 -n micropython-lib-%{version}
+
+# prepare build.py dependencies
+cp %SOURCE1 ./tools/manifestfile.py
+mkdir tools/mpy_cross
+cp %SOURCE2 ./tools/mpy_cross/__init__.py
+
+# bootstrap mip
+mkdir mip
+cp -r micropython/mip/mip/* mip/
+cp -r micropython/mip-cmdline/mip/* mip/
%build
-%if "%{flavor}" != "testsuite"
-%make_build
-%endif
+# build mip index
+python3 ./tools/build.py --mpy-cross %{_bindir}/mpy-cross --output ./mip_index
%install
-%if "%{flavor}" != "testsuite"
-%make_install PREFIX=%{buildroot}%{_prefix}/lib/micropython
+# install all pkgs from index
+for pkg in $(python3 -c 'import json;[print(p["name"]) for p in
json.load(open("mip_index/index.json"))["packages"]]') ; do
+ micropython -m mip install --no-mpy -t
%{buildroot}%{_prefix}/lib/micropython -i file://mip_index "$pkg"
+done
+
# Fix rpm runtime dependency rpmlint error replace the shebang in all the
scripts with %%{_bindir}/python3
find %{buildroot}%{_prefix}/lib/micropython -name "*.py" -exec sed -i 's|#!
%{_bindir}/env python3|#!%{_bindir}/python3|' {} ";"
find %{buildroot}%{_prefix}/lib/micropython -name "*.py" -exec sed -i 's|#!
%{_prefix}/local/bin/python|#!%{_bindir}/python3|' {} ";"
# Fix permissions
-chmod 0755
%{buildroot}%{_prefix}/lib/micropython/{base64,cgi,keyword,quopri,timeit,uu}.py
+chmod 0755 %{buildroot}%{_prefix}/lib/micropython/{base64,keyword,quopri,uu}.py
# Run fdupes
%fdupes %{buildroot}%{_prefix}/lib/micropython
-%endif
-%if "%{flavor}" == "testsuite"
%check
-micropython -v ./test/test_pep380.py
-%endif
+# check that we can import a module that we just installed and that it
actually works
+cd %{buildroot}%{_prefix}/lib/micropython
+micropython -c 'import hashlib; s=hashlib.sha384("foo").hexdigest(); assert
s.startswith("98c11ffdf")'
-%if "%{flavor}" != "testsuite"
%files
%license LICENSE
+%doc README.md
%{_prefix}/lib/micropython
-%endif
++++++ access_index_from_local_fs.patch ++++++
>From 65adc276a3e76e51b8c9c6770a2611679e607f3f Mon Sep 17 00:00:00 2001
From: Dominik Heidler <[email protected]>
Date: Fri, 14 Mar 2025 14:01:39 +0100
Subject: [PATCH] micropython/mip: Allow accessing index from local filesystem.
Just set the index to `file://relative/path` or `file:///absolute/path`.
Signed-off-by: Dominik Heidler <[email protected]>
---
micropython/mip/mip/__init__.py | 29 +++++++++++++++++++++--------
1 file changed, 21 insertions(+), 8 deletions(-)
diff --git a/micropython/mip/mip/__init__.py b/micropython/mip/mip/__init__.py
index 8920ad8f4..4b4a8c79f 100644
--- a/micropython/mip/mip/__init__.py
+++ b/micropython/mip/mip/__init__.py
@@ -91,6 +91,14 @@ def _rewrite_url(url, branch=None):
def _download_file(url, dest):
+ if url.startswith("file://"):
+ print("Copying:", dest)
+ src = url[7:]
+ _ensure_path_exists(dest)
+ with open(src, "b") as sf:
+ with open(dest, "wb") as f:
+ _chunk(sf, f.write)
+ return True
response = requests.get(url)
try:
if response.status_code != 200:
@@ -108,15 +116,20 @@ def _download_file(url, dest):
def _install_json(package_json_url, index, target, version, mpy):
- response = requests.get(_rewrite_url(package_json_url, version))
- try:
- if response.status_code != 200:
- print("Package not found:", package_json_url)
- return False
+ if package_json_url.startswith("file://"):
+ import json
- package_json = response.json()
- finally:
- response.close()
+ package_json = json.load(open(package_json_url[7:]))
+ else:
+ response = requests.get(_rewrite_url(package_json_url, version))
+ try:
+ if response.status_code != 200:
+ print("Package not found:", package_json_url)
+ return False
+
+ package_json = response.json()
+ finally:
+ response.close()
for target_path, short_hash in package_json.get("hashes", ()):
fs_target_path = target + "/" + target_path
if _check_exists(fs_target_path, short_hash):
++++++ manifestfile.py ++++++
++++ 656 lines (skipped)
++++++ micropython-lib-1.9.3.tar.gz -> micropython-lib-1.24.1.tar.gz ++++++
++++ 96071 lines of diff (skipped)
++++++ mpy_cross.py ++++++
#!/usr/bin/env python3
#
# This file is part of the MicroPython project, http://micropython.org/
#
# The MIT License (MIT)
#
# Copyright (c) 2022 Andrew Leech
# Copyright (c) 2022 Jim Mussared
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
from __future__ import print_function
import os
import re
import stat
import subprocess
NATIVE_ARCHS = {
"NATIVE_ARCH_NONE": "",
"NATIVE_ARCH_X86": "x86",
"NATIVE_ARCH_X64": "x64",
"NATIVE_ARCH_ARMV6": "armv6",
"NATIVE_ARCH_ARMV6M": "armv6m",
"NATIVE_ARCH_ARMV7M": "armv7m",
"NATIVE_ARCH_ARMV7EM": "armv7em",
"NATIVE_ARCH_ARMV7EMSP": "armv7emsp",
"NATIVE_ARCH_ARMV7EMDP": "armv7emdp",
"NATIVE_ARCH_XTENSA": "xtensa",
"NATIVE_ARCH_XTENSAWIN": "xtensawin",
"NATIVE_ARCH_RV32IMC": "rv32imc",
}
globals().update(NATIVE_ARCHS)
__all__ = ["version", "compile", "run", "CrossCompileError"] +
list(NATIVE_ARCHS.keys())
class CrossCompileError(Exception):
pass
_VERSION_RE = re.compile("mpy-cross emitting mpy v([0-9]+)(?:.([0-9]+))?")
def _find_mpy_cross_binary(mpy_cross):
if mpy_cross:
return mpy_cross
return os.path.abspath(os.path.join(os.path.dirname(__file__),
"../build/mpy-cross"))
def mpy_version(mpy_cross=None):
"""
Get the version and sub-version of the .mpy file format generated by this
version of mpy-cross.
Returns: A tuple of `(mpy_version, mpy_sub_version)`
Optional keyword arguments:
- mpy_cross: Specific mpy-cross binary to use
"""
version_info = run(["--version"], mpy_cross=mpy_cross)
match = re.search(_VERSION_RE, version_info)
mpy_version, mpy_sub_version = int(match.group(1)), int(match.group(2) or
"0")
return (
mpy_version,
mpy_sub_version,
)
def compile(src, dest=None, src_path=None, opt=None, march=None,
mpy_cross=None, extra_args=None):
"""
Compile the specified .py file with mpy-cross.
Returns: Standard output from mpy-cross as a string.
Required arguments:
- src: The path to the .py file
Optional keyword arguments:
- dest: The output .mpy file. Defaults to `src` (with .mpy extension)
- src_path: The path to embed in the .mpy file (defaults to `src`)
- opt: Optimisation level (0-3, default 0)
- march: One of the `NATIVE_ARCH_*` constants (defaults to
NATIVE_ARCH_NONE)
- mpy_cross: Specific mpy-cross binary to use
- extra_args: Additional arguments to pass to mpy-cross (e.g. `["-X",
"emit=native"]`)
"""
if not src:
raise ValueError("src is required")
if not os.path.exists(src):
raise CrossCompileError("Input .py file not found: {}.".format(src))
args = []
if src_path:
args += ["-s", src_path]
if dest:
args += ["-o", dest]
if march:
args += ["-march=" + march]
if opt is not None:
args += ["-O{}".format(opt)]
if extra_args:
args += extra_args
args += [src]
run(args, mpy_cross)
def run(args, mpy_cross=None):
"""
Run mpy-cross with the specified command line arguments.
Prefer to use `compile()` instead.
Returns: Standard output from mpy-cross as a string.
Optional keyword arguments:
- mpy_cross: Specific mpy-cross binary to use
"""
mpy_cross = _find_mpy_cross_binary(mpy_cross)
if not os.path.exists(mpy_cross):
raise CrossCompileError("mpy-cross binary not found at
{}.".format(mpy_cross))
try:
st = os.stat(mpy_cross)
os.chmod(mpy_cross, st.st_mode | stat.S_IEXEC)
except OSError:
pass
try:
return subprocess.check_output([mpy_cross] + args,
stderr=subprocess.STDOUT).decode()
except subprocess.CalledProcessError as er:
raise CrossCompileError(er.output.decode())