mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Show pysqlite3 version on /-/versions, if installed - #1125
This commit is contained in:
parent
4cce551666
commit
00185af74a
2 changed files with 15 additions and 2 deletions
|
|
@ -9,6 +9,7 @@ import inspect
|
||||||
from itsdangerous import BadSignature
|
from itsdangerous import BadSignature
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import pkg_resources
|
||||||
import re
|
import re
|
||||||
import secrets
|
import secrets
|
||||||
import sys
|
import sys
|
||||||
|
|
@ -57,7 +58,6 @@ from .utils import (
|
||||||
module_from_path,
|
module_from_path,
|
||||||
parse_metadata,
|
parse_metadata,
|
||||||
resolve_env_secrets,
|
resolve_env_secrets,
|
||||||
sqlite3,
|
|
||||||
to_css_class,
|
to_css_class,
|
||||||
HASH_LENGTH,
|
HASH_LENGTH,
|
||||||
)
|
)
|
||||||
|
|
@ -74,6 +74,10 @@ from .utils.asgi import (
|
||||||
asgi_send_json,
|
asgi_send_json,
|
||||||
asgi_send_redirect,
|
asgi_send_redirect,
|
||||||
)
|
)
|
||||||
|
from .utils.sqlite import (
|
||||||
|
sqlite3,
|
||||||
|
using_pysqlite3,
|
||||||
|
)
|
||||||
from .tracer import AsgiTracer
|
from .tracer import AsgiTracer
|
||||||
from .plugins import pm, DEFAULT_PLUGINS, get_plugins
|
from .plugins import pm, DEFAULT_PLUGINS, get_plugins
|
||||||
from .version import __version__
|
from .version import __version__
|
||||||
|
|
@ -619,7 +623,7 @@ class Datasette:
|
||||||
datasette_version = {"version": __version__}
|
datasette_version = {"version": __version__}
|
||||||
if self.version_note:
|
if self.version_note:
|
||||||
datasette_version["note"] = self.version_note
|
datasette_version["note"] = self.version_note
|
||||||
return {
|
info = {
|
||||||
"python": {
|
"python": {
|
||||||
"version": ".".join(map(str, sys.version_info[:3])),
|
"version": ".".join(map(str, sys.version_info[:3])),
|
||||||
"full": sys.version,
|
"full": sys.version,
|
||||||
|
|
@ -636,6 +640,12 @@ class Datasette:
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
if using_pysqlite3:
|
||||||
|
try:
|
||||||
|
info["pysqlite3"] = pkg_resources.get_distribution("pysqlite3").version
|
||||||
|
except pkg_resources.DistributionNotFound:
|
||||||
|
pass
|
||||||
|
return info
|
||||||
|
|
||||||
def _plugins(self, request=None, all=False):
|
def _plugins(self, request=None, all=False):
|
||||||
ps = list(get_plugins())
|
ps = list(get_plugins())
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
|
using_pysqlite3 = False
|
||||||
try:
|
try:
|
||||||
import pysqlite3 as sqlite3
|
import pysqlite3 as sqlite3
|
||||||
|
|
||||||
|
using_pysqlite3 = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import sqlite3
|
import sqlite3
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue