mirror of
https://github.com/yusufipk/dikte.git
synced 2026-09-11 19:06:11 +00:00
Twenty-two files at the top of the tree was the first thing anybody saw of this repository. They are one package now, imported relatively, and the three scripts that are not the front door moved under scripts/. install.sh stays where the README has always said it is. What starts the application is dikte/__main__.py: python3 -m dikte runs it, and so does naming the file, which is what the launcher symlink, both .desktop files, the macOS bundle and every registered shortcut do. Run by path there is no package around it, so it puts the checkout on sys.path itself. The installers now keep the keys you chose when they are given none, which is what an update is: update.sh no longer has to read them out and pass them back. An updater from before this commit cannot read them at all, so the one thing it can say, the default key with an empty discard key, is read as "nothing was asked for" rather than obeyed. That guard can go once nobody is updating across this commit.
26 lines
1010 B
Python
Executable File
26 lines
1010 B
Python
Executable File
#!/usr/bin/env python3
|
|
"""What `python3 -m dikte` and the installed `dikte` command both run.
|
|
|
|
The file is also executed by path, because that is what a desktop shortcut and
|
|
the launcher in ~/.local/bin do: neither knows a working directory to be in.
|
|
Run that way there is no package around it, so the checkout has to be put on
|
|
the import path here, before the first line of the application is imported.
|
|
"""
|
|
|
|
import os
|
|
import sys
|
|
|
|
if not __package__:
|
|
# realpath, because the launcher is a symlink into the checkout: what has to
|
|
# end up on the path is the checkout, not ~/.local/bin. The directory this
|
|
# file is in comes off the path in exchange, so that a module beside it is
|
|
# only ever reachable as part of the package.
|
|
here = os.path.dirname(os.path.realpath(__file__))
|
|
sys.path[:] = [p for p in sys.path if os.path.realpath(p or ".") != here]
|
|
sys.path.insert(0, os.path.dirname(here))
|
|
|
|
from dikte.app import main # noqa: E402
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|