From d93c8f7ab0886e030ff8f30aaf99d86ab95cd687 Mon Sep 17 00:00:00 2001 From: Kiminuo Date: Sun, 12 Jun 2022 22:30:52 +0200 Subject: [PATCH 1/4] Add support for arm64 # Conflicts: # contrib/build.Dockerfile # contrib/build_bin.sh --- contrib/build_bin.sh | 10 ++++++---- hwi.spec | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/contrib/build_bin.sh b/contrib/build_bin.sh index 17f6e14eb..7e8d5a71d 100755 --- a/contrib/build_bin.sh +++ b/contrib/build_bin.sh @@ -4,6 +4,8 @@ set -ex +ARCH=$(uname -m | tr '[:upper:]' '[:lower:]') + eval "$(pyenv init --path)" eval "$(pyenv virtualenv-init -)" pip install -U pip @@ -12,7 +14,7 @@ pip install poetry gui_support="${1:---with-gui}"; # Setup poetry and install the dependencies -if [[ $gui_support == "--with-gui" ]]; then +if [[ $gui_support == "--with-gui" && $ARCH == "x86_64" ]]; then poetry install -E qt else poetry install @@ -26,7 +28,7 @@ TZ=UTC find ${lib_dir} -name '*.py' -type f -execdir touch -t "201901010000.00" export PYTHONHASHSEED=42 poetry run pyinstaller hwi.spec -if [[ $gui_support == "--with-gui" ]]; then +if [[ $gui_support == "--with-gui" && $ARCH == "x86_64" ]]; then poetry run contrib/generate-ui.sh poetry run pyinstaller hwi-qt.spec fi @@ -40,7 +42,7 @@ OS=`uname | tr '[:upper:]' '[:lower:]'` if [[ $OS == "darwin" ]]; then OS="mac" fi -ARCH=$(uname -m | tr '[:upper:]' '[:lower:]') + target_tarfile="hwi-${VERSION}-${OS}-${ARCH}.tar.gz" if [[ $gui_support == "--with-gui" ]]; then @@ -54,7 +56,7 @@ target_dir="$target_tarfile.dir" mkdir $target_dir mv hwi $target_dir -if [[ $gui_support == "--with-gui" ]]; then +if [[ $gui_support == "--with-gui" && $arch == "x86_64" ]]; then mv hwi-qt $target_dir fi diff --git a/hwi.spec b/hwi.spec index 1502458f8..6ad8d380c 100644 --- a/hwi.spec +++ b/hwi.spec @@ -13,7 +13,7 @@ def get_libusb_path(): prefix = proc.communicate()[0].rstrip().decode() return os.path.join(prefix, "lib", "libusb-1.0.dylib") if platform.system() == "Linux": - for lib_dir in ["/lib/x86_64-linux-gnu", "/usr/lib64", "/lib64" "/usr/lib", "/lib"]: + for lib_dir in ["/lib/x86_64-linux-gnu", "/lib/aarch64-linux-gnu", "/usr/lib64", "/lib64" "/usr/lib", "/lib"]: libusb_path = os.path.join(lib_dir, "libusb-1.0.so.0") if os.path.exists(libusb_path): return libusb_path From ee3cf5f4655cf2dbd270453d0b865717a3088dfa Mon Sep 17 00:00:00 2001 From: Kiminuo Date: Fri, 19 Jan 2024 08:28:31 +0100 Subject: [PATCH 2/4] Add release instructions --- docs/development/release-process.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/development/release-process.rst b/docs/development/release-process.rst index 34db9fb7f..42af0c595 100644 --- a/docs/development/release-process.rst +++ b/docs/development/release-process.rst @@ -17,11 +17,15 @@ Create the docker images:: docker build --no-cache -t hwi-builder -f contrib/build.Dockerfile . docker build --no-cache -t hwi-wine-builder -f contrib/build-wine.Dockerfile . + docker buildx build --no-cache --platform linux/arm64 -t hwi-builder-arm64 -f contrib/build.Dockerfile . Build everything:: docker run -it --name hwi-builder -v $PWD:/opt/hwi --rm --workdir /opt/hwi hwi-builder /bin/bash -c "contrib/build_bin.sh && contrib/build_dist.sh" docker run -it --name hwi-wine-builder -v $PWD:/opt/hwi --rm --workdir /opt/hwi hwi-wine-builder /bin/bash -c "contrib/build_wine.sh" + docker run --platform linux/arm64 -it --rm --name hwi-builder-arm64 -v $PWD:/opt/hwi --workdir /opt/hwi hwi-builder-arm64 /bin/bash -c "contrib/build_bin.sh --without-gui && contrib/build_dist.sh --without-gui" + +i.e. Building macOS binary ===================== From 3d3c02d30949b378101446cb6f8ca57a7665ff00 Mon Sep 17 00:00:00 2001 From: Kiminuo Date: Fri, 19 Jan 2024 08:41:08 +0100 Subject: [PATCH 3/4] Improve --- docs/development/release-process.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/development/release-process.rst b/docs/development/release-process.rst index 42af0c595..6a3c58d04 100644 --- a/docs/development/release-process.rst +++ b/docs/development/release-process.rst @@ -17,6 +17,9 @@ Create the docker images:: docker build --no-cache -t hwi-builder -f contrib/build.Dockerfile . docker build --no-cache -t hwi-wine-builder -f contrib/build-wine.Dockerfile . + + # arm64 + sudo apt-get install qemu-user-static docker buildx build --no-cache --platform linux/arm64 -t hwi-builder-arm64 -f contrib/build.Dockerfile . Build everything:: From 8d4fa19551ce1b097bd011ce1e7ce64008a1d87c Mon Sep 17 00:00:00 2001 From: Ava Chow Date: Tue, 30 Jan 2024 13:31:59 -0500 Subject: [PATCH 4/4] Bump to 2.4.0 and regenerate setup.py --- hwilib/__init__.py | 2 +- pyproject.toml | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hwilib/__init__.py b/hwilib/__init__.py index 41f71723d..3d67cd6bb 100644 --- a/hwilib/__init__.py +++ b/hwilib/__init__.py @@ -1 +1 @@ -__version__ = "2.4.0-rc.1" +__version__ = "2.4.0" diff --git a/pyproject.toml b/pyproject.toml index 265163849..8b341f94e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "hwi" -version = "2.4.0-rc.1" +version = "2.4.0" description = "A library for working with Bitcoin hardware wallets" authors = ["Ava Chow "] license = "MIT" diff --git a/setup.py b/setup.py index 79e32a02f..37075cc00 100644 --- a/setup.py +++ b/setup.py @@ -47,7 +47,7 @@ setup_kwargs = { 'name': 'hwi', - 'version': '2.4.0rc1', + 'version': '2.4.0', 'description': 'A library for working with Bitcoin hardware wallets', 'long_description': "# Bitcoin Hardware Wallet Interface\n\n[![Build Status](https://api.cirrus-ci.com/github/bitcoin-core/HWI.svg)](https://cirrus-ci.com/github/bitcoin-core/HWI)\n[![Documentation Status](https://readthedocs.org/projects/hwi/badge/?version=latest)](https://hwi.readthedocs.io/en/latest/?badge=latest)\n\nThe Bitcoin Hardware Wallet Interface is a Python library and command line tool for interacting with hardware wallets.\nIt provides a standard way for software to work with hardware wallets without needing to implement device specific drivers.\nPython software can use the provided library (`hwilib`). Software in other languages can execute the `hwi` tool.\n\nCaveat emptor: Inclusion of a specific hardware wallet vendor does not imply any endorsement of quality or security.\n\n## Prerequisites\n\nPython 3 is required. The libraries and [udev rules](hwilib/udev/README.md) for each device must also be installed. Some libraries will need to be installed\n\nFor Ubuntu/Debian:\n```\nsudo apt install libusb-1.0-0-dev libudev-dev python3-dev\n```\n\nFor Centos:\n```\nsudo yum -y install python3-devel libusbx-devel systemd-devel\n```\n\nFor macOS:\n```\nbrew install libusb\n```\n\n## Install\n\n```\ngit clone https://github.com/bitcoin-core/HWI.git\ncd HWI\npoetry install # or 'pip3 install .' or 'python3 setup.py install'\n```\n\nThis project uses the [Poetry](https://github.com/sdispater/poetry) dependency manager. HWI and its dependencies can be installed via poetry by executing the following in the root source directory:\n\n```\npoetry install\n```\n\nPip can also be used to automatically install HWI and its dependencies using the `setup.py` file (which is usually in sync with `pyproject.toml`):\n\n```\npip3 install .\n```\n\nThe `setup.py` file can be used to install HWI and its dependencies so long as `setuptools` is also installed:\n\n```\npip3 install -U setuptools\npython3 setup.py install\n```\n\n## Dependencies\n\nSee `pyproject.toml` for all dependencies. Dependencies under `[tool.poetry.dependencies]` are user dependencies, and `[tool.poetry.dev-dependencies]` for development based dependencies. These dependencies will be installed with any of the three above installation methods.\n\n## Usage\n\nTo use, first enumerate all devices and find the one that you want to use with\n\n```\n./hwi.py enumerate\n```\n\nOnce the device type and device path are known, issue commands to it like so:\n\n```\n./hwi.py -t -d \n```\n\nAll output will be in JSON form and sent to `stdout`.\nAdditional information or prompts will be sent to `stderr` and will not necessarily be in JSON.\nThis additional information is for debugging purposes.\n\nTo see a complete list of available commands and global parameters, run\n`./hwi.py --help`. To see options specific to a particular command,\npass the `--help` parameter after the command name; for example:\n\n```\n./hwi.py getdescriptors --help\n```\n\n## Documentation\n\nDocumentation for HWI can be found on [readthedocs.io](https://hwi.readthedocs.io/).\n\n### Device Support\n\nFor documentation on devices supported and how they are supported, please check the [device support page](https://hwi.readthedocs.io/en/latest/devices/index.html#support-matrix)\n\n### Using with Bitcoin Core\n\nSee [Using Bitcoin Core with Hardware Wallets](https://hwi.readthedocs.io/en/latest/examples/bitcoin-core-usage.html).\n\n## License\n\nThis project is available under the MIT License, Copyright Andrew Chow.\n", 'author': 'Ava Chow',