| 1 | # Trezor |
| 2 | |
| 3 | ## Messages rebuild |
| 4 | |
| 5 | Install `protoc` for your distribution. Requirements: |
| 6 | |
| 7 | - `protobuf-compiler` |
| 8 | - `libprotobuf-dev` |
| 9 | - `python` |
| 10 | |
| 11 | |
| 12 | Soft requirement: Python 3, can be easily installed with [pyenv]. |
| 13 | If Python 3 is used there are no additional python dependencies. |
| 14 | |
| 15 | Since Cmake 3.12 the `FindPython` module is used to locate the Python |
| 16 | interpreter in your system. It preferably searches for Python 3, if none |
| 17 | is found, it searches for Python 2. |
| 18 | |
| 19 | Lower version of the cmake uses another module which does not guarantee |
| 20 | ordering. If you want to override the selected python you can do it in |
| 21 | the following way: |
| 22 | |
| 23 | ```bash |
| 24 | export TREZOR_PYTHON=`which python3` |
| 25 | ``` |
| 26 | |
| 27 | |
| 28 | ### Python 2.7+ |
| 29 | |
| 30 | Python 3 has `tempfile.TemporaryDirectory` available but Python 2 lacks |
| 31 | this class so the message generation code uses `backports.tempfile` package |
| 32 | bundled in the repository. |
| 33 | |
| 34 | The minimal Python versions are 2.7 and 3.4 |
| 35 | |
| 36 | ### Regenerate messages |
| 37 | |
| 38 | ```bash |
| 39 | cd src/device_trezor/trezor |
| 40 | python tools/build_protob.py |
| 41 | ``` |
| 42 | |
| 43 | The messages regeneration is done also automatically via cmake. |
| 44 | |
| 45 | [pyenv]: https://github.com/pyenv/pyenv |