littlefs-python 0.11.0__tar.gz → 0.12.0__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.
Files changed (130) hide show
  1. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/.github/workflows/deploy.yml +3 -2
  2. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/.github/workflows/run-tests.yml +2 -2
  3. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/PKG-INFO +4 -4
  4. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/README.rst +3 -3
  5. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/src/littlefs/__init__.py +11 -0
  6. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/src/littlefs/__main__.py +36 -1
  7. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/src/littlefs/lfs.c +1325 -1139
  8. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/src/littlefs/lfs.pxd +1 -0
  9. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/src/littlefs/lfs.pyi +1 -0
  10. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/src/littlefs/lfs.pyx +2 -0
  11. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/src/littlefs_python.egg-info/PKG-INFO +4 -4
  12. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/.gitattributes +0 -0
  13. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/.github/dependabot.yml +0 -0
  14. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/.gitignore +0 -0
  15. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/.gitmodules +0 -0
  16. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/.pre-commit-config.yaml +0 -0
  17. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/.readthedocs.yml +0 -0
  18. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/LICENSE +0 -0
  19. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/MANIFEST.in +0 -0
  20. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/ci/build-wheels.sh +0 -0
  21. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/ci/download_release_files.py +0 -0
  22. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/docs/Makefile +0 -0
  23. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/docs/api/index.rst +0 -0
  24. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/docs/cli.rst +0 -0
  25. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/docs/conf.py +0 -0
  26. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/docs/doc8.ini +0 -0
  27. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/docs/examples/index.rst +0 -0
  28. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/docs/index.rst +0 -0
  29. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/docs/make.bat +0 -0
  30. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/docs/requirements.txt +0 -0
  31. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/docs/usage.rst +0 -0
  32. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/examples/mkfsimg.py +0 -0
  33. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/examples/walk.py +0 -0
  34. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/.git +0 -0
  35. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/.gitattributes +0 -0
  36. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/.github/workflows/post-release.yml +0 -0
  37. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/.github/workflows/release.yml +0 -0
  38. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/.github/workflows/status.yml +0 -0
  39. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/.github/workflows/test.yml +0 -0
  40. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/.gitignore +0 -0
  41. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/DESIGN.md +0 -0
  42. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/LICENSE.md +0 -0
  43. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/Makefile +0 -0
  44. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/README.md +0 -0
  45. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/SPEC.md +0 -0
  46. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/bd/lfs_emubd.c +0 -0
  47. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/bd/lfs_emubd.h +0 -0
  48. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/bd/lfs_filebd.c +0 -0
  49. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/bd/lfs_filebd.h +0 -0
  50. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/bd/lfs_rambd.c +0 -0
  51. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/bd/lfs_rambd.h +0 -0
  52. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/benches/bench_dir.toml +0 -0
  53. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/benches/bench_file.toml +0 -0
  54. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/benches/bench_superblock.toml +0 -0
  55. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/lfs.c +0 -0
  56. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/lfs.h +0 -0
  57. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/lfs_util.c +0 -0
  58. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/lfs_util.h +0 -0
  59. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/runners/bench_runner.c +0 -0
  60. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/runners/bench_runner.h +0 -0
  61. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/runners/test_runner.c +0 -0
  62. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/runners/test_runner.h +0 -0
  63. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/scripts/bench.py +0 -0
  64. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/scripts/changeprefix.py +0 -0
  65. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/scripts/code.py +0 -0
  66. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/scripts/cov.py +0 -0
  67. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/scripts/data.py +0 -0
  68. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/scripts/perf.py +0 -0
  69. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/scripts/perfbd.py +0 -0
  70. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/scripts/plot.py +0 -0
  71. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/scripts/plotmpl.py +0 -0
  72. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/scripts/prettyasserts.py +0 -0
  73. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/scripts/readblock.py +0 -0
  74. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/scripts/readmdir.py +0 -0
  75. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/scripts/readtree.py +0 -0
  76. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/scripts/stack.py +0 -0
  77. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/scripts/structs.py +0 -0
  78. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/scripts/summary.py +0 -0
  79. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/scripts/tailpipe.py +0 -0
  80. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/scripts/teepipe.py +0 -0
  81. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/scripts/test.py +0 -0
  82. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/scripts/tracebd.py +0 -0
  83. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/scripts/watch.py +0 -0
  84. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/tests/test_alloc.toml +0 -0
  85. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/tests/test_attrs.toml +0 -0
  86. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/tests/test_badblocks.toml +0 -0
  87. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/tests/test_bd.toml +0 -0
  88. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/tests/test_compat.toml +0 -0
  89. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/tests/test_dirs.toml +0 -0
  90. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/tests/test_entries.toml +0 -0
  91. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/tests/test_evil.toml +0 -0
  92. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/tests/test_exhaustion.toml +0 -0
  93. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/tests/test_files.toml +0 -0
  94. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/tests/test_interspersed.toml +0 -0
  95. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/tests/test_move.toml +0 -0
  96. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/tests/test_orphans.toml +0 -0
  97. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/tests/test_paths.toml +0 -0
  98. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/tests/test_powerloss.toml +0 -0
  99. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/tests/test_relocations.toml +0 -0
  100. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/tests/test_seek.toml +0 -0
  101. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/tests/test_superblocks.toml +0 -0
  102. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/littlefs/tests/test_truncate.toml +0 -0
  103. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/mypy.ini +0 -0
  104. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/pyproject.toml +0 -0
  105. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/requirements.txt +0 -0
  106. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/setup.cfg +0 -0
  107. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/setup.py +0 -0
  108. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/src/littlefs/context.py +0 -0
  109. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/src/littlefs/errors.py +0 -0
  110. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/src/littlefs/py.typed +0 -0
  111. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/src/littlefs_python.egg-info/SOURCES.txt +0 -0
  112. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/src/littlefs_python.egg-info/dependency_links.txt +0 -0
  113. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/src/littlefs_python.egg-info/entry_points.txt +0 -0
  114. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/src/littlefs_python.egg-info/not-zip-safe +0 -0
  115. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/src/littlefs_python.egg-info/requires.txt +0 -0
  116. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/src/littlefs_python.egg-info/top_level.txt +0 -0
  117. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/test/lfs/conftest.py +0 -0
  118. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/test/lfs/test_dir_functions.py +0 -0
  119. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/test/lfs/test_file_functions.py +0 -0
  120. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/test/lfs/test_fs_functions.py +0 -0
  121. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/test/test_attr.py +0 -0
  122. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/test/test_block_count.py +0 -0
  123. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/test/test_directories.py +0 -0
  124. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/test/test_files.py +0 -0
  125. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/test/test_grow.py +0 -0
  126. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/test/test_multiversion.py +0 -0
  127. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/test/test_name_max.py +0 -0
  128. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/test/test_remove_rename.py +0 -0
  129. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/test/test_version.py +0 -0
  130. {littlefs_python-0.11.0 → littlefs_python-0.12.0}/test/test_walk.py +0 -0
@@ -11,7 +11,8 @@ jobs:
11
11
  os: [ubuntu-latest, windows-latest, macos-latest]
12
12
 
13
13
  env:
14
- CIBW_SKIP: "cp36-* cp37-* pp* *-win_arm64 *-musllinux_aarch64"
14
+ CIBW_BUILD: "cp37-* cp38-* cp39-* cp310-* cp311-* cp312-* pp37-* pp38-* pp39-* pp310-*"
15
+ CIBW_SKIP: "cp36-* pp* *-win_arm64 *-musllinux_aarch64"
15
16
  CIBW_ARCHS_LINUX: "x86_64 i686 aarch64"
16
17
 
17
18
  steps:
@@ -49,7 +50,7 @@ jobs:
49
50
  uses: pypa/cibuildwheel@v2.19.1
50
51
  env:
51
52
  CIBW_BUILD: ${{ matrix.cibw_build }}
52
- CIBW_SKIP: "cp36-* cp37-*"
53
+ CIBW_SKIP: "cp36-* pp*"
53
54
  CIBW_ARCHS: ${{ matrix.cibw_archs }}
54
55
  CIBW_REPAIR_WHEEL_COMMAND: |
55
56
  echo "Target delocate archs: {delocate_archs}"
@@ -14,8 +14,8 @@ jobs:
14
14
  runs-on: ${{ matrix.os }}
15
15
  strategy:
16
16
  matrix:
17
- os: [ubuntu-latest, macos-latest, windows-latest]
18
- python-version: [3.8, 3.9, "3.10", "3.11"]
17
+ os: [ubuntu-latest, macos-13, windows-latest]
18
+ python-version: [3.7, 3.8, 3.9, "3.10", "3.11"]
19
19
 
20
20
  steps:
21
21
  - uses: actions/checkout@v4
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: littlefs-python
3
- Version: 0.11.0
3
+ Version: 0.12.0
4
4
  Summary: A python wrapper for littlefs
5
5
  Home-page: https://github.com/jrast/littlefs-python
6
6
  Author: Jürg Rast
@@ -113,9 +113,9 @@ This is as simple as it can be::
113
113
  At the moment wheels (which require no build) are provided for the following platforms,
114
114
  on other platforms the source package is used and a compiler is required:
115
115
 
116
- + Linux: Python 3.8 - 3.12 / x86_64, arm64
117
- + MacOS: Python 3.8 - 3.12 / x86_64, arm64
118
- + Windows: Python 3.8 - 3.12 / 32- & 64-bit
116
+ + Linux: Python 3.7 - 3.12 / x86_64, arm64
117
+ + MacOS: Python 3.7 - 3.12 / x86_64, arm64
118
+ + Windows: Python 3.7 - 3.12 / 32- & 64-bit
119
119
 
120
120
  CLI
121
121
  ===
@@ -89,9 +89,9 @@ This is as simple as it can be::
89
89
  At the moment wheels (which require no build) are provided for the following platforms,
90
90
  on other platforms the source package is used and a compiler is required:
91
91
 
92
- + Linux: Python 3.8 - 3.12 / x86_64, arm64
93
- + MacOS: Python 3.8 - 3.12 / x86_64, arm64
94
- + Windows: Python 3.8 - 3.12 / 32- & 64-bit
92
+ + Linux: Python 3.7 - 3.12 / x86_64, arm64
93
+ + MacOS: Python 3.7 - 3.12 / x86_64, arm64
94
+ + Windows: Python 3.7 - 3.12 / 32- & 64-bit
95
95
 
96
96
  CLI
97
97
  ===
@@ -72,6 +72,10 @@ class LittleFS:
72
72
  def block_count(self) -> int:
73
73
  return self.fs.block_count
74
74
 
75
+ @property
76
+ def used_block_count(self) -> int:
77
+ return lfs.fs_size(self.fs)
78
+
75
79
  @property
76
80
  def context(self) -> "UserContext":
77
81
  """User context of the file system"""
@@ -98,6 +102,10 @@ class LittleFS:
98
102
  return lfs.fs_mkconsistent(self.fs)
99
103
 
100
104
  def fs_grow(self, block_count: int) -> int:
105
+ """WARNING: does not modify underlying ``self.context``.
106
+
107
+ Must be done externally.
108
+ """
101
109
  if block_count < self.block_count:
102
110
  raise ValueError(
103
111
  f"Supplied block_count='{block_count}' cannot be smaller than current block_count {self.block_count}"
@@ -109,6 +117,9 @@ class LittleFS:
109
117
  """Get the status of the filesystem"""
110
118
  return lfs.fs_stat(self.fs)
111
119
 
120
+ def fs_gc(self):
121
+ return lfs.fs_gc(self.fs)
122
+
112
123
  def open(
113
124
  self, fname: str, mode="r", buffering: int = -1, encoding: str = None, errors: str = None, newline: str = None
114
125
  ) -> IO:
@@ -89,8 +89,33 @@ def create(parser: argparse.ArgumentParser, args: argparse.Namespace) -> int:
89
89
  with fs.open(rel_path.as_posix(), "wb") as dest:
90
90
  dest.write(path.read_bytes())
91
91
 
92
+ if args.compact:
93
+ if args.verbose:
94
+ print(f"Compacting... {fs.used_block_count} / {args.block_count}")
95
+ compact_fs = LittleFS(
96
+ block_size=args.block_size,
97
+ block_count=fs.used_block_count,
98
+ name_max=args.name_max,
99
+ )
100
+ for root, dirs, files in fs.walk("/"):
101
+ if not root.endswith("/"):
102
+ root += "/"
103
+ for _dir in dirs:
104
+ compact_fs.makedirs(root + _dir, exist_ok=True)
105
+ for file in files:
106
+ path = root + file
107
+ print(path)
108
+ with fs.open(path, "rb") as src, compact_fs.open(path, "wb") as dest:
109
+ dest.write(src.read())
110
+ compact_fs.fs_grow(args.block_count)
111
+ data = compact_fs.context.buffer
112
+ if not args.no_pad:
113
+ data = data.ljust(args.fs_size, b"\xFF")
114
+ else:
115
+ data = fs.context.buffer
116
+
92
117
  args.destination.parent.mkdir(exist_ok=True, parents=True)
93
- args.destination.write_bytes(fs.context.buffer)
118
+ args.destination.write_bytes(data)
94
119
  return 0
95
120
 
96
121
 
@@ -219,6 +244,16 @@ def get_parser():
219
244
  required=True,
220
245
  help="LittleFS block size.",
221
246
  )
247
+ parser_create.add_argument(
248
+ "--compact",
249
+ action="store_true",
250
+ help="Store all data in the beginning blocks.",
251
+ )
252
+ parser_create.add_argument(
253
+ "--no-pad",
254
+ action="store_true",
255
+ help="Do not pad the binary to-size with 0xFF. Only valid with --compact.",
256
+ )
222
257
  block_count_group = parser_create.add_mutually_exclusive_group(required=True)
223
258
  block_count_group.add_argument(
224
259
  "--block-count",