buskill-app icon indicating copy to clipboard operation
buskill-app copied to clipboard

Segregate BusKill Package Module into multiple scripts

Open maltfield opened this issue 3 years ago • 5 comments

At the time of writing (2022-10-01), The buskill-app/src/packages/buskill/__init__.py file is 1,656 lines long. And growing.

This task is to track the effort to split this file up into multiple distinct files.

maltfield avatar Oct 02 '22 04:10 maltfield

Functions for the following purposes could be boxed-up together into individual files:

  1. Upgrading the app
  2. Triggers (possibly one for each platform)

maltfield avatar Oct 02 '22 04:10 maltfield

See also https://www.qtrac.eu/pyclassmulti.html

maltfield avatar Oct 15 '22 19:10 maltfield

Well, I tried to separate-out the update() function into its own file, but the resulting build had the following results:

  1. Linux Updates worked
  2. Windows Updates worked
  3. MacOS updates failed with error Error invoking gpg: 2: gpg: Fatal: libgcryptis too old (need 1.9.1, have 1.8.6)

I don't know if I caused that or not with this change, but I'm going to revert for now.

maltfield avatar Oct 15 '22 21:10 maltfield

Well, we lost all our fucking history of that work because git is stupid. Not sure why "revert everything back to X commit" is so damn hard.

Apparently if you say git revert <commit> then it doesn't do what you want. It tries to be too smart and tries to revert just that one commit. If you say git revert <commit>..HEAD then it should do what you want (revert everything to that specific commit), but it didn't actually work. The _buskill_update.py script was still present, and the __init__.py script's contents wasn't reverted!

After fighting with git for 10 minutes, I finally just did a git reset --hard, which deleted all the history. Fail.

maltfield avatar Oct 15 '22 21:10 maltfield

Rather than splitting things like 'triggers' into their own file, I think it would make more sense to split it by platform. So all the linux-specific triggers would go into '_buskill_lin.pyand all of the mac-specific triggers would go into a_buskill_mac.py` file.

I like this better because you could load less code at runtime as-needed. And because an developer probably wants to focus on one platform at at time. But if they want to view, for example, all of the "lockscreen" functions for each platform side-by-side, that's easier when it's in three distinct files. I'm writing this as I'm trying to edit the shutdown trigger on two platforms, and it's a pain to scroll up-and-down between the linux and MacOS implementations

The only problem with this idea is the *nix functions that are used for both Linux and MacOS :/

maltfield avatar Oct 16 '22 22:10 maltfield