aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Makefile
diff options
context:
space:
mode:
authorWolfgang Müller2024-11-10 13:46:44 +0100
committerWolfgang Müller2024-11-11 16:03:02 +0100
commit65894a5f7da0d58eebcdb5664ec116b31056a2ab (patch)
tree8723ee1c66ce81307f6daddce5181ce0fbd3449b /Makefile
parentfbdc88ad574429ff236211376d07f89c818d0930 (diff)
downloadlater-65894a5f7da0d58eebcdb5664ec116b31056a2ab.tar.gz
Migrate to proper Python package layout
Up until now we've kept the entirety of later(1)'s functionality in one file. Whilst this is perfectly fine for smaller scripts, the functionality of later(1) has grown to a size where this become less feasible. Since we expect it to grow even further, switch to a "proper" source layout sooner rather than later. This will allow easier extension, testing and packaging later on. Since we want to keep installation simple for end-users still, package later(1) as a zipapp [1] in the Makefile. When installed, this file can be executed just like the single Python script before it. Using this way of installation is not mandatory however, the package layout also supports regular installation with pip and development with poetry. [1] https://docs.python.org/3.12/library/zipapp.html
Diffstat (limited to '')
-rw-r--r--Makefile15
1 files changed, 12 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index d9e9eba..2d947c2 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,16 @@
PREFIX ?= /usr/local
-install: later later.1
- install -D -m 755 -t '${DESTDIR}${PREFIX}/bin' later
+install: later.pyz later.1
+ install -D -m 755 later.pyz '${DESTDIR}${PREFIX}/bin/later'
install -D -m 644 -t '${DESTDIR}${PREFIX}/share/man/man1' later.1
-.PHONY: install
+later.pyz:
+ python -m zipapp -p "/usr/bin/env python3" -o later.pyz src/
+
+clean:
+ rm -f later.pyz
+
+test:
+ pytest -q
+
+.PHONY: install clean test