* We're not going to refactor those 'complex' sections any time soon, so
clean up flake8 output for now.
* No-one still uses "send SIGTERM to see a stack trace".
* In `develop` config import will set up logging, so let's head that off
at the pass and put the redirect right at the top.
* Also moved the EDMCLogging import to right after the config import's
new position, to emulate `develop` behaviour.
* We *append* on the initial open of the redirect log file. Then once
we're sure we're the only process we truncate this.
The edmc://auth catch/forward code relies on the old "is there another
window with this handle already?" check, so need to reinstate that code
*after* the lock check in order to forward the message.
* The end of the win32/else conditional was identical, so only do that
write to the successfully locked file in one place.
* No need to go out of `__main__` only to go straight back in.
* It *should* only be a PermissionError, although the docs actually say
the 'higher' OSError. This way we will always catch whatever it is.
* The print uses {e!r} so as to make it explicit what the type of the
exception is.
* The variable is journal_dir_lockfile not lockfile.
* Typehint on journal_dir (likely not needed in `develop` as config.py
is cleaned up there).
* Tweak the per-platform prints
1. We need the args available at the top.
2. In `develop` we'd renamed `enforce_single_instance()` to
`no_other_instance_running()` so that it's obvious it's a function
returning a boolean, rather than the function that does the
enforcement.
1. So now they're only defined in one place.
2. config.py does an import of them, and `from config import ...` then
chains through, so no need to update other users.
3. No need to ' # noqa E402' the killswitch/config imports now.
Although the issue we've identified with GitHub builds isn't to do with
a python module version it's best to nail precise versions so we can be
sure it will build with the same as we've tested locally.
I specifically made set_shutdown() *not* take an argument and only ever
set this true so no-one else can monkey with it, so might as well mangle
it too.
1. The updater is in a thread/DLL and we don't want that firing part way
through shutdown, so it gets asked to stop first.
2. Then plugins, so they're out of the way and we won't have already
stopped something they might rely on.
3. Hotkey after that to head off the user triggering something via them.
4. Now stop the programmatic input from Journal files (including
Status.json).
5. Frontier auth handling.
6. And then anything else.
Python's name-mangling rules are quite complex. Previously, EDMC was
incorrectly mangling names where the class name starts with one or more
underscores; if the class name starts with any underscores, they should
be removed before prepending to the identifier being mangled. If the
class name contains *only* underscores, no mangling should be performed.