mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-21 23:18:13 +00:00
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
This commit is contained in:
parent
0470cf9865
commit
67b879ac07
2
python/.gitignore
vendored
2
python/.gitignore
vendored
@ -3,7 +3,7 @@
|
||||
MANIFEST
|
||||
/build
|
||||
/dist
|
||||
/trezor.egg-info
|
||||
*.egg-info
|
||||
*.bin
|
||||
*.py.cache
|
||||
/.tox
|
||||
|
@ -1,6 +1,7 @@
|
||||
recursive-include bash_completion.d *.sh
|
||||
include tools/*
|
||||
recursive-include trezorlib *
|
||||
graft src
|
||||
graft tests
|
||||
|
||||
include AUTHORS README.md COPYING CHANGELOG.md
|
||||
include requirements*.txt
|
||||
|
@ -2,14 +2,14 @@ PYTHON=python3
|
||||
SETUP=$(PYTHON) setup.py
|
||||
|
||||
EXCLUDES=.vscode
|
||||
STYLE_TARGETS=trezorlib trezorctl setup.py
|
||||
STYLE_TARGETS=src/trezorlib setup.py
|
||||
EXCLUDE_TARGETS=messages
|
||||
|
||||
all: build
|
||||
|
||||
clean-gen: ## remove generated files
|
||||
rm -f trezorlib/messages/*.py
|
||||
rm -f trezorlib/coins.json
|
||||
rm -f src/trezorlib/messages/*.py
|
||||
rm -f src/trezorlib/coins.json
|
||||
|
||||
coins_json:
|
||||
./helper-scripts/build-coins-json.sh
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
cd $(dirname $0)/..
|
||||
|
||||
DEST=trezorlib/coins.json
|
||||
DEST=src/trezorlib/coins.json
|
||||
|
||||
BUILD_COINS_AT="../common/tools/cointool.py dump \
|
||||
--list --support \
|
||||
|
@ -1,13 +1,11 @@
|
||||
[flake8]
|
||||
filename =
|
||||
*.py,
|
||||
./trezorctl
|
||||
filename = *.py
|
||||
exclude =
|
||||
.tox/,
|
||||
build/,
|
||||
dist/,
|
||||
vendor/,
|
||||
trezorlib/messages/__init__.py
|
||||
src/trezorlib/messages/__init__.py
|
||||
ignore =
|
||||
# E203 whitespace before ':'
|
||||
E203,
|
||||
|
@ -28,7 +28,7 @@ def read(*path):
|
||||
|
||||
|
||||
def find_version():
|
||||
version_file = read("trezorlib", "__init__.py")
|
||||
version_file = read("src", "trezorlib", "__init__.py")
|
||||
version_match = re.search(r"^__version__ = \"(.*)\"$", version_file, re.M)
|
||||
if version_match:
|
||||
return version_match.group(1)
|
||||
@ -60,9 +60,10 @@ setup(
|
||||
long_description="{}\n\n{}".format(read("README.md"), read("CHANGELOG.md")),
|
||||
long_description_content_type="text/markdown",
|
||||
url="https://github.com/trezor/python-trezor",
|
||||
packages=find_packages(),
|
||||
packages=find_packages("src"),
|
||||
package_dir={"": "src"},
|
||||
package_data={"trezorlib": ["coins.json"]},
|
||||
scripts=["trezorctl"],
|
||||
entry_points={"console_scripts": ["trezorctl=trezorlib.cli.trezorctl:cli"]},
|
||||
install_requires=install_requires,
|
||||
extras_require={
|
||||
"hidapi": ["hidapi>=0.7.99.post20"],
|
||||
|
@ -17,6 +17,7 @@
|
||||
import hashlib
|
||||
import hmac
|
||||
import struct
|
||||
import warnings
|
||||
|
||||
import ecdsa
|
||||
from ecdsa.curves import SECP256k1
|
||||
@ -25,6 +26,8 @@ from ecdsa.util import number_to_string, string_to_number
|
||||
|
||||
from trezorlib import messages, tools
|
||||
|
||||
warnings.warn("ckd_public module is deprecated and will be removed", DeprecationWarning)
|
||||
|
||||
|
||||
def point_to_pubkey(point):
|
||||
order = SECP256k1.order
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user