Commit Graph

68 Commits

Author SHA1 Message Date
dgelessus
126795239c Reimplement Resource.data_raw using a custom stream type (SubStream)
This way all reads performed on a resource data stream are forwarded
to the underlying resource file stream, with the read offsets and
lengths adjusted appropriately.
2020-07-23 02:42:32 +02:00
dgelessus
61247ec783 Add initial API and tests for stream-based resource reading
For now the stream-based API is a simple BytesIO wrapper around
data/data_raw, but it will be optimized in the future.
2020-07-21 14:12:09 +02:00
dgelessus
4bbf2f7c14 Bump version to 1.8.1.dev 2020-07-18 17:47:48 +02:00
dgelessus
82b5926b4f Release version 1.8.0 2020-07-18 17:31:25 +02:00
dgelessus
a9f54b678c Add py.typed marker file for PEP 561
This allows type checkers like mypy to use the type hints in our code
when type-checking another project that imports this library.
2020-07-06 23:57:25 +02:00
dgelessus
8fc24040ea Add resource-info subcommand 2019-12-26 01:58:23 +01:00
dgelessus
d492d9a6a8 Remove an incorrect assertion from describe_resource
red.compressed_info can be None here if decompress is False.
2019-12-26 01:50:34 +01:00
dgelessus
d0e1eaf262 Add raw-compress-info subcommand (#6) 2019-12-26 00:34:27 +01:00
dgelessus
1e55569442 Add support for passing filters to the list subcommand 2019-12-25 01:47:03 +01:00
dgelessus
d67641d537 Remove compatibility code for old CLI syntax 2019-12-25 00:15:30 +01:00
dgelessus
d6dbfdb149 Fix version number in changelog 2019-12-17 12:17:31 +01:00
dgelessus
b2502c48a2 Bump version to 1.7.1.dev 2019-12-17 12:16:39 +01:00
dgelessus
158ca4884b Release version 1.7.0 2019-12-17 11:28:26 +01:00
dgelessus
a4b6328782 Fix 'dcmp' (0) jump table decompression for large segment numbers 2019-12-04 23:36:57 +01:00
dgelessus
393160b5da Add raw-decompress subcommand (#6) 2019-12-04 23:36:56 +01:00
dgelessus
5af455992b Refactor resource reading internals
The reading of resource name and data is now performed in the Resource
class (lazily, when the respective attributes are accessed) instead of
in ResourceFile._LazyResourceMap.
2019-12-04 02:01:40 +01:00
dgelessus
2193c81518 Bump version to 1.6.1.dev 2019-12-04 01:45:15 +01:00
dgelessus
7dc0d980a3 Release version 1.6.0 2019-12-04 01:35:57 +01:00
dgelessus
2ce1d6b63a Move resource file format reference links to mac_file_format_docs repo
eebce6e7cc
2019-10-30 23:51:12 +01:00
dgelessus
3be4d9c969 Add a new subcommand-based CLI syntax
The new syntax supports the same operations as the old syntax, but is
clearer to understand and more extensible in the future. The old syntax
is still supported for now.
2019-10-22 10:25:22 +02:00
dgelessus
f537fb3d37 Bump version to 1.5.1.dev 2019-10-22 10:23:33 +02:00
dgelessus
d342614f55 Release version 1.5.0 2019-10-22 10:17:07 +02:00
dgelessus
a5fb30e194 Fix broken handling of - (stdin) file name on command line 2019-10-16 23:29:20 +02:00
dgelessus
a71274d554 Document stream-based decompression in changelog 2019-10-02 16:36:54 +02:00
dgelessus
cb868b8005 Bump version to 1.4.1.dev 2019-09-29 19:27:43 +02:00
dgelessus
2f2472cfe9 Release version 1.4.0 2019-09-29 19:20:37 +02:00
dgelessus
e5875ffe67 Fix various issues reported by mypy 2019-09-29 16:14:55 +02:00
dgelessus
add22b704a Fix ResourceFile.__enter__ not returning anything 2019-09-29 15:09:41 +02:00
dgelessus
6d03954784 Document setup.cfg options.packages fixes in changelog 2019-09-25 02:32:32 +02:00
dgelessus
e75e88018e Add lots of additional Inside Macintosh-related links/info to README 2019-09-25 00:32:18 +02:00
dgelessus
0f72e8eb1f Document decompression improvements in changelog 2019-09-24 00:46:35 +02:00
dgelessus
20991154d3 Bump version to 1.3.1.dev 2019-09-16 16:46:17 +02:00
dgelessus
7207b1d32b Release version 1.3.0 2019-09-16 16:34:40 +02:00
dgelessus
1de940d597 Enable --sort by default and add --no-sort to disable sorting
In most cases the file order is not important and the unsorted output
hurts readability. The performance impact of sorting is relatively
small and barely noticeable even with large resource files.
2019-09-16 15:25:41 +02:00
dgelessus
c6337bdfbd Rename resource_type and resource_id attributes to type and id
The old names were chosen to avoid conflicts with Python's type and id
builtins, but for attribute names this is not necessary.
2019-09-15 15:56:03 +02:00
dgelessus
f4c2717720 Add command-line --group option 2019-09-15 15:38:01 +02:00
dgelessus
8ad0234633 Add command-line --sort option 2019-09-13 15:00:56 +02:00
dgelessus
7612322c43 Add dump-text output format on command line 2019-09-13 14:51:16 +02:00
dgelessus
194c886472 Change hex dump output format to match hexdump -C 2019-09-13 10:51:27 +02:00
dgelessus
b2fa5f8b0f Collapse multiple subsequent identical lines in hex dumps 2019-09-13 10:40:03 +02:00
dgelessus
752ec9e828 Bump version to 1.2.1.dev 2019-09-13 10:22:43 +02:00
dgelessus
fb5708e6b4 Release version 1.2.0 2019-09-13 10:05:16 +02:00
dgelessus
5bcc3f02d7 Update command-line example in README to new output format 2019-09-03 02:15:09 +02:00
dgelessus
d082f29238 Use MacRoman as the encoding for four-char codes and strings
Previously all non-ASCII characters were hex-escaped on output.
However, many resource files use MacRoman characters in resource names
and sometimes in resource types, so it makes sense to use MacRoman in
the interest of readability.
2019-09-03 02:10:04 +02:00
dgelessus
c373b9fe28 Clean up resource descriptions in listings and dumps
Previously, when some aspect of a resource's metadata was not present
(e. g. a resource with no name), the description would
explicitly point this out (and e. g. say "unnamed"). Now missing parts
of the metadata are simply omitted from the description, resulting in
cleaner output in many cases.

The resource description formats used by the listings and dumps have
also been unified. Previously the descriptions were structured slightly
differently in each case; this is now no longer the case.
2019-09-03 01:32:26 +02:00
dgelessus
e6779b021a Replace rsrcfork.open's rsrcfork parameter with a more usable version
The new fork parameter accepts strings, which are more understandable
than the old None/True/False values, and can be extended in the future.
2019-08-31 20:07:26 +02:00
dgelessus
c4fe09dbf0 Improve errors when filter doesn't match required number of resources 2019-08-31 14:48:01 +02:00
dgelessus
acdbbc89b2 Improve automatic fork selection when resource fork is invalid 2019-08-30 23:17:59 +02:00
dgelessus
5ede8a351a Rework how non-seekable streams are handled by ResourceFile
The broken non-seeking read implementation of ResourceFile is removed,
and non-seekable streams are now handled by reading the entire stream
data first and wrapping it in a BytesIO to make it seekable.

The manual selection of seeking/non-seeking reading has been removed as
well, since it is no longer needed and was already nearly useless.
2019-08-30 23:17:18 +02:00
dgelessus
efd3848146 Reindent README.rst with spaces to fix nested list formatting
Unfortunately, reStructuredText requires nested lists to be exactly
visually aligned. There is no single indent size that works for all
lists - for example bullet point lists require two spaces, but numbered
lists require three spaces (or more, depending on how high the numbers
go). This makes reStructuredText incompatible with tab indents.
2019-08-25 22:15:34 +02:00