1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-15 12:08:59 +00:00
Commit Graph

5 Commits

Author SHA1 Message Date
amadejpapez
85ba7c12ba style(all): use f-strings for formatting
[no changelog]
2021-10-13 11:53:17 +02:00
matejcik
a58823cc0c refactor(python): rework trezorlib protobuf codec
API-compatibility with the original one is retained.

Now that we don't need to keep code parity with core, we could do some
changes that make life easier.

All generated classes are now in one file. This makes github diffs more
readable, at the cost of somewhat complicating inspecting individual
classes; however, that is something we shouldn't be doing anyway.

Enums are now implemented as enum.IntEnum.

The original class-level FIELDS member was restored.

Each field is now defined via protobuf.Field, which is easier to work
with in the codec, AND we're not stuffing defaults and flags into the
same field.
2021-06-08 09:55:19 +02:00
Pavol Rusnak
1187e4ddaf style(common): use new syntax for typing in autogenerated protobuf enums 2020-12-01 15:52:29 +01:00
matejcik
9a330f3475 python: unify protobuf-encoding code paths
Protobuf encoding now happens in TrezorClient, and transports get encoded blobs
to (chunkify and) send.  This is a better design because transports don't need
to know about protobuf.

It also lays groundwork for sending raw bytes feature (#116)

This commit also removes all vestiges of ProtocolV2 which was never used and
will probably need to be redesigned from the ground up anyway. The code is
still ready for protocol flexibility.
2020-03-26 11:30:06 +01:00
matejcik
67b879ac07 python: restructure package
This deserves some explanation.

* tests were moved to separate python/tests subdir
* trezorlib was moved to python/src, so that it does not exist on
PYTHONPATH by default
(see https://blog.ionelmc.ro/2014/05/25/python-packaging/ for details)
* everything was updated to understand the new structure
* trezorctl was changed from a top-level executable script to a module
`trezorlib.cli.trezorctl` and is installed via the entry_points
mechanism.
This should make it work normally on Windows!

The package should be installable as normal through pip and pipenv, no
changes are needed on that side.

The source package from pypi will include unit tests. (Device tests were
completely moved out). Wheel will exclude them, because users don't need
them.
That shrinks the .whl from 520 kB to 270 - nice!

python: reorganize remaining unit tests
2019-08-12 12:57:25 +02:00