mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-26 22:32:33 +00:00
style: add makefile with style targets, final touchups
This commit is contained in:
parent
e2d45397d4
commit
88b50ac2ff
@ -30,19 +30,18 @@ install:
|
||||
- pip install "setuptools>=38" # setuptools >= 38 are capable of using prebuilt wheels
|
||||
- pip install "virtualenv<16.0.0" # virtualenv 16.0.0 drops support for py33 without properly declaring it
|
||||
- pip install tox-travis
|
||||
- pip install flake8
|
||||
- pip install -r requirements-dev.txt
|
||||
# protobuf-related dependencies
|
||||
- curl -LO "https://github.com/google/protobuf/releases/download/v${PROTOBUF_VERSION}/protoc-${PROTOBUF_VERSION}-linux-x86_64.zip"
|
||||
- unzip "protoc-${PROTOBUF_VERSION}-linux-x86_64.zip" -d protoc
|
||||
- export PATH="$(pwd)/protoc/bin:$PATH"
|
||||
- pip install "protobuf == ${PROTOBUF_VERSION}"
|
||||
|
||||
before_script:
|
||||
- ./trigger-travis.sh
|
||||
|
||||
script:
|
||||
- python setup.py install
|
||||
- flake8
|
||||
- make stylecheck
|
||||
- tox
|
||||
|
||||
notifications:
|
||||
|
27
Makefile
Normal file
27
Makefile
Normal file
@ -0,0 +1,27 @@
|
||||
PYTHON=python3
|
||||
SETUP=$(PYTHON) setup.py
|
||||
|
||||
EXCLUDES=.vscode
|
||||
STYLE_TARGETS=trezorlib trezorctl
|
||||
EXCLUDE_TARGETS=trezorlib/messages
|
||||
|
||||
all: build
|
||||
|
||||
build:
|
||||
$(SETUP) build
|
||||
|
||||
install:
|
||||
$(SETUP) install
|
||||
|
||||
clean:
|
||||
git clean -dfx -e $(EXCLUDES)
|
||||
|
||||
style:
|
||||
black $(STYLE_TARGETS)
|
||||
isort --apply --recursive $(STYLE_TARGETS) --skip-glob "*/$(EXCLUDE_TARGETS)/*"
|
||||
autoflake -i --remove-all-unused-imports -r $(STYLE_TARGETS)
|
||||
|
||||
stylecheck:
|
||||
black --check $(STYLE_TARGETS)
|
||||
isort --check-only --recursive $(STYLE_TARGETS) --skip-glob "*/$(EXCLUDE_TARGETS)/*"
|
||||
flake8
|
@ -4,3 +4,6 @@ pytest>=3.2.5
|
||||
mock>=2.0.0
|
||||
flake8
|
||||
protobuf
|
||||
isort
|
||||
black
|
||||
autoflake
|
||||
|
17
trezorctl
17
trezorctl
@ -22,33 +22,34 @@
|
||||
|
||||
import base64
|
||||
import binascii
|
||||
import click
|
||||
import hashlib
|
||||
import io
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
|
||||
from trezorlib.client import TrezorClient
|
||||
from trezorlib.transport import get_transport, enumerate_devices
|
||||
from trezorlib import coins
|
||||
from trezorlib import log
|
||||
from trezorlib import messages as proto
|
||||
import click
|
||||
|
||||
from trezorlib import (
|
||||
btc,
|
||||
coins,
|
||||
cosi,
|
||||
debuglink,
|
||||
device,
|
||||
ethereum,
|
||||
firmware,
|
||||
lisk,
|
||||
log,
|
||||
messages as proto,
|
||||
misc,
|
||||
nem,
|
||||
protobuf,
|
||||
ripple,
|
||||
stellar,
|
||||
tools,
|
||||
)
|
||||
from trezorlib import protobuf
|
||||
from trezorlib import tools
|
||||
from trezorlib.client import TrezorClient
|
||||
from trezorlib.transport import enumerate_devices, get_transport
|
||||
|
||||
|
||||
class ChoiceType(click.Choice):
|
||||
|
@ -1,8 +1,7 @@
|
||||
import binascii
|
||||
|
||||
from . import messages as proto
|
||||
from .tools import CallException, expect, normalize_nfc, dict_from_camelcase
|
||||
from .protobuf import dict_to_proto
|
||||
from .tools import CallException, dict_from_camelcase, expect, normalize_nfc
|
||||
|
||||
|
||||
@expect(proto.LiskAddress, field="address")
|
||||
|
@ -16,8 +16,8 @@
|
||||
|
||||
|
||||
from . import messages
|
||||
from .tools import expect, dict_from_camelcase
|
||||
from .protobuf import dict_to_proto
|
||||
from .tools import dict_from_camelcase, expect
|
||||
|
||||
REQUIRED_FIELDS = ("Fee", "Sequence", "TransactionType", "Amount", "Destination")
|
||||
|
||||
|
@ -16,11 +16,12 @@
|
||||
|
||||
import functools
|
||||
import os
|
||||
|
||||
import pytest
|
||||
|
||||
from trezorlib.transport import get_transport, enumerate_devices
|
||||
from trezorlib import coins, log
|
||||
from trezorlib.client import TrezorClient, TrezorClientDebugLink
|
||||
from trezorlib import log, coins
|
||||
from trezorlib.transport import enumerate_devices, get_transport
|
||||
|
||||
TREZOR_VERSION = None
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user