~sqwishy/froghat.ca

site generator for https://froghat.ca
forgot to make feeds work again
2020 review
renames "debg" log level, it just looked stupid

refs

master
browse  log 

clone

read-only
https://git.sr.ht/~sqwishy/froghat.ca
read/write
git@git.sr.ht:~sqwishy/froghat.ca

You can also use your local clone with git send-email.

readme

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 blag/ or pages/. fucko is a Python program that compiles the documents into a static website.

fucko is a piece of shit. I wrote it because I didn’t like Pelican, which is also a piece of shit. 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.

1

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.

usage

(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: fucko build

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

fucko-fwd

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 www.toml file.

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 stdin, stdout, stderr handles to the Python program, fucko, over the socket.

  • fucko temporarily uses the file descriptors it received in the message in place of its own stdin, stdout, and 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 fucking convoluted thing to do.

todo

  • The dates are weird, I should be entering them with a time zone.

  • The URL formats are weird, with the dates in them. I’m not sure I like that.

  • Changing command line options like fwd and fork trigger 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-C terminates fucko-fwd but not the host at the other end of the socket. So they’ll remain at that breakpoint.

  • There’s also anothing thing. But I forgot what it was.