archae 2026.2.0b1__py3-none-any.whl → 2026.2.1__py3-none-any.whl
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.
- archae/cli.py +1 -2
- archae/config.py +30 -4
- archae/extractor.py +14 -11
- {archae-2026.2.0b1.dist-info → archae-2026.2.1.dist-info}/METADATA +2 -2
- {archae-2026.2.0b1.dist-info → archae-2026.2.1.dist-info}/RECORD +7 -7
- {archae-2026.2.0b1.dist-info → archae-2026.2.1.dist-info}/WHEEL +0 -0
- {archae-2026.2.0b1.dist-info → archae-2026.2.1.dist-info}/entry_points.txt +0 -0
archae/cli.py
CHANGED
|
@@ -9,7 +9,7 @@ from pathlib import Path
|
|
|
9
9
|
|
|
10
10
|
import rich_click as click
|
|
11
11
|
|
|
12
|
-
from archae.config import apply_options,
|
|
12
|
+
from archae.config import apply_options, get_options
|
|
13
13
|
from archae.extractor import ArchiveExtractor
|
|
14
14
|
from archae.util.tool_manager import ToolManager
|
|
15
15
|
|
|
@@ -72,7 +72,6 @@ def extract(
|
|
|
72
72
|
# Apply any options from the command line, then convert any convertible settings
|
|
73
73
|
if options:
|
|
74
74
|
apply_options(options)
|
|
75
|
-
convert_settings()
|
|
76
75
|
|
|
77
76
|
# Locate external tools
|
|
78
77
|
ToolManager.locate_tools()
|
archae/config.py
CHANGED
|
@@ -97,11 +97,37 @@ def apply_options(option_list: list[tuple[str, str]]) -> None:
|
|
|
97
97
|
pass
|
|
98
98
|
|
|
99
99
|
|
|
100
|
-
def convert_settings() ->
|
|
101
|
-
"""Convert settings using their defined converters.
|
|
100
|
+
def convert_settings(settings_dict: dict) -> dict:
|
|
101
|
+
"""Convert settings using their defined converters.
|
|
102
|
+
|
|
103
|
+
Args:
|
|
104
|
+
settings_dict (dict): The settings dictionary to convert.
|
|
105
|
+
|
|
106
|
+
Returns:
|
|
107
|
+
dict: The converted settings dictionary.
|
|
108
|
+
"""
|
|
102
109
|
options = get_options()
|
|
103
110
|
for key in options:
|
|
104
111
|
option_def = options[key]
|
|
105
|
-
if "converter" in option_def:
|
|
112
|
+
if "converter" in option_def and key in settings_dict:
|
|
106
113
|
converter = get_converter(option_def["converter"])
|
|
107
|
-
|
|
114
|
+
settings_dict[key] = converter(settings_dict[key])
|
|
115
|
+
return settings_dict
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def get_settings() -> dict:
|
|
119
|
+
"""Get the current settings after converting them.
|
|
120
|
+
|
|
121
|
+
Returns:
|
|
122
|
+
dict: The current settings as a dictionary.
|
|
123
|
+
"""
|
|
124
|
+
return convert_settings(dict(settings))
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def get_default_settings() -> dict:
|
|
128
|
+
"""Get the default settings after converting them.
|
|
129
|
+
|
|
130
|
+
Returns:
|
|
131
|
+
dict: The default settings as a dictionary.
|
|
132
|
+
"""
|
|
133
|
+
return convert_settings(dict(default_settings))
|
archae/extractor.py
CHANGED
|
@@ -9,7 +9,7 @@ from typing import TYPE_CHECKING
|
|
|
9
9
|
|
|
10
10
|
import magic
|
|
11
11
|
|
|
12
|
-
from archae.config import apply_options,
|
|
12
|
+
from archae.config import apply_options, get_default_settings, get_settings
|
|
13
13
|
from archae.util.file_tracker import FileTracker
|
|
14
14
|
from archae.util.tool_manager import ToolManager
|
|
15
15
|
|
|
@@ -55,6 +55,8 @@ class ArchiveExtractor:
|
|
|
55
55
|
shutil.rmtree(self.extract_dir)
|
|
56
56
|
self.extract_dir.mkdir(exist_ok=True)
|
|
57
57
|
self.file_tracker = FileTracker()
|
|
58
|
+
if ToolManager.get_tools() == {}:
|
|
59
|
+
ToolManager.locate_tools()
|
|
58
60
|
|
|
59
61
|
def handle_file(self, file_path: Path) -> None:
|
|
60
62
|
"""Handle a file given its path.
|
|
@@ -88,7 +90,8 @@ class ArchiveExtractor:
|
|
|
88
90
|
is_file_archive = self._is_archive(base_hash)
|
|
89
91
|
self.file_tracker.add_metadata_to_hash(base_hash, "is_archive", is_file_archive)
|
|
90
92
|
if is_file_archive:
|
|
91
|
-
|
|
93
|
+
settings_dict = get_settings()
|
|
94
|
+
if settings_dict["MAX_DEPTH"] == 0 or depth < settings_dict["MAX_DEPTH"]:
|
|
92
95
|
archiver = self._get_archiver_for_file(base_hash)
|
|
93
96
|
if archiver:
|
|
94
97
|
extracted_size = archiver.get_archive_uncompressed_size(file_path)
|
|
@@ -99,39 +102,39 @@ class ArchiveExtractor:
|
|
|
99
102
|
self.file_tracker.add_metadata_to_hash(
|
|
100
103
|
base_hash, "overall_compression_ratio", compression_ratio
|
|
101
104
|
)
|
|
102
|
-
if extracted_size >
|
|
105
|
+
if extracted_size > settings_dict["MAX_ARCHIVE_SIZE_BYTES"]:
|
|
103
106
|
logger.warning(
|
|
104
107
|
"MAX_ARCHIVE_SIZE_BYTES: Skipped archive %s because expected size %s is greater than MAX_ARCHIVE_SIZE_BYTES %s",
|
|
105
108
|
file_path,
|
|
106
109
|
extracted_size,
|
|
107
|
-
|
|
110
|
+
settings_dict["MAX_ARCHIVE_SIZE_BYTES"],
|
|
108
111
|
)
|
|
109
112
|
elif (
|
|
110
113
|
self.file_tracker.get_tracked_file_size() + extracted_size
|
|
111
|
-
>
|
|
114
|
+
> settings_dict["MAX_TOTAL_SIZE_BYTES"]
|
|
112
115
|
):
|
|
113
116
|
logger.warning(
|
|
114
117
|
"MAX_TOTAL_SIZE_BYTES: Skipped archive %s because expected size %s + current tracked files %s is greater than MAX_TOTAL_SIZE_BYTES %s",
|
|
115
118
|
file_path,
|
|
116
119
|
extracted_size,
|
|
117
120
|
self.file_tracker.get_tracked_file_size(),
|
|
118
|
-
|
|
121
|
+
settings_dict["MAX_TOTAL_SIZE_BYTES"],
|
|
119
122
|
)
|
|
120
|
-
elif compression_ratio <
|
|
123
|
+
elif compression_ratio < settings_dict["MIN_ARCHIVE_RATIO"]:
|
|
121
124
|
logger.warning(
|
|
122
125
|
"MIN_ARCHIVE_RATIO: Skipped archive %s because compression ratio %.5f is less than MIN_ARCHIVE_RATIO %s",
|
|
123
126
|
file_path,
|
|
124
127
|
compression_ratio,
|
|
125
|
-
|
|
128
|
+
settings_dict["MIN_ARCHIVE_RATIO"],
|
|
126
129
|
)
|
|
127
130
|
elif (
|
|
128
131
|
shutil.disk_usage(self.extract_dir).free - extracted_size
|
|
129
|
-
<
|
|
132
|
+
< settings_dict["MIN_DISK_FREE_SPACE"]
|
|
130
133
|
):
|
|
131
134
|
logger.warning(
|
|
132
135
|
"MIN_DISK_FREE_SPACE:Skipped archive %s because extracting it would leave less than MIN_DISK_FREE_SPACE %s bytes free at extraction location %s",
|
|
133
136
|
file_path,
|
|
134
|
-
|
|
137
|
+
settings_dict["MIN_DISK_FREE_SPACE"],
|
|
135
138
|
self.extract_dir,
|
|
136
139
|
)
|
|
137
140
|
else:
|
|
@@ -235,7 +238,7 @@ class ArchiveExtractor:
|
|
|
235
238
|
Returns:
|
|
236
239
|
dict: Dictionary of default settings.
|
|
237
240
|
"""
|
|
238
|
-
return
|
|
241
|
+
return get_default_settings()
|
|
239
242
|
|
|
240
243
|
def apply_settings(self, option_list: list[tuple[str, str]]) -> None:
|
|
241
244
|
"""Apply a list of settings options.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: archae
|
|
3
|
-
Version: 2026.2.
|
|
3
|
+
Version: 2026.2.1
|
|
4
4
|
Summary: Archae explodes archives.
|
|
5
5
|
Keywords:
|
|
6
6
|
Author: Shawn McNaughton
|
|
@@ -57,7 +57,7 @@ Description-Content-Type: text/markdown
|
|
|
57
57
|
|
|
58
58
|

|
|
59
59
|
|
|
60
|
-
[](https://
|
|
60
|
+
[](https://pypi.org/project/archae/)
|
|
61
61
|
[](https://pypi.org/project/archae/)
|
|
62
62
|
[](https://results.pre-commit.ci/latest/github/shawngmc/archae/main)
|
|
63
63
|
[](https://github.com/shawngmc/archae/actions/workflows/test.yml)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
archae/__init__.py,sha256=O_HNvpNVsJ5LZPNPLvuHhHdOq0b6M0LnWqycB505mkQ,111
|
|
2
2
|
archae/__main__.py,sha256=l3eO5dEs1cR_hDziOpnW1PYzoRL2siYm81wgvftyigg,172
|
|
3
|
-
archae/cli.py,sha256=
|
|
4
|
-
archae/config.py,sha256=
|
|
3
|
+
archae/cli.py,sha256=NqNUsncmXNYrfyE97jqCzKQ0tvOJz4Bm0_hbSnKzOm0,5698
|
|
4
|
+
archae/config.py,sha256=yO3VDRjL0t7rk_yuJ9mym1bqXxuYPvXrBp9cPk85JuU,3598
|
|
5
5
|
archae/default_settings.toml,sha256=svBdN9QJm8UBBz6AEWpBp-gslSBcE5n00xZdl32KDEc,230
|
|
6
|
-
archae/extractor.py,sha256=
|
|
6
|
+
archae/extractor.py,sha256=PFPwOxb_KWEHZR6uJ_a8ai0iZtaXheEDSukYQAUvRmo,10130
|
|
7
7
|
archae/options.yaml,sha256=nJo7gOCuiS_fKd9C3iRwI3Eb_f4OT6mbdVkipqdISpk,937
|
|
8
8
|
archae/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
9
|
archae/util/__init__.py,sha256=HlENK1XfnwnYMrlkvVJTjs-6W7RLLUJOoyFcOb7njUE,34
|
|
@@ -17,7 +17,7 @@ archae/util/enum/__init__.py,sha256=IvjtVopATKLAHDjOpblaExy2yXwIzweX0HoUrQWcpkM,
|
|
|
17
17
|
archae/util/enum/byte_scale.py,sha256=5TZG1msPmJU9whZtKAywZtKOre6p2xMJ2y0gE4TG3OE,1593
|
|
18
18
|
archae/util/file_tracker.py,sha256=HQb1l7j_Jy0qO6tqkB8jXM6P2o5fLB6Ih0J5U4JUyT8,3106
|
|
19
19
|
archae/util/tool_manager.py,sha256=HU2xkmb_18XF5SFwFV5gUUcPddZVBYRdGB2PSWgWaqA,3974
|
|
20
|
-
archae-2026.2.
|
|
21
|
-
archae-2026.2.
|
|
22
|
-
archae-2026.2.
|
|
23
|
-
archae-2026.2.
|
|
20
|
+
archae-2026.2.1.dist-info/WHEEL,sha256=fAguSjoiATBe7TNBkJwOjyL1Tt4wwiaQGtNtjRPNMQA,80
|
|
21
|
+
archae-2026.2.1.dist-info/entry_points.txt,sha256=gGL_R78QELaTeyFGb-OuSnRuu4EUdT68EKmyrFno59o,48
|
|
22
|
+
archae-2026.2.1.dist-info/METADATA,sha256=Jrv9YutS0F0yMCyKA2_WHsVhsle7nmOgtmEswaIAP50,7970
|
|
23
|
+
archae-2026.2.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|