mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-21 05:28:31 +02:00
fix twice version validation
This commit is contained in:
parent
4df9b2b375
commit
29e67bbcef
3 changed files with 3 additions and 11 deletions
|
@ -100,7 +100,7 @@ def load_or_install_jrnl():
|
||||||
from . import upgrade
|
from . import upgrade
|
||||||
|
|
||||||
try:
|
try:
|
||||||
upgrade.upgrade_jrnl_if_necessary(config_path)
|
upgrade.upgrade_jrnl(config_path)
|
||||||
except upgrade.UpgradeValidationException:
|
except upgrade.UpgradeValidationException:
|
||||||
print("Aborting upgrade.", file=sys.stderr)
|
print("Aborting upgrade.", file=sys.stderr)
|
||||||
print(
|
print(
|
||||||
|
|
|
@ -34,12 +34,7 @@ def check_exists(path):
|
||||||
return os.path.exists(path)
|
return os.path.exists(path)
|
||||||
|
|
||||||
|
|
||||||
def upgrade_jrnl_if_necessary(config_path):
|
def upgrade_jrnl(config_path):
|
||||||
with open(config_path, "r", encoding="utf-8") as f:
|
|
||||||
config_file = f.read()
|
|
||||||
if not config_file.strip().startswith("{"):
|
|
||||||
return
|
|
||||||
|
|
||||||
config = util.load_config(config_path)
|
config = util.load_config(config_path)
|
||||||
|
|
||||||
print(
|
print(
|
||||||
|
|
|
@ -126,10 +126,7 @@ def load_config(config_path):
|
||||||
def is_config_json(config_path):
|
def is_config_json(config_path):
|
||||||
with open(config_path, "r", encoding="utf-8") as f:
|
with open(config_path, "r", encoding="utf-8") as f:
|
||||||
config_file = f.read()
|
config_file = f.read()
|
||||||
if not config_file.strip().startswith("{"):
|
return config_file.strip().startswith("{"):
|
||||||
return False
|
|
||||||
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
def is_old_version(config_path):
|
def is_old_version(config_path):
|
||||||
|
|
Loading…
Add table
Reference in a new issue