Compare commits

...

5 Commits

6 changed files with 29 additions and 17 deletions

View File

@ -3,7 +3,7 @@ jobs:
test:
strategy:
matrix:
platform: [macos-latest, ubuntu-latest, windows-latest]
platform: [macos-latest, ubuntu-20.04, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v3
@ -12,6 +12,6 @@ jobs:
python-version: "3.6"
- uses: actions/setup-python@v4
with:
python-version: "3.10"
python-version: "3.11"
- run: python -m pip install --upgrade tox
- run: tox

View File

@ -128,6 +128,8 @@ see the ["resource forks" section of the mac_file_format_docs repo](https://gith
* Added `open` and `open_raw` methods to `Resource` objects,
for stream-based access to resource data.
* Fixed reading of compressed resource headers with the header length field incorrectly set to 0
(because real Mac OS apparently accepts this).
### Version 1.8.0

View File

@ -18,6 +18,7 @@ classifiers =
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Topic :: Software Development :: Disassemblers
Topic :: System
Topic :: Utilities
@ -66,15 +67,24 @@ extend-exclude =
# The following issues are ignored because they do not match our code style:
ignore =
# These E1 checks report many false positives for code that is (consistently) indented with tabs alone.
E101, # indentation contains mixed spaces and tabs
E117, # over-indented
E126, # continuation line over-indented for hanging indent
E226, # missing whitespace around arithmetic operator
E261, # at least two spaces before inline comment
E501, # line too long
W191, # indentation contains tabs
W293, # blank line contains whitespace
W503, # line break before binary operator
# indentation contains mixed spaces and tabs
E101,
# over-indented
E117,
# continuation line over-indented for hanging indent
E126,
# missing whitespace around arithmetic operator
E226,
# at least two spaces before inline comment
E261,
# line too long
E501,
# indentation contains tabs
W191,
# blank line contains whitespace
W293,
# line break before binary operator
W503,
[mypy]
files=src/**/*.py

View File

@ -152,12 +152,12 @@ class Resource(object):
@property
def resource_type(self) -> bytes:
warnings.warn(DeprecationWarning("The resource_type attribute has been deprecated and will be removed in a future version. Please use the type attribute instead."))
warnings.warn(DeprecationWarning("The resource_type attribute has been deprecated and will be removed in a future version. Please use the type attribute instead."), stacklevel=2)
return self.type
@property
def resource_id(self) -> int:
warnings.warn(DeprecationWarning("The resource_id attribute has been deprecated and will be removed in a future version. Please use the id attribute instead."))
warnings.warn(DeprecationWarning("The resource_id attribute has been deprecated and will be removed in a future version. Please use the id attribute instead."), stacklevel=2)
return self.id
@property
@ -369,7 +369,7 @@ class ResourceFile(typing.Mapping[bytes, typing.Mapping[int, Resource]], typing.
fork = "rsrc"
else:
fork = "data"
warnings.warn(DeprecationWarning(f"The rsrcfork parameter has been deprecated and will be removed in a future version. Please use fork={fork!r} instead of rsrcfork={kwargs['rsrcfork']!r}."))
warnings.warn(DeprecationWarning(f"The rsrcfork parameter has been deprecated and will be removed in a future version. Please use fork={fork!r} instead of rsrcfork={kwargs['rsrcfork']!r}."), stacklevel=2)
del kwargs["rsrcfork"]
if fork == "auto":

View File

@ -46,8 +46,8 @@ class CompressedHeaderInfo(object):
raise DecompressError("Invalid header")
if signature != COMPRESSED_SIGNATURE:
raise DecompressError(f"Invalid signature: {signature!r}, expected {COMPRESSED_SIGNATURE!r}")
if header_length != 0x12:
raise DecompressError(f"Unsupported header length: 0x{header_length:>04x}, expected 0x12")
if header_length not in {0, 0x12}:
raise DecompressError(f"Unsupported header length value: 0x{header_length:>04x}, expected 0x12 or 0")
if compression_type == COMPRESSED_TYPE_8:
working_buffer_fractional_size, expansion_buffer_size, dcmp_id, reserved = STRUCT_COMPRESSED_TYPE_8_HEADER.unpack(remainder)

View File

@ -1,7 +1,7 @@
[tox]
# When updating the Python versions here,
# please also update the corresponding Python versions in the GitHub Actions workflow (.github/workflows/ci.yml).
envlist = py{36,310},flake8,mypy,package
envlist = py{36,311},flake8,mypy,package
[testenv]
commands = python -m unittest discover --start-directory ./tests