patx/twig
add .deb
Commit 7533167 · harrison erd · 2026-06-14T01:29:26-04:00
Comments
No comments yet.
Diff
diff --git a/.gitignore b/.gitignore
index 43ae0e2..9988ede 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
__pycache__/
*.py[cod]
+build/
diff --git a/Makefile b/Makefile
index 0a86dcd..e0af79a 100644
--- a/Makefile
+++ b/Makefile
@@ -3,12 +3,21 @@ BINDIR ?= $(PREFIX)/bin
DATADIR ?= $(PREFIX)/share
APPDIR ?= $(DATADIR)/applications
ICONDIR ?= $(DATADIR)/icons/hicolor
+MANDIR ?= $(DATADIR)/man
+PACKAGE ?= twig
+VERSION ?= 0.1.0
+DEB_ARCH ?= all
+DEB_BUILD_DIR ?= build/deb
+DEB_ROOT ?= $(DEB_BUILD_DIR)/$(PACKAGE)
+DEB_FILE ?= dist/$(PACKAGE)_$(VERSION)_$(DEB_ARCH).deb
+DEB_CHANGELOG_DATE ?= $(shell date -R)
-.PHONY: install uninstall check
+.PHONY: install uninstall check deb clean-deb
install:
install -Dm755 twig.py "$(DESTDIR)$(BINDIR)/twig"
install -Dm644 twig.desktop "$(DESTDIR)$(APPDIR)/twig.desktop"
+ install -Dm644 docs/twig.1 "$(DESTDIR)$(MANDIR)/man1/twig.1"
for size in 16 24 32 48 64 128 256 512; do \
install -Dm644 "icons/hicolor/$${size}x$${size}/apps/twig.png" \
"$(DESTDIR)$(ICONDIR)/$${size}x$${size}/apps/twig.png"; \
@@ -17,6 +26,7 @@ install:
uninstall:
rm -f "$(DESTDIR)$(BINDIR)/twig"
rm -f "$(DESTDIR)$(APPDIR)/twig.desktop"
+ rm -f "$(DESTDIR)$(MANDIR)/man1/twig.1"
for size in 16 24 32 48 64 128 256 512; do \
rm -f "$(DESTDIR)$(ICONDIR)/$${size}x$${size}/apps/twig.png"; \
done
@@ -25,3 +35,31 @@ check:
python3 -m py_compile twig.py
python3 -m unittest discover -s tests
desktop-file-validate twig.desktop
+
+deb: check clean-deb
+ $(MAKE) install DESTDIR="$(CURDIR)/$(DEB_ROOT)" PREFIX=/usr
+ install -Dm644 LICENSE "$(DEB_ROOT)/usr/share/doc/$(PACKAGE)/copyright"
+ install -Dm644 README.md "$(DEB_ROOT)/usr/share/doc/$(PACKAGE)/README.md"
+ install -d "$(DEB_ROOT)/usr/share/doc/$(PACKAGE)"
+ printf '%s\n\n%s\n\n%s\n' "$(PACKAGE) ($(VERSION)) stable; urgency=medium" " * Build local Debian package." " -- harrison erd <[email protected]> $(DEB_CHANGELOG_DATE)" | gzip -9n > "$(DEB_ROOT)/usr/share/doc/$(PACKAGE)/changelog.gz"
+ chmod 0644 "$(DEB_ROOT)/usr/share/doc/$(PACKAGE)/changelog.gz"
+ gzip -9n "$(DEB_ROOT)/usr/share/man/man1/twig.1"
+ install -d "$(DEB_ROOT)/DEBIAN"
+ printf '%s\n' \
+ "Package: $(PACKAGE)" \
+ "Version: $(VERSION)" \
+ "Section: editors" \
+ "Priority: optional" \
+ "Architecture: $(DEB_ARCH)" \
+ "Maintainer: Harrison Erd <[email protected]>" \
+ "Depends: python3, python3-gi, gir1.2-gtk-3.0, gir1.2-gtksource-4 | gir1.2-gtksource-3.0" \
+ "Description: Lightweight GTK code editor" \
+ " Twig is a small GTK code editor for lightweight Linux desktops." \
+ " It supports one file per window, syntax highlighting, line numbers," \
+ " find and replace, undo and redo, and save-before-close prompts." \
+ > "$(DEB_ROOT)/DEBIAN/control"
+ install -d dist
+ dpkg-deb --build --root-owner-group "$(DEB_ROOT)" "$(DEB_FILE)"
+
+clean-deb:
+ rm -rf "$(DEB_BUILD_DIR)" dist/*.deb
diff --git a/README.md b/README.md
index 476104f..11c343d 100644
--- a/README.md
+++ b/README.md
@@ -45,6 +45,12 @@ Uninstall:
sudo make uninstall
```
+Build a Debian package:
+
+```sh
+make deb
+```
+
## Shortcuts
Twig intentionally has no toolbar or menu bar. Use these keyboard shortcuts:
diff --git a/dist/twig_0.1.0_all.deb b/dist/twig_0.1.0_all.deb
new file mode 100644
index 0000000..8fe1d3e
Binary files /dev/null and b/dist/twig_0.1.0_all.deb differ
diff --git a/docs/index.html b/docs/index.html
index f787234..f6ce530 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -39,14 +39,8 @@
<img src="https://gitman.io/patx/twig/raw/docs/logo.png" alt="Twig logo">
<h1>Twig</h1>
</div>
-<p>An ultra-minimal GTK code editor for Debian/Ubuntu based Linux distros.</p>
-<p>One file per window. No toolbar. No menu bar. <a href="https://gitman.io/patx/twig/raw/docs/screenshot.png" target="_blank">View screenshot</a>.</p>
-
-<h2>Install</h2>
-<pre>sudo apt install python3-gi gir1.2-gtk-3.0 gir1.2-gtksource-4
-git clone https://gitman.io/git/patx/twig
-cd twig
-sudo make install</pre>
+<p>An ultra-minimal GTK code editor for Debian/Ubuntu based Linux distros. No toolbar or menu bar, just code. <a href="https://gitman.io/patx/twig/raw/docs/screenshot.png" target="_blank">View screenshot</a>.</p>
+<p>Download the <a href="https://gitman.io/patx/twig/raw/dist/twig_0.1.0_all.deb" target="_blank">.deb</a>. You can also install Twig from <a href="https://gitman.io/patx/twig" target="_blank">source</a>.</p>
<h2>Features</h2>
<ul>
diff --git a/docs/twig.1 b/docs/twig.1
new file mode 100644
index 0000000..6f16875
--- /dev/null
+++ b/docs/twig.1
@@ -0,0 +1,29 @@
+.TH TWIG 1 "June 2026" "Twig 0.1.0" "User Commands"
+.SH NAME
+twig \- lightweight GTK code editor
+.SH SYNOPSIS
+.B twig
+.RI [ FILE ...]
+.SH DESCRIPTION
+.B Twig
+is a small GTK code editor for lightweight Linux desktops. It opens each file
+in a separate window and supports syntax highlighting, line numbers, find and
+replace, undo and redo, and save-before-close prompts.
+.SH KEYBOARD SHORTCUTS
+.TP
+.B Ctrl+O
+Open one or more files.
+.TP
+.B Ctrl+S
+Save the current file.
+.TP
+.B Ctrl+Shift+S
+Save the current file as a new path.
+.TP
+.B Ctrl+F
+Open or focus find and replace.
+.TP
+.B Ctrl+Q
+Quit Twig, prompting for unsaved files.
+.SH AUTHOR
+Written by harrison erd.