mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-07-03 07:16:12 +02:00
Speed up jrnl by 10%, improve slow imports (#959)
* Improve slow imports * Fix codestyle * fix twice version validation * Fix a syntax mistake
This commit is contained in:
parent
ef5f0a8331
commit
63df95f2ea
5 changed files with 47 additions and 32 deletions
|
@ -8,7 +8,7 @@ import sys
|
|||
import xdg.BaseDirectory
|
||||
import yaml
|
||||
|
||||
from . import __version__, upgrade, util
|
||||
from . import __version__, util
|
||||
from .util import UserAbort, verify_config
|
||||
|
||||
if "win32" not in sys.platform:
|
||||
|
@ -96,20 +96,23 @@ def load_or_install_jrnl():
|
|||
log.debug("Reading configuration from file %s", config_path)
|
||||
config = util.load_config(config_path)
|
||||
|
||||
try:
|
||||
upgrade.upgrade_jrnl_if_necessary(config_path)
|
||||
except upgrade.UpgradeValidationException:
|
||||
print("Aborting upgrade.", file=sys.stderr)
|
||||
print(
|
||||
"Please tell us about this problem at the following URL:",
|
||||
file=sys.stderr,
|
||||
)
|
||||
print(
|
||||
"https://github.com/jrnl-org/jrnl/issues/new?title=UpgradeValidationException",
|
||||
file=sys.stderr,
|
||||
)
|
||||
print("Exiting.", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
if util.is_old_version(config_path):
|
||||
from . import upgrade
|
||||
|
||||
try:
|
||||
upgrade.upgrade_jrnl(config_path)
|
||||
except upgrade.UpgradeValidationException:
|
||||
print("Aborting upgrade.", file=sys.stderr)
|
||||
print(
|
||||
"Please tell us about this problem at the following URL:",
|
||||
file=sys.stderr,
|
||||
)
|
||||
print(
|
||||
"https://github.com/jrnl-org/jrnl/issues/new?title=UpgradeValidationException",
|
||||
file=sys.stderr,
|
||||
)
|
||||
print("Exiting.", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
upgrade_config(config)
|
||||
verify_config(config)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue