Commit Graph

156 Commits

Author SHA1 Message Date
dgelessus
b0eefe3889 Replace custom CLI subcommand system with standard argparse subparsers
This is a purely internal change and should have no visible effect on
the command-line interface.
2020-07-05 19:43:01 +02:00
dgelessus
3e0bbcee04 Add Python 3.8 classifier to metadata 2020-04-19 16:21:25 +02:00
dgelessus
13654c2560 Add pyproject.toml with PEP 517/PEP 518 metadata 2020-04-19 16:21:04 +02:00
dgelessus
d5199bd503 Replace setup.cfg metadata license_file with license_files
license_file has been deprecated in wheel 0.32.0 in favor of
license_files.
2020-04-19 16:20:07 +02:00
dgelessus
c5c3f24a10 Add tox environment for building and checking distributions 2020-04-19 16:16:21 +02:00
dgelessus
7c77c4ef20 Prepare setup.py/.cfg for additional import-time dependencies
Reading the version number using attr: rsrcfork.__version__ will no
longer work properly if rsrcfork has non-stdlib dependencies at import
time, because setuptools needs to be able to import rsrcfork and read
the version number before the dependencies are installed.

As a workaround, our setup.py now manually parses the version number
from rsrcfork/__init__.py using the ast module.
2020-04-03 22:32:10 +02:00
dgelessus
f7b6080c0e Remove random execute bits from test data files 2020-04-01 00:01:50 +02:00
dgelessus
007d15eb3d Fix tox configuration breaking on spaces in the project path
The {envpython} substitution is not quoted, so spaces in the path are
treated as argument separators and cause the test runs to fail.
To work around this, we now always use an unqualified python command
instead of the {envpython} substitution. This is safe because the tox
commands are always run in a virtual environment, so the python command
is guaranteed to point to the environment's Python and not the system
default.
2020-03-30 01:46:10 +02:00
dgelessus
246b69e375 Remove accidental empty comment from test_rsrcfork.py 2020-01-21 22:32:44 +01:00
dgelessus
d67ff64851 Add tests for reading from resource forks and fork auto-selection
These tests are only run on Mac, because they require native support
for resource forks.
2020-01-21 22:29:18 +01:00
dgelessus
5391d66a78 Add tests for reading resource files from streams instead of path 2020-01-21 15:20:46 +01:00
dgelessus
5b2700bf17 Add some missing asserts to test_compress_compare 2020-01-19 23:24:52 +01:00
dgelessus
c41b25fea1 Add test case for compressed resource handling and decompression 2020-01-19 23:19:19 +01:00
dgelessus
a45dbd8eca Remove upgrade of pip from CI workflow
The GitHub Actions environment clearly has a working pip pre-installed,
and it's unlikely that this project relies on any extremely new
features.
2020-01-19 19:59:42 +01:00
dgelessus
3401ce65dd Update actions/checkout to v2 2020-01-19 19:38:29 +01:00
dgelessus
890dd24f76 Also run CI workflow on pull requests 2020-01-19 19:36:53 +01:00
dgelessus
67c2b4acf0 Add test case for additional resource file and resource metadata 2020-01-19 19:22:59 +01:00
dgelessus
238c78a73e Simplify attribute asserts in tests 2020-01-19 19:05:05 +01:00
dgelessus
fbd861edf4 Fix test_textclipping not checking resource ID lists properly
Because Python's zip terminates once *any* of the input iterables
terminates, the previous code would not detect if the file was missing
resources or contained extra ones.
2020-01-19 02:30:10 +01:00
dgelessus
a7a407a1dd Add extra assertion to test_textclipping 2019-12-30 03:04:48 +01:00
dgelessus
ecee2616cf Add flake8-bugbear plugin 2019-12-30 03:04:27 +01:00
dgelessus
ba284d1800 Fix a bunch of flake8 violations 2019-12-30 03:00:12 +01:00
dgelessus
f690caac24 Add flake8 configuration 2019-12-30 02:57:31 +01:00
dgelessus
3a805c3e56 Add GitHub Actions workflow for CI 2019-12-30 01:59:05 +01:00
dgelessus
6adf8eb88d Fix mypy errors about byte strings as format string parameters 2019-12-30 01:48:33 +01:00
dgelessus
e132a91dea Fix missing sys.exit calls in CLI subcommand functions 2019-12-30 01:48:33 +01:00
dgelessus
4e1cd05412 Fix miscellaneous mypy errors 2019-12-30 01:48:33 +01:00
dgelessus
1a416defed Add tox configuration 2019-12-30 01:48:33 +01:00
dgelessus
1089a19c01 Add basic unit tests 2019-12-29 00:39:40 +01: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
2abf6e2a06 Add class for resource filters in place of lambdas
This is easier to debug (printing out a lambda doesn't show what values
it checks against) and makes it easier to check that the filter values
are valid.
2019-12-25 00:15:35 +01:00
dgelessus
2b0bbb19ed Refactor filter_resources in __main__
With the new implementation, each filter is converted to a function,
then all resources are checked if they match any of the filter
functions. This is simpler than the old implementation, where the
resource lookup code was slightly different for some filter forms.
2019-12-25 00:15:35 +01:00
dgelessus
c009e8f80f Support passing an empty filter list to filter_resources 2019-12-25 00:15:35 +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
8568f355c4 Remove incorrect outdated paragraph from list subcommand help 2019-12-10 16:15:18 +01:00
dgelessus
97d2dbe1b3 Change formatting of command help strings in source code
The automatic textwrap.dedent makes it impossible to cleanly extract
parts of the help strings into separate constants.
2019-12-10 15:58:20 +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
476eaecd17 Fix typo in the help text for rsrcfork read 2019-12-04 21:16:29 +01:00
dgelessus
546edbc31a Update and improve resource and resource map reprs 2019-12-04 02:01:40 +01:00
dgelessus
cf6ce3c2a6 Move _LazyResourceMap out of ResourceFile 2019-12-04 02:01:40 +01:00
dgelessus
af2ac70676 Simplify ResourceFile._references and ._LazyResourceMap
The _references map now stores Resource objects directly, instead of
constructing them only when they are looked up. Resource objects are
now lazy themselves, so the previous lazy resource creation mechanism
is redundant.

_LazyResourceMap is now a simple read-only wrapper around an existing
map. The custom class is now only used to provide a specialized repr.
2019-12-04 02:01:40 +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