This helps when you try to build python-trezor from a subdirectory
of trezor-core, for whatever reason.
(For instance, when you run 'pipenv install' in trezor-core, and also
happen to have protobuf build tools available in the outside environment)
We only need ethereum libraries for `ethereum_sign_tx` in trezorctl,
and rlp has caused us dependency problems in the past already.
Also we required ethjsonrpc for the same thing but never listed
that dependency anywhere.
That changes now.
This drops the command line options. `libusb` is now required
unconditionally (it's cffi so no harm there). hidapi is an extra.
You either need to install it manually, or specify it in your
requirements.txt like so:
trezor[hidapi] >= 0.9.2
So, 'python setup.py develop' exists. And of course it doesn't have build_py as
a dependency, because of course it doesn't.
We could use 'data_files' instead of 'package_data and copying', and then use
pkg_resources to find the actual file location, and that could work in theory.
But pkg_resources API is weird and messy and this whole area of Python
packaging theory barely works as it is.
Instead we will force the prebuild command to be a dependency of develop as
well as build_py, and we do this by monkey-patching instead of the proper way,
because at this point it seems cleaner. I wonder if there are more commands
that would need this.
This enforces presence of the trezor-common submodule, copies coins.json to the
package directory (from where we can install it with bdist) and if possible,
regenerates protobuf messages.
That currently doesn't work on Windows, because it's a shell script. Also it
relies on presence of `protoc` protobuf compiler. Therefore the regeneration
step is optional and converted protobuf messages should still be commited to
this repo.
coins.json, OTOH, is gitignored in trezorlib, and must be copied from
trezor-common every time. This works because sdist includes the vendor
directory.