Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/slip39-extendable-backups'
Browse files Browse the repository at this point in the history
  • Loading branch information
pjkundert committed Nov 15, 2024
2 parents 3f9ff7c + 124f006 commit 2bbb039
Show file tree
Hide file tree
Showing 35 changed files with 1,776 additions and 3,533 deletions.
22 changes: 12 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,28 @@ on:
jobs:
build:

runs-on: ubuntu-latest
runs-on: ubuntu-24.04
strategy:
matrix:
# Requires Python3 w/ Type Annotations
python-version: ['3.9', '3.10', '3.11', '3.x']
python-version: ['3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v2
- name: Checkout repository code
uses: actions/checkout@master
- name: Update openssl
run: |
#sudo apt-get update
#sudo apt-get -y install openssl
openssl version
openssl
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@master
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements.txt
python3 -m pip install -r requirements-serial.txt
python3 -m pip install -r requirements-gui.txt
python3 -m pip install -r requirements-wallet.txt
python3 -m pip install -r requirements-tests.txt
python3 -m pip install .[all,tests]
- name: Lint with flake8
run: |
make analyze
Expand Down
72 changes: 26 additions & 46 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,13 @@ CXFREEZE_EXT ?= win-$(CXFREEZE_ARCH)-$(CXFREEZE_VER)
#SIGNTOOL ?= "/c/Program Files (x86)/Windows Kits/10/bin/10.0.19041.0/x86"
SIGNTOOL ?= "c:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x86\signtool.exe"

NIX_OPTS ?= --pure

# PY[3] is the target Python interpreter; require 3.11+. Detect if it is named python3 or python.
PY3 ?= $(shell python3 --version >/dev/null 2>&1 && echo python3 || echo python )
PY3_V = $(shell $(PY3) -c "import sys; print('-'.join((next(iter(filter(None,sys.executable.split('/')))),sys.platform,sys.implementation.cache_tag)))" 2>/dev/null )
VERSION = $(shell $(PY3) -c 'exec(open("slip39/version.py").read()); print( __version__ )')
WHEEL = dist/slip39-$(VERSION)-py3-none-any.whl
PLATFORM ?= $(shell $(PY3) -c "import sys; print( sys.platform )" )
ifeq ($(PLATFORM),darwin)
INSTALLER := pkg
Expand All @@ -61,23 +64,22 @@ else
endif

# To see all pytest output, uncomment --capture=no, ...
PYTESTOPTS = --capture=no --log-cli-level=WARNING
PYTESTOPTS = -v --log-cli-level=WARNING # --capture=no # --doctest-modules

PY3TEST = $(PY3) -m pytest $(PYTESTOPTS)

# VirtualEnv: Build them in eg. ~/src/python-slip39-1.2.3/
# o Will use the *current* git branch when creating a venv and populating it

VENV_LOCAL ?= ~/src/

GHUB_NAME = python-slip39
GHUB_REPO = [email protected]:pjkundert/$(GHUB_NAME)
GHUB_BRCH = $(shell git rev-parse --abbrev-ref HEAD )
VENV_NAME = $(GHUB_NAME)-$(VERSION)

VENV_DIR = $(abspath $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/.. )
VENV_NAME = $(GHUB_NAME)-$(VERSION)-$(PY3_V)
VENV = $(VENV_DIR)/$(VENV_NAME)
VENV_OPTS = # --copies # Doesn't help; still references some system libs.


.PHONY: all help test doctest analyze pylint build-check build install upload clean FORCE
.PHONY: all help test doctest analyze pylint build install upload clean FORCE

all: help

Expand Down Expand Up @@ -106,14 +108,6 @@ pylint:
cd .. && pylint slip39 --disable=W,C,R


build-check:
@$(PY3) -m build --version \
|| ( \
echo -e "\n\n!!! Missing Python modules; run:"; \
echo -e "\n\n $(PY3) -m pip install --break-system-packages --user --upgrade pip setuptools wheel build\n"; \
false; \
)

signing-check:
$(SIGNTOOL)

Expand Down Expand Up @@ -209,46 +203,30 @@ perry-kundert: GRANTS="{\"crypto-licensing-server\": {\
# VirtualEnv build, install and activate
#

venv: $(VENV_LOCAL)/$(VENV_NAME)
venv-activate: $(VENV_LOCAL)/$(VENV_NAME)-activate
venv: $(VENV)
@echo; echo "*** Activating $< VirtualEnv for Interactive $(SHELL)"
@bash --init-file $</bin/activate -i

$(VENV_LOCAL)/$(VENV_NAME):
@git diff --quiet || ( \
echo -e "\n\n!!! Git repo branch $(GHUB_BRCH) is dirty; cannot create venv!"; false \
)
$(VENV):
@echo; echo "*** Building $@ VirtualEnv..."
@rm -rf $@ && $(PY3) -m venv $(VENV_OPTS) $@ \
&& cd $@ && git clone $(GHUB_REPO) -b $(GHUB_BRCH) \
&& . ./bin/activate \
&& make -C $(GHUB_NAME) install-tests install

# Activate a given VirtualEnv, and go to its python-slip39 installation
# o Creates a custom venv-activate.sh script in the venv, and uses it start
# start a sub-shell in that venv, with a CWD in the contained python-slip39 installation
$(VENV_LOCAL)/$(VENV_NAME)-activate: $(VENV_LOCAL)/$(VENV_NAME)
@echo; echo "*** Activating $@ VirtualEnv"
@[ -s $</venv-activate.sh ] || ( \
echo "PS1='[\u@\h \W)]\\$$ '"; \
echo "[ ! -r ~/.git-completion.bash ] || source ~/.git-completion.bash"; \
echo "[ ! -r ~/.git-prompt.sh ] || source ~/.git-prompt.sh && PS1='[\u@\h \W\$$(__git_ps1 \" (%s)\")]\\$$ '"; \
echo "source $</bin/activate"; \
echo "cd $</$(GHUB_NAME)"; \
) > $</venv-activate.sh
@bash --init-file $</venv-activate.sh -i


wheel: deps dist/slip39-$(VERSION)-py3-none-any.whl

dist/slip39-$(VERSION)-py3-none-any.whl: build-check FORCE
&& source $@/bin/activate \
&& make install install-tests


wheel: deps $(WHEEL)

$(WHEEL): FORCE
$(PY3) -m pip install -r requirements-tests.txt
$(PY3) -m build
@ls -last dist

# Install from wheel, including all optional extra dependencies (except dev)
install: dist/slip39-$(VERSION)-py3-none-any.whl FORCE
$(PY3) -m pip install --break-system-packages --user --force-reinstall $<[all]
install: $(WHEEL) FORCE
$(PY3) -m pip install --force-reinstall $<[all]

install-tests:
$(PY3) -m pip install --upgrade --break-system-packages --user -r requirements-tests.txt
$(PY3) -m pip install --upgrade -r requirements-tests.txt

# Building / Signing / Notarizing and Uploading the macOS or win32 App
# o TODO: no signed and notarized package yet accepted for upload by macOS App Store
Expand Down Expand Up @@ -769,6 +747,8 @@ test-%:
unit-%:
$(PY3TEST) -k $*

nix-%:
nix-shell $(NIX_OPTS) --run "make $*"

#
# Target to allow the printing of 'make' variables, eg:
Expand Down
Loading

0 comments on commit 2bbb039

Please sign in to comment.