dissect.squashfs 1.4.dev1__tar.gz → 1.4.dev3__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 (31) hide show
  1. {dissect.squashfs-1.4.dev1/dissect.squashfs.egg-info → dissect.squashfs-1.4.dev3}/PKG-INFO +2 -2
  2. {dissect.squashfs-1.4.dev1 → dissect.squashfs-1.4.dev3}/dissect/squashfs/squashfs.py +5 -4
  3. {dissect.squashfs-1.4.dev1 → dissect.squashfs-1.4.dev3/dissect.squashfs.egg-info}/PKG-INFO +2 -2
  4. {dissect.squashfs-1.4.dev1 → dissect.squashfs-1.4.dev3}/dissect.squashfs.egg-info/requires.txt +3 -1
  5. {dissect.squashfs-1.4.dev1 → dissect.squashfs-1.4.dev3}/pyproject.toml +3 -1
  6. {dissect.squashfs-1.4.dev1 → dissect.squashfs-1.4.dev3}/COPYRIGHT +0 -0
  7. {dissect.squashfs-1.4.dev1 → dissect.squashfs-1.4.dev3}/LICENSE +0 -0
  8. {dissect.squashfs-1.4.dev1 → dissect.squashfs-1.4.dev3}/MANIFEST.in +0 -0
  9. {dissect.squashfs-1.4.dev1 → dissect.squashfs-1.4.dev3}/README.md +0 -0
  10. {dissect.squashfs-1.4.dev1 → dissect.squashfs-1.4.dev3}/dissect/squashfs/__init__.py +0 -0
  11. {dissect.squashfs-1.4.dev1 → dissect.squashfs-1.4.dev3}/dissect/squashfs/c_squashfs.py +0 -0
  12. {dissect.squashfs-1.4.dev1 → dissect.squashfs-1.4.dev3}/dissect/squashfs/compression.py +0 -0
  13. {dissect.squashfs-1.4.dev1 → dissect.squashfs-1.4.dev3}/dissect/squashfs/exceptions.py +0 -0
  14. {dissect.squashfs-1.4.dev1 → dissect.squashfs-1.4.dev3}/dissect.squashfs.egg-info/SOURCES.txt +0 -0
  15. {dissect.squashfs-1.4.dev1 → dissect.squashfs-1.4.dev3}/dissect.squashfs.egg-info/dependency_links.txt +0 -0
  16. {dissect.squashfs-1.4.dev1 → dissect.squashfs-1.4.dev3}/dissect.squashfs.egg-info/top_level.txt +0 -0
  17. {dissect.squashfs-1.4.dev1 → dissect.squashfs-1.4.dev3}/setup.cfg +0 -0
  18. {dissect.squashfs-1.4.dev1 → dissect.squashfs-1.4.dev3}/tests/__init__.py +0 -0
  19. {dissect.squashfs-1.4.dev1 → dissect.squashfs-1.4.dev3}/tests/conftest.py +0 -0
  20. {dissect.squashfs-1.4.dev1 → dissect.squashfs-1.4.dev3}/tests/data/gzip-opts.sqfs +0 -0
  21. {dissect.squashfs-1.4.dev1 → dissect.squashfs-1.4.dev3}/tests/data/gzip.sqfs +0 -0
  22. {dissect.squashfs-1.4.dev1 → dissect.squashfs-1.4.dev3}/tests/data/lz4.sqfs +0 -0
  23. {dissect.squashfs-1.4.dev1 → dissect.squashfs-1.4.dev3}/tests/data/lzma.sqfs +0 -0
  24. {dissect.squashfs-1.4.dev1 → dissect.squashfs-1.4.dev3}/tests/data/lzo.sqfs +0 -0
  25. {dissect.squashfs-1.4.dev1 → dissect.squashfs-1.4.dev3}/tests/data/xz.sqfs +0 -0
  26. {dissect.squashfs-1.4.dev1 → dissect.squashfs-1.4.dev3}/tests/data/zstd.sqfs +0 -0
  27. {dissect.squashfs-1.4.dev1 → dissect.squashfs-1.4.dev3}/tests/docs/Makefile +0 -0
  28. {dissect.squashfs-1.4.dev1 → dissect.squashfs-1.4.dev3}/tests/docs/conf.py +0 -0
  29. {dissect.squashfs-1.4.dev1 → dissect.squashfs-1.4.dev3}/tests/docs/index.rst +0 -0
  30. {dissect.squashfs-1.4.dev1 → dissect.squashfs-1.4.dev3}/tests/test_squashfs.py +0 -0
  31. {dissect.squashfs-1.4.dev1 → dissect.squashfs-1.4.dev3}/tox.ini +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dissect.squashfs
3
- Version: 1.4.dev1
3
+ Version: 1.4.dev3
4
4
  Summary: A Dissect module implementing a parser for the SquashFS file system, commonly used in appliance or device firmware
5
5
  Author-email: Dissect Team <dissect@fox-it.com>
6
6
  License: Affero General Public License v3
@@ -26,7 +26,7 @@ Requires-Dist: dissect.cstruct<4.0.dev,>=3.0.dev
26
26
  Requires-Dist: dissect.util<4.0.dev,>=3.0.dev
27
27
  Provides-Extra: full
28
28
  Requires-Dist: lz4; extra == "full"
29
- Requires-Dist: python-lzo; extra == "full"
29
+ Requires-Dist: python-lzo; (platform_system != "Windows" or platform_python_implementation != "PyPy") and extra == "full"
30
30
  Requires-Dist: zstandard; extra == "full"
31
31
 
32
32
  # dissect.squashfs
@@ -46,6 +46,11 @@ class SquashFS:
46
46
  self.minor = self.sb.s_minor
47
47
  self.size = self.sb.bytes_used
48
48
 
49
+ self._read_block = lru_cache(1024)(self._read_block)
50
+ self._lookup_id = lru_cache(1024)(self._lookup_id)
51
+ self._lookup_inode = lru_cache(1024)(self._lookup_inode)
52
+ self._lookup_fragment = lru_cache(1024)(self._lookup_fragment)
53
+
49
54
  self._compression_options = None
50
55
  if (self.sb.flags >> c_squashfs.SQUASHFS_COMP_OPT) & 1:
51
56
  self._compression_options = self._read_block(len(self.sb))[1]
@@ -131,7 +136,6 @@ class SquashFS:
131
136
 
132
137
  return block, offset, b"".join(result)
133
138
 
134
- @lru_cache(1024)
135
139
  def _read_block(self, block: int, length: Optional[int] = None) -> tuple[int, bytes]:
136
140
  if length is not None:
137
141
  # Data block
@@ -162,13 +166,11 @@ class SquashFS:
162
166
  _, data = self._read_block(entry.start_block, entry.size)
163
167
  return data[offset : offset + length]
164
168
 
165
- @lru_cache(1024)
166
169
  def _lookup_id(self, id: int) -> int:
167
170
  block, offset = divmod(id * 4, c_squashfs.SQUASHFS_METADATA_SIZE)
168
171
  _, _, data = self._read_metadata(self.id_table[block], offset, 4)
169
172
  return struct.unpack("<I", data)[0]
170
173
 
171
- @lru_cache(1024)
172
174
  def _lookup_inode(self, inode_number: int) -> INode:
173
175
  if inode_number <= 0 or inode_number > self.sb.inodes:
174
176
  raise IndexError(f"inode number out of bounds (1, {self.sb.inodes}): {inode_number}")
@@ -176,7 +178,6 @@ class SquashFS:
176
178
  _, _, data = self._read_metadata(self.lookup_table[block], offset, 8)
177
179
  return self.get(struct.unpack("<Q", data)[0])
178
180
 
179
- @lru_cache(1024)
180
181
  def _lookup_fragment(self, fragment: int) -> bytes:
181
182
  fragment_offset = fragment * len(c_squashfs.squashfs_fragment_entry)
182
183
  block, offset = divmod(fragment_offset, c_squashfs.SQUASHFS_METADATA_SIZE)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dissect.squashfs
3
- Version: 1.4.dev1
3
+ Version: 1.4.dev3
4
4
  Summary: A Dissect module implementing a parser for the SquashFS file system, commonly used in appliance or device firmware
5
5
  Author-email: Dissect Team <dissect@fox-it.com>
6
6
  License: Affero General Public License v3
@@ -26,7 +26,7 @@ Requires-Dist: dissect.cstruct<4.0.dev,>=3.0.dev
26
26
  Requires-Dist: dissect.util<4.0.dev,>=3.0.dev
27
27
  Provides-Extra: full
28
28
  Requires-Dist: lz4; extra == "full"
29
- Requires-Dist: python-lzo; extra == "full"
29
+ Requires-Dist: python-lzo; (platform_system != "Windows" or platform_python_implementation != "PyPy") and extra == "full"
30
30
  Requires-Dist: zstandard; extra == "full"
31
31
 
32
32
  # dissect.squashfs
@@ -3,5 +3,7 @@ dissect.util<4.0.dev,>=3.0.dev
3
3
 
4
4
  [full]
5
5
  lz4
6
- python-lzo
7
6
  zstandard
7
+
8
+ [full:platform_system != "Windows" or platform_python_implementation != "PyPy"]
9
+ python-lzo
@@ -38,7 +38,9 @@ repository = "https://github.com/fox-it/dissect.squashfs"
38
38
  [project.optional-dependencies]
39
39
  full = [
40
40
  "lz4",
41
- "python-lzo",
41
+ # There are no Windows PyPy wheels available for python-lzo
42
+ # So we use a pure python fallback for it.
43
+ "python-lzo; platform_system != 'Windows' or platform_python_implementation != 'PyPy'",
42
44
  "zstandard",
43
45
  ]
44
46