Commit Graph

128 Commits

Author SHA1 Message Date
dgelessus
9ef084de58 Remove uses of the typing.io pseudo-module
According to https://bugs.python.org/issue35089, typing.io should not
be used anymore, and the types that it contains should be accessed
through the main typing module instead.
2019-09-28 01:40:34 +02:00
dgelessus
6d03954784 Document setup.cfg options.packages fixes in changelog 2019-09-25 02:32:32 +02:00
dgelessus
343259049c Fix setup.cfg options.packages not including subpackages
This caused normal installs (i. e. without --editable) of this library
to not include the rsrcfork.compress subpackage, and made everything
unusable as a result. Oops.
2019-09-25 01:51:23 +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
84f09d0b83 Display 'dcmp' IDs in command line listings of compressed resources 2019-09-24 00:27:54 +02:00
dgelessus
c108af60ca Add length and length_raw attributes to Resource (closes #3)
For compressed resources, the value of the length attribute can be
accessed much more quickly than the data itself (because it only
requires parsing the header, rather than decompressing the entire
data). This is used to speed up listing of compressed resources on the
command line.

The length_raw attribute is added for symmetry, although it is not
specifically optimized in any case yet.
2019-09-24 00:13:23 +02:00
dgelessus
0c942e26ec Fix hex number formatting in compressed header info reprs 2019-09-23 23:52:06 +02:00
dgelessus
868a322b8e Add Resource.compressed_info attribute
This allows accessing a compressed resource's header data, without
having to decompress it or parse the compressed data manually.
2019-09-23 23:50:29 +02:00
dgelessus
a23cd0fcb2 Simplify decompressor lookup
All decompressors now have exactly the same signature (as a result,
each decompressor now has to check itself that the header type is
correct). This allows the decompressors to be stored in a simple
dictionary, which makes the lookup process much simpler.
2019-09-23 23:32:38 +02:00
dgelessus
53e73be980 Pass complete header info to individual decompressors 2019-09-23 23:19:20 +02:00
dgelessus
9dbdf5b827 Move compressed header info constants/classes to .compress.common
This allows the constants/classes to be accessed from the individual
decompressor submodules.
2019-09-23 23:14:06 +02:00
dgelessus
87d4ae43d4 Refactor parsing of compressed resource headers
In preparation for #3, the compressed resource data headers are parsed
and stored as proper objects. For now these objects are only used
internally by the decompression code, but in the future they can be
exposed.
2019-09-23 23:10:55 +02:00
dgelessus
716ac30a53 Add release instructions in a comment in __init__.py 2019-09-16 17:09:47 +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
d7255bc977 Adjust --group=id output format slightly 2019-09-16 14:58:21 +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
51ae7c6a09 Refactor __main__.main into smaller functions 2019-09-13 14:17:21 +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
fb827e4073 Remove unused loop counter from _bytes_unescape 2019-09-03 01:35:47 +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
d7fb67fac1 Add better error checking for invalid resource files 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
7253c53d67 Add .editorconfig 2019-08-25 22:25:13 +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
dgelessus
f798928270 Rewrite, update and expand project descriptions 2019-08-25 21:37:50 +02:00
dgelessus
ad7f9f5d6d Add Trove Python :: 3.7 classifier 2019-08-25 00:04:12 +02:00
dgelessus
a8c09f19d1 Add Trove MacOS classifiers
Altough this library is OS-independent, it is specifically relevant to
Classic Mac OS and OS X, and provides some extra functionality on OS X
(reading actual resource forks, instead of resource fork data stored in
data forks/regular files).
2019-08-25 00:03:56 +02:00
dgelessus
af4c465613 Update Topic trove classifiers
"Topic :: Software Development :: Libraries :: Python Modules" appears
to be specifically for libraries used to develop Python modules, and
not for Python modules in general. A few more appropriate classifiers
have been added instead.
2019-08-25 00:00:56 +02:00
dgelessus
4a759027f4 Update changelog entry on resource compression 2019-08-24 23:48:27 +02:00
dgelessus
3e28fa7fe0 Fix typos 2019-08-24 23:38:07 +02:00
dgelessus
8904f6e093 Refactor the rsrcfork.compress module into separate submodules
Each decompressor now has its own module, since they share almost no
code between each other.
2019-08-22 21:20:35 +02:00
dgelessus
4c32987cc3 Add decompression support for 'dcmp' (1)-compressed resources 2019-08-22 18:36:33 +02:00
dgelessus
acd056973e Refactor rsrcfork.compress to prepare for 'dcmp' (1) support 2019-08-22 01:12:29 +02:00
dgelessus
3d444bda10 Move decompressed data length field into common compressed header
Previously it was handled separately (but identically) by both the
system and application decompression functions.
2019-08-21 23:30:20 +02:00
dgelessus
5bc2c0cc81 Add support for "application" compressed resources 2019-08-14 21:24:03 +02:00
dgelessus
360833f940 Refactor rsrcfork.compress to prepare for new compression type support 2019-07-14 21:41:14 +02:00