This is my website, https://froghat.ca. This file is the readme for the website generator; also available online in a git repo at https://git.sr.ht/~sqwishy/froghat.ca.
Documents are in reStructuredText, most are in
fucko is the site generator, a Python program that compiles the documents into a static website.
The site generator software (not the articles) is public domain under CC0 1.0 Universal (CC0 1.0).
The articles (not the site generator software) are copyleft under Attribution-ShareAlike 4.0 International (CC BY-SA 4.0).
fucko is trash. I wrote it because I didn’t like Pelican (also trash). As it turns out, I don’t like Jinja either. My website uses Mako for templates. And ninja to generally get things done in the right order.
My website has fewer features than Pelican. That’s kinda the point. It’s not supposed to be a one-size-fits-all kinda thing. It’s just supposed to be fun to edit and extend for your own ambitions. ﾟ･✿ヾ╲(｡◕‿◕｡)╱✿･ﾟ So you can copy1 it and change it to be its own thing without feeling obligated to merge to any kind of uPsTrEaM and spend your life arguing with a maintainer.
Unless you’re Nick. Because Nick is too cool for Fedora and uses macOS now and I don’t know if fucko works on macOS.
(Optional) Create & use a virtual env (using the fish shell in this example) …
python -m venv .venv . .venv/bin/activate.fish
Install the Python package (from the directory containing setup.py) with:
python -m pip install -e .
Once installed, you can run it with:
Read/edit the configuration at
www.toml for things like the output directory.
You can use pass
-c on the command line to override options from the file:
fucko -c site.url=https://froghat.ca -c paths.out=/tmp/froghat.ca build
Because the site generator was designed to use ninja, and how ninja works, new processes are created for individual build steps like reading each reStructuredText document or for rendering each HTML file.
A lot of time is spent starting the Python interpreter and importing modules.
Instead of that,
build will, by default, use a smol C program named
fucko-fwd to send build steps over a unix socket to Python.
That program is compiled as a build step automatically, but you need a C
compiler. It’ll try to use clang, but you can change it or disable this
feature in the
[build] section of the
Information about how this works follows.
how we forward fuckos
fucko-fwd is very simple.
fucko, the Python program, opens a TCP unix socket and starts ninja.
ninja runs fucko-fwd $args instead of python -m fucko $args for each build step.
fucko-fwd sends its command line arguments and its
stderrhandles to the Python program, fucko, over the socket.
fucko temporarily uses the file descriptors it received in the message in place of its own
stderr. It also parses the arguments and runs whatever they imply like a normal program would.
When it’s done doing whatever thing, fucko sends the status code back to fucko-fwd over the connection and closes it.
fucko-fwd gets the status code and exits with it so that ninja sees the status code.
Wow, what a fucking convoluted thing to do.
Changing command line options like
forktrigger a rebuild even though the outputs shouldn’t change.
A caveat of fucko-fwd is that signals are not received by the job host. So if a job doesn’t complete because it hits a breakpoint or something, hitting
CTRL-Cterminates fucko-fwd but not the host at the other end of the socket. So they’ll remain at that breakpoint.
mako caches templates so updates to them on the filesystem are ignored in