Skip to content

Commit f8b329b

Browse files
committed
Upgrade PySimpleGUI, hdwallet and tabulate, fix double-sided printing
1 parent 3f9ff7c commit f8b329b

21 files changed

+344
-3023
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
strategy:
2121
matrix:
2222
# Requires Python3 w/ Type Annotations
23-
python-version: ['3.9', '3.10', '3.11', '3.x']
23+
python-version: ['3.9', '3.10', '3.11', '3.12']
2424

2525
steps:
2626
- uses: actions/checkout@v2

GNUmakefile

Lines changed: 25 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,13 @@ CXFREEZE_EXT ?= win-$(CXFREEZE_ARCH)-$(CXFREEZE_VER)
4747
#SIGNTOOL ?= "/c/Program Files (x86)/Windows Kits/10/bin/10.0.19041.0/x86"
4848
SIGNTOOL ?= "c:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x86\signtool.exe"
4949

50+
NIX_OPTS ?= --pure
5051

5152
# PY[3] is the target Python interpreter; require 3.11+. Detect if it is named python3 or python.
5253
PY3 ?= $(shell python3 --version >/dev/null 2>&1 && echo python3 || echo python )
54+
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 )
5355
VERSION = $(shell $(PY3) -c 'exec(open("slip39/version.py").read()); print( __version__ )')
56+
WHEEL = dist/slip39-$(VERSION)-py3-none-any.whl
5457
PLATFORM ?= $(shell $(PY3) -c "import sys; print( sys.platform )" )
5558
ifeq ($(PLATFORM),darwin)
5659
INSTALLER := pkg
@@ -68,16 +71,15 @@ PY3TEST = $(PY3) -m pytest $(PYTESTOPTS)
6871
# VirtualEnv: Build them in eg. ~/src/python-slip39-1.2.3/
6972
# o Will use the *current* git branch when creating a venv and populating it
7073

71-
VENV_LOCAL ?= ~/src/
72-
7374
GHUB_NAME = python-slip39
74-
GHUB_REPO = [email protected]:pjkundert/$(GHUB_NAME)
75-
GHUB_BRCH = $(shell git rev-parse --abbrev-ref HEAD )
76-
VENV_NAME = $(GHUB_NAME)-$(VERSION)
75+
76+
VENV_DIR = $(abspath $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/.. )
77+
VENV_NAME = $(GHUB_NAME)-$(VERSION)-$(PY3_V)
78+
VENV = $(VENV_DIR)/$(VENV_NAME)
7779
VENV_OPTS = # --copies # Doesn't help; still references some system libs.
7880

7981

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

8284
all: help
8385

@@ -106,14 +108,6 @@ pylint:
106108
cd .. && pylint slip39 --disable=W,C,R
107109

108110

109-
build-check:
110-
@$(PY3) -m build --version \
111-
|| ( \
112-
echo -e "\n\n!!! Missing Python modules; run:"; \
113-
echo -e "\n\n $(PY3) -m pip install --break-system-packages --user --upgrade pip setuptools wheel build\n"; \
114-
false; \
115-
)
116-
117111
signing-check:
118112
$(SIGNTOOL)
119113

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

212-
venv: $(VENV_LOCAL)/$(VENV_NAME)
213-
venv-activate: $(VENV_LOCAL)/$(VENV_NAME)-activate
206+
venv: $(VENV)
207+
@echo; echo "*** Activating $< VirtualEnv for Interactive $(SHELL)"
208+
@bash --init-file $</bin/activate -i
214209

215-
$(VENV_LOCAL)/$(VENV_NAME):
216-
@git diff --quiet || ( \
217-
echo -e "\n\n!!! Git repo branch $(GHUB_BRCH) is dirty; cannot create venv!"; false \
218-
)
210+
$(VENV):
219211
@echo; echo "*** Building $@ VirtualEnv..."
220212
@rm -rf $@ && $(PY3) -m venv $(VENV_OPTS) $@ \
221-
&& cd $@ && git clone $(GHUB_REPO) -b $(GHUB_BRCH) \
222-
&& . ./bin/activate \
223-
&& make -C $(GHUB_NAME) install-tests install
224-
225-
# Activate a given VirtualEnv, and go to its python-slip39 installation
226-
# o Creates a custom venv-activate.sh script in the venv, and uses it start
227-
# start a sub-shell in that venv, with a CWD in the contained python-slip39 installation
228-
$(VENV_LOCAL)/$(VENV_NAME)-activate: $(VENV_LOCAL)/$(VENV_NAME)
229-
@echo; echo "*** Activating $@ VirtualEnv"
230-
@[ -s $</venv-activate.sh ] || ( \
231-
echo "PS1='[\u@\h \W)]\\$$ '"; \
232-
echo "[ ! -r ~/.git-completion.bash ] || source ~/.git-completion.bash"; \
233-
echo "[ ! -r ~/.git-prompt.sh ] || source ~/.git-prompt.sh && PS1='[\u@\h \W\$$(__git_ps1 \" (%s)\")]\\$$ '"; \
234-
echo "source $</bin/activate"; \
235-
echo "cd $</$(GHUB_NAME)"; \
236-
) > $</venv-activate.sh
237-
@bash --init-file $</venv-activate.sh -i
238-
239-
240-
wheel: deps dist/slip39-$(VERSION)-py3-none-any.whl
241-
242-
dist/slip39-$(VERSION)-py3-none-any.whl: build-check FORCE
213+
&& source $@/bin/activate \
214+
&& make install
215+
216+
217+
wheel: deps $(WHEEL)
218+
219+
$(WHEEL): FORCE
220+
$(PY3) -m pip install -r requirements-tests.txt
243221
$(PY3) -m build
244222
@ls -last dist
245223

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

250228
install-tests:
251-
$(PY3) -m pip install --upgrade --break-system-packages --user -r requirements-tests.txt
229+
$(PY3) -m pip install --upgrade -r requirements-tests.txt
252230

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

750+
nix-%:
751+
nix-shell $(NIX_OPTS) --run "make $*"
772752

773753
#
774754
# Target to allow the printing of 'make' variables, eg:

README.org

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2285,13 +2285,33 @@ f"MultiPayoutERC20 Contract & Forwarder Details:\n\n{mp}\n\n"
22852285

22862286
* Building & Installing
22872287

2288+
If you =git clone [email protected]:pjkundert/python-slip39.git= and have the source code, you can use
2289+
the supplied GNU =make= targets to create a venv Virtual Environment and build then install.
2290+
22882291
The =python-slip39= project is tested under both homebrew:
2289-
: $ brew install [email protected]
2290-
and using [[https://www.python.org/downloads/][the official python.org/downloads installer]].
2291-
2292-
Either of these methods will get you a =python3= executable running version 3.9+, usable for
2292+
: $ brew install [email protected]
2293+
: $ PY3=python3.12 make venv
2294+
: ...
2295+
: (python-slip39-13.0.0-usr-darwin-cpython-312) bash-3.2$
2296+
and using [[https://www.python.org/downloads/][the official python.org/downloads installer]]. It is also supported under Nix (optionally
2297+
prefixed with a =TARGET\=py310= and/or =NIX_OPTS\=""= to avoid --pure and gain access to locally
2298+
installed applications like emacs, but using the nix-supplied Python3 interpreter):
2299+
: $ make nix-venv
2300+
: ...
2301+
: *** Activating /Users/perry/src/python-slip39-13.0.0-nix-darwin-cpython-312 VirtualEnv for Interactive /bin/bash
2302+
: (python-slip39-13.0.0-nix-darwin-cpython-312) Perrys-MBP:python-slip39 perry$
2303+
2304+
Either of these methods will get you a =python3= executable running version 3.12+, usable for
22932305
running the =slip39= module, and the =slip39.gui= GUI.
22942306

2307+
To manually create your own venv and install from pypi using the Python 3.9 to 3.12 (+ TK if using
2308+
the GUI) you have at hand:
2309+
: $ python3.12 -m venv python-slip39-venv
2310+
: $ . ./python-slip39-venv/bin/activate
2311+
: (python-slip39-venv) [you@yourhost src]$ python3 -m pip install slip39[gui]
2312+
: ...
2313+
: (python-slip39-venv) [you@yourhost src]$ python3 -m slip39.gui
2314+
22952315
** The =slip39= Module
22962316

22972317
To build the wheel and install =slip39= manually:

README.pdf

-1.65 KB
Binary file not shown.

0 commit comments

Comments
 (0)