mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 07:28:10 +00:00
build: add build and check target for coins.json
This commit is contained in:
parent
6c2ebcb16a
commit
029f464f04
3
Makefile
3
Makefile
@ -70,4 +70,7 @@ protobuf_check: ## check that generated protobuf headers are up to date
|
||||
./tools/build_protobuf --check
|
||||
|
||||
gen: mocks templates protobuf ## regeneate auto-generated files from sources
|
||||
make -C python coins_json
|
||||
|
||||
gen_check: mocks_check templates_check protobuf_check ## check validity of auto-generated files
|
||||
make -C python coins_json_check
|
||||
|
@ -11,16 +11,14 @@ clean-gen: ## remove generated files
|
||||
rm -f trezorlib/messages/*.py
|
||||
rm -f trezorlib/coins.json
|
||||
|
||||
coins_json:
|
||||
./helper-scripts/build-coins-json.sh
|
||||
|
||||
coins_json_check:
|
||||
./helper-scripts/build-coins-json.sh --check
|
||||
|
||||
gen: clean-gen
|
||||
$(PYTHON) ../common/tools/cointool.py dump \
|
||||
--list --support \
|
||||
--include-type=bitcoin \
|
||||
--exclude=icon \
|
||||
-o trezorlib/coins.json
|
||||
$(PYTHON) ../common/protob/pb2py \
|
||||
-o trezorlib/messages \
|
||||
-P ..protobuf \
|
||||
../common/protob/*.proto
|
||||
make -C .. gen
|
||||
|
||||
build:
|
||||
$(SETUP) build
|
||||
|
24
python/helper-scripts/build-coins-json.sh
Executable file
24
python/helper-scripts/build-coins-json.sh
Executable file
@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
cd $(dirname $0)/..
|
||||
|
||||
DEST=trezorlib/coins.json
|
||||
|
||||
BUILD_COINS_AT="../common/tools/cointool.py dump \
|
||||
--list --support \
|
||||
--include-type=bitcoin \
|
||||
--exclude=icon \
|
||||
-o \
|
||||
"
|
||||
|
||||
if [ "$1" == "--check" ]; then
|
||||
TMP=$(mktemp)
|
||||
$BUILD_COINS_AT $TMP
|
||||
diff -q $DEST $TMP
|
||||
if [ "$?" -ne 0 ]; then
|
||||
echo "Please run $0"
|
||||
fi
|
||||
rm $TMP
|
||||
exit $ERR
|
||||
else
|
||||
$BUILD_COINS_AT $DEST
|
||||
fi
|
@ -24,7 +24,7 @@ COINS_JSON = os.path.join(os.path.dirname(__file__), "coins.json")
|
||||
|
||||
def _load_coins_json():
|
||||
# Load coins.json to local variables
|
||||
# NOTE: coins.json is generated via `make generated` command.
|
||||
# NOTE: coins.json is generated via `make coins_json` command.
|
||||
with open(COINS_JSON) as coins_json:
|
||||
return json.load(coins_json)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user