littlefs-python 0.19.0__tar.gz → 0.19.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- littlefs_python-0.19.2/.github/workflows/abi3.yml +42 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/.github/workflows/deploy.yml +3 -3
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/.github/workflows/run-tests.yml +1 -1
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/PKG-INFO +7 -1
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/README.rst +6 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/setup.py +21 -1
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/src/littlefs/__init__.py +11 -3
- littlefs_python-0.19.2/src/littlefs/lfs.c +28694 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/src/littlefs/lfs.pxd +3 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/src/littlefs/lfs.pyx +67 -16
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/src/littlefs_python.egg-info/PKG-INFO +7 -1
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/src/littlefs_python.egg-info/SOURCES.txt +1 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/src/littlefs_python.egg-info/scm_file_list.json +1 -0
- littlefs_python-0.19.2/src/littlefs_python.egg-info/scm_version.json +8 -0
- littlefs_python-0.19.2/test/test_attr.py +57 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/test/test_block_count.py +3 -1
- littlefs_python-0.19.2/test/test_context.py +236 -0
- littlefs_python-0.19.0/src/littlefs/lfs.c +0 -42316
- littlefs_python-0.19.0/src/littlefs_python.egg-info/scm_version.json +0 -8
- littlefs_python-0.19.0/test/test_attr.py +0 -26
- littlefs_python-0.19.0/test/test_context.py +0 -41
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/.gitattributes +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/.github/dependabot.yml +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/.gitignore +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/.gitmodules +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/.pre-commit-config.yaml +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/.readthedocs.yml +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/LICENSE +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/MANIFEST.in +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/ci/build-wheels.sh +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/ci/download_release_files.py +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/docs/Makefile +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/docs/api/index.rst +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/docs/cli.rst +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/docs/conf.py +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/docs/doc8.ini +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/docs/examples/index.rst +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/docs/index.rst +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/docs/make.bat +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/docs/requirements.txt +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/docs/usage.rst +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/examples/mkfsimg.py +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/examples/walk.py +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/.git +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/.gitattributes +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/.github/workflows/post-release.yml +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/.github/workflows/release.yml +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/.github/workflows/status.yml +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/.github/workflows/test.yml +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/.gitignore +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/DESIGN.md +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/LICENSE.md +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/Makefile +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/README.md +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/SPEC.md +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/bd/lfs_emubd.c +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/bd/lfs_emubd.h +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/bd/lfs_filebd.c +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/bd/lfs_filebd.h +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/bd/lfs_rambd.c +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/bd/lfs_rambd.h +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/benches/bench_dir.toml +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/benches/bench_file.toml +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/benches/bench_superblock.toml +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/lfs.c +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/lfs.h +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/lfs_util.c +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/lfs_util.h +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/runners/bench_runner.c +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/runners/bench_runner.h +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/runners/test_runner.c +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/runners/test_runner.h +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/scripts/bench.py +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/scripts/changeprefix.py +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/scripts/code.py +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/scripts/cov.py +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/scripts/data.py +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/scripts/perf.py +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/scripts/perfbd.py +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/scripts/plot.py +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/scripts/plotmpl.py +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/scripts/prettyasserts.py +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/scripts/readblock.py +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/scripts/readmdir.py +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/scripts/readtree.py +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/scripts/stack.py +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/scripts/structs.py +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/scripts/summary.py +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/scripts/tailpipe.py +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/scripts/teepipe.py +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/scripts/test.py +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/scripts/tracebd.py +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/scripts/watch.py +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/tests/test_alloc.toml +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/tests/test_attrs.toml +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/tests/test_badblocks.toml +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/tests/test_bd.toml +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/tests/test_compat.toml +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/tests/test_dirs.toml +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/tests/test_entries.toml +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/tests/test_evil.toml +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/tests/test_exhaustion.toml +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/tests/test_files.toml +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/tests/test_interspersed.toml +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/tests/test_move.toml +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/tests/test_orphans.toml +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/tests/test_paths.toml +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/tests/test_powerloss.toml +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/tests/test_relocations.toml +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/tests/test_seek.toml +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/tests/test_shrink.toml +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/tests/test_superblocks.toml +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/littlefs/tests/test_truncate.toml +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/mypy.ini +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/pyproject.toml +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/requirements.txt +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/setup.cfg +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/src/littlefs/__main__.py +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/src/littlefs/context.py +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/src/littlefs/errors.py +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/src/littlefs/lfs.pyi +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/src/littlefs/py.typed +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/src/littlefs/repl.py +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/src/littlefs_python.egg-info/dependency_links.txt +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/src/littlefs_python.egg-info/entry_points.txt +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/src/littlefs_python.egg-info/not-zip-safe +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/src/littlefs_python.egg-info/requires.txt +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/src/littlefs_python.egg-info/top_level.txt +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/test/cli/test_create_and_extract.py +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/test/cli/test_create_and_repl.py +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/test/cli/test_walk_all.py +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/test/lfs/conftest.py +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/test/lfs/test_dir_functions.py +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/test/lfs/test_file_functions.py +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/test/lfs/test_fs_functions.py +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/test/test_directories.py +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/test/test_files.py +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/test/test_grow.py +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/test/test_multiversion.py +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/test/test_name_max.py +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/test/test_remove_rename.py +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/test/test_unicode_filenames.py +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/test/test_version.py +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/test/test_walk.py +0 -0
- {littlefs_python-0.19.0 → littlefs_python-0.19.2}/test/test_windisk_context.py +0 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Builds the stable-ABI (abi3) wheel on the oldest Python it supports and runs the tests with it. Anything
|
|
2
|
+
# the extension uses outside that version's limited API (e.g. a typed memoryview, which needs Py_buffer
|
|
3
|
+
# before Python 3.11) fails here, at compile or at import. Later Pythons are covered by the stable ABI's own
|
|
4
|
+
# guarantee.
|
|
5
|
+
|
|
6
|
+
name: abi3
|
|
7
|
+
|
|
8
|
+
on:
|
|
9
|
+
push:
|
|
10
|
+
branches: [master]
|
|
11
|
+
pull_request:
|
|
12
|
+
branches: [master]
|
|
13
|
+
|
|
14
|
+
env:
|
|
15
|
+
LIMITED_API: "3.9"
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
abi3:
|
|
19
|
+
runs-on: ubuntu-22.04
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v7
|
|
22
|
+
with:
|
|
23
|
+
submodules: "recursive"
|
|
24
|
+
fetch-depth: 0
|
|
25
|
+
- name: Set up Python ${{ env.LIMITED_API }}
|
|
26
|
+
uses: actions/setup-python@v7
|
|
27
|
+
with:
|
|
28
|
+
python-version: ${{ env.LIMITED_API }}
|
|
29
|
+
- name: Build the abi3 wheel
|
|
30
|
+
env:
|
|
31
|
+
LITTLEFS_PY_LIMITED_API: ${{ env.LIMITED_API }}
|
|
32
|
+
run: |
|
|
33
|
+
python -m pip install --upgrade pip build
|
|
34
|
+
python -m build --wheel
|
|
35
|
+
- name: Install the abi3 wheel
|
|
36
|
+
run: |
|
|
37
|
+
pip install -r requirements.txt
|
|
38
|
+
pip install dist/*-abi3-*.whl
|
|
39
|
+
python -c "import littlefs.lfs as m; assert m.__file__.endswith('.abi3.so'), m.__file__; print(m.__file__)"
|
|
40
|
+
- name: Test with pytest
|
|
41
|
+
run: |
|
|
42
|
+
pytest
|
|
@@ -102,7 +102,7 @@ jobs:
|
|
|
102
102
|
CIBW_ARCHS_WINDOWS: "ARM64"
|
|
103
103
|
|
|
104
104
|
steps:
|
|
105
|
-
- uses: actions/checkout@
|
|
105
|
+
- uses: actions/checkout@v7
|
|
106
106
|
with:
|
|
107
107
|
submodules: "recursive"
|
|
108
108
|
fetch-depth: 0
|
|
@@ -110,7 +110,7 @@ jobs:
|
|
|
110
110
|
- name: Build wheels
|
|
111
111
|
uses: pypa/cibuildwheel@v3.4.1
|
|
112
112
|
|
|
113
|
-
- uses: actions/upload-artifact@
|
|
113
|
+
- uses: actions/upload-artifact@v7
|
|
114
114
|
with:
|
|
115
115
|
name: wheels-windows-arm64
|
|
116
116
|
path: ./wheelhouse/*.whl
|
|
@@ -145,7 +145,7 @@ jobs:
|
|
|
145
145
|
pattern: wheels-*
|
|
146
146
|
merge-multiple: true
|
|
147
147
|
|
|
148
|
-
- uses: pypa/gh-action-pypi-publish@v1.14.
|
|
148
|
+
- uses: pypa/gh-action-pypi-publish@v1.14.3
|
|
149
149
|
with:
|
|
150
150
|
user: __token__
|
|
151
151
|
password: ${{ secrets.pypi_api_token }}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: littlefs-python
|
|
3
|
-
Version: 0.19.
|
|
3
|
+
Version: 0.19.2
|
|
4
4
|
Summary: A python wrapper for littlefs
|
|
5
5
|
Home-page: https://github.com/jrast/littlefs-python
|
|
6
6
|
Author: Jürg Rast
|
|
@@ -202,6 +202,12 @@ the package::
|
|
|
202
202
|
|
|
203
203
|
It's highly recommended to install the package in a virtual environment!
|
|
204
204
|
|
|
205
|
+
To build one wheel against the CPython stable ABI (abi3), which runs on the
|
|
206
|
+
given Python version and every later one, set ``LITTLEFS_PY_LIMITED_API``
|
|
207
|
+
(3.9 or later; needs Cython 3.1 or later)::
|
|
208
|
+
|
|
209
|
+
LITTLEFS_PY_LIMITED_API=3.9 python -m build --wheel
|
|
210
|
+
|
|
205
211
|
Development Hints
|
|
206
212
|
-----------------
|
|
207
213
|
|
|
@@ -169,6 +169,12 @@ the package::
|
|
|
169
169
|
|
|
170
170
|
It's highly recommended to install the package in a virtual environment!
|
|
171
171
|
|
|
172
|
+
To build one wheel against the CPython stable ABI (abi3), which runs on the
|
|
173
|
+
given Python version and every later one, set ``LITTLEFS_PY_LIMITED_API``
|
|
174
|
+
(3.9 or later; needs Cython 3.1 or later)::
|
|
175
|
+
|
|
176
|
+
LITTLEFS_PY_LIMITED_API=3.9 python -m build --wheel
|
|
177
|
+
|
|
172
178
|
Development Hints
|
|
173
179
|
-----------------
|
|
174
180
|
|
|
@@ -1,8 +1,25 @@
|
|
|
1
|
+
import os
|
|
1
2
|
from os import path
|
|
2
3
|
from setuptools import setup, find_packages
|
|
3
4
|
from setuptools import Extension
|
|
5
|
+
import Cython
|
|
4
6
|
from Cython.Build import cythonize
|
|
5
7
|
|
|
8
|
+
# Opt-in stable-ABI (abi3) build: LITTLEFS_PY_LIMITED_API=3.9 builds one extension that runs on CPython 3.9
|
|
9
|
+
# and every later version. Unset, the extension is built for the running Python only.
|
|
10
|
+
LIMITED_API = os.environ.get("LITTLEFS_PY_LIMITED_API")
|
|
11
|
+
LIMITED_API_MACROS = []
|
|
12
|
+
LIMITED_API_OPTIONS = {}
|
|
13
|
+
if LIMITED_API:
|
|
14
|
+
major, minor = (int(part) for part in LIMITED_API.split("."))
|
|
15
|
+
if (major, minor) < (3, 9):
|
|
16
|
+
raise SystemExit("LITTLEFS_PY_LIMITED_API must be 3.9 or later, got %s" % LIMITED_API)
|
|
17
|
+
cython_version = tuple(int(part) for part in Cython.__version__.split(".")[:2])
|
|
18
|
+
if cython_version < (3, 1):
|
|
19
|
+
raise SystemExit("An abi3 build needs Cython 3.1 or later, found %s" % Cython.__version__)
|
|
20
|
+
LIMITED_API_MACROS = [("Py_LIMITED_API", "0x%02X%02X0000" % (major, minor))]
|
|
21
|
+
LIMITED_API_OPTIONS = {"bdist_wheel": {"py_limited_api": "cp%d%d" % (major, minor)}}
|
|
22
|
+
|
|
6
23
|
# Extension definition
|
|
7
24
|
EXTENSIONS = [
|
|
8
25
|
Extension(
|
|
@@ -16,8 +33,10 @@ EXTENSIONS = [
|
|
|
16
33
|
("LFS_MULTIVERSION", "1"),
|
|
17
34
|
("LFS_NAME_MAX", "1022"), # LittleFS limitation: must be <= 1022
|
|
18
35
|
# ('LFS_YES_TRACE', '1')
|
|
19
|
-
]
|
|
36
|
+
]
|
|
37
|
+
+ LIMITED_API_MACROS,
|
|
20
38
|
extra_compile_args=["-std=c99", "-UNDEBUG"],
|
|
39
|
+
py_limited_api=bool(LIMITED_API),
|
|
21
40
|
)
|
|
22
41
|
]
|
|
23
42
|
|
|
@@ -39,6 +58,7 @@ setup(
|
|
|
39
58
|
package_data={"*": ["py.typed", "*.pyi"]},
|
|
40
59
|
package_dir={"": "src"},
|
|
41
60
|
zip_safe=False,
|
|
61
|
+
options=LIMITED_API_OPTIONS,
|
|
42
62
|
ext_modules=cythonize(EXTENSIONS, language_level=3, annotate=False, compiler_directives={"embedsignature": True}),
|
|
43
63
|
entry_points={
|
|
44
64
|
"console_scripts": [
|
|
@@ -87,7 +87,11 @@ class LittleFS:
|
|
|
87
87
|
if mount:
|
|
88
88
|
try:
|
|
89
89
|
self.mount()
|
|
90
|
-
except errors.LittleFSError:
|
|
90
|
+
except errors.LittleFSError as e:
|
|
91
|
+
# An I/O error means the device couldn't be read, so it may
|
|
92
|
+
# still hold a valid filesystem; formatting would erase it.
|
|
93
|
+
if e.code == errors.LittleFSError.Error.LFS_ERR_IO:
|
|
94
|
+
raise
|
|
91
95
|
self.format()
|
|
92
96
|
self.mount()
|
|
93
97
|
|
|
@@ -443,8 +447,12 @@ class FileHandle(io.RawIOBase):
|
|
|
443
447
|
# LittleFS already flushes the file on close.
|
|
444
448
|
|
|
445
449
|
if not self.closed:
|
|
446
|
-
|
|
447
|
-
|
|
450
|
+
try:
|
|
451
|
+
lfs.file_close(self.fs, self.fh)
|
|
452
|
+
finally:
|
|
453
|
+
# littlefs releases the handle even when close fails, so it
|
|
454
|
+
# must never be closed again.
|
|
455
|
+
setattr(self, "__IOBase_closed", True)
|
|
448
456
|
|
|
449
457
|
def readable(self):
|
|
450
458
|
return lfs.LFSFileFlag.rdonly in self.fh.flags and not self.closed
|