mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-07 01:15:33 +00:00
We can't initialize Sentry during module initialization because our `initialize_sentry` logs some status info. Setting the logging level later on is then a no-op, breaking verbose and very-verbose logging. This change fixes this by putting Sentry initialization into a separate method that gets called after we set the log level. Also refactor some common code into methods that appear in all our executables.
26 lines
690 B
Python
Executable file
26 lines
690 B
Python
Executable file
#!/usr/bin/python3
|
|
|
|
import argparse
|
|
import os
|
|
|
|
from keyman_config import add_standard_arguments, initialize_logging, initialize_sentry
|
|
from keyman_config.get_kmp import get_kmp, keyman_cache_dir
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(description='Download Keyman keyboard package to ~/.cache/keyman')
|
|
parser.add_argument('id', help='Keyman keyboard id')
|
|
add_standard_arguments(parser)
|
|
|
|
args = parser.parse_args()
|
|
|
|
initialize_logging(args)
|
|
initialize_sentry()
|
|
|
|
get_kmp(args.id)
|
|
if os.path.exists(os.path.join(keyman_cache_dir(), 'kmpdirlist')):
|
|
os.remove(os.path.join(keyman_cache_dir(), 'kmpdirlist'))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|