Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with Python 3.12 #4

Merged
merged 3 commits into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions oterm/store/store.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import json
import sys
from distutils.version import StrictVersion
from importlib import metadata
from pathlib import Path

import aiosqlite

from oterm.app.chat import Author
from oterm.store.chat import queries as chat_queries
from oterm.store.setup import queries as setup_queries
from oterm.store.upgrades import upgrades
from packaging.version import parse


def semantic_version_to_int(version: str) -> int:
Expand Down Expand Up @@ -87,9 +86,9 @@ async def create(cls) -> "Store":
current_version: str = metadata.version("oterm")
db_version = await self.get_user_version()
for version, steps in upgrades:
if StrictVersion(current_version) >= StrictVersion(
version
) and StrictVersion(version) > StrictVersion(db_version):
if parse(current_version) >= parse(version) and parse(version) > parse(
db_version
):
for step in steps:
await step(self.db_path)
await self.set_user_version(current_version)
Expand Down
Loading