Removed duplicate Werkzeug entry in about page
Code cosmetics
This commit is contained in:
parent
3233b357f8
commit
cde51e743a
66
cps/about.py
66
cps/about.py
@ -25,7 +25,6 @@ import platform
|
|||||||
import sqlite3
|
import sqlite3
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
import werkzeug
|
|
||||||
import flask
|
import flask
|
||||||
import flask_login
|
import flask_login
|
||||||
import jinja2
|
import jinja2
|
||||||
@ -37,41 +36,40 @@ from .render_template import render_title_template
|
|||||||
|
|
||||||
about = flask.Blueprint('about', __name__)
|
about = flask.Blueprint('about', __name__)
|
||||||
|
|
||||||
ret = dict()
|
modules = dict()
|
||||||
req = dep_check.load_dependencys(False)
|
req = dep_check.load_dependencies(False)
|
||||||
opt = dep_check.load_dependencys(True)
|
opt = dep_check.load_dependencies(True)
|
||||||
for i in (req + opt):
|
for i in (req + opt):
|
||||||
ret[i[1]] = i[0]
|
modules[i[1]] = i[0]
|
||||||
|
modules['Jinja2'] = jinja2.__version__
|
||||||
if constants.NIGHTLY_VERSION[0] == "$Format:%H$":
|
modules['pySqlite'] = sqlite3.version
|
||||||
calibre_web_version = constants.STABLE_VERSION['version']
|
modules['SQLite'] = sqlite3.sqlite_version
|
||||||
else:
|
sorted_modules = OrderedDict((sorted(modules.items(), key=lambda x: x[0].casefold())))
|
||||||
calibre_web_version = (constants.STABLE_VERSION['version'] + ' - '
|
|
||||||
+ constants.NIGHTLY_VERSION[0].replace('%', '%%') + ' - '
|
|
||||||
+ constants.NIGHTLY_VERSION[1].replace('%', '%%'))
|
|
||||||
|
|
||||||
if getattr(sys, 'frozen', False):
|
|
||||||
calibre_web_version += " - Exe-Version"
|
|
||||||
elif constants.HOME_CONFIG:
|
|
||||||
calibre_web_version += " - pyPi"
|
|
||||||
|
|
||||||
_VERSIONS = OrderedDict(
|
|
||||||
Platform='{0[0]} {0[2]} {0[3]} {0[4]} {0[5]}'.format(platform.uname()),
|
|
||||||
Python=sys.version,
|
|
||||||
Calibre_Web=calibre_web_version,
|
|
||||||
Werkzeug=werkzeug.__version__,
|
|
||||||
Jinja2=jinja2.__version__,
|
|
||||||
pySqlite=sqlite3.version,
|
|
||||||
SQLite=sqlite3.sqlite_version,
|
|
||||||
)
|
|
||||||
_VERSIONS.update(ret)
|
|
||||||
_VERSIONS.update(uploader.get_versions())
|
|
||||||
|
|
||||||
|
|
||||||
def collect_stats():
|
def collect_stats():
|
||||||
_VERSIONS['ebook converter'] = converter.get_calibre_version()
|
if constants.NIGHTLY_VERSION[0] == "$Format:%H$":
|
||||||
_VERSIONS['unrar'] = converter.get_unrar_version()
|
calibre_web_version = constants.STABLE_VERSION['version']
|
||||||
_VERSIONS['kepubify'] = converter.get_kepubify_version()
|
else:
|
||||||
|
calibre_web_version = (constants.STABLE_VERSION['version'] + ' - '
|
||||||
|
+ constants.NIGHTLY_VERSION[0].replace('%', '%%') + ' - '
|
||||||
|
+ constants.NIGHTLY_VERSION[1].replace('%', '%%'))
|
||||||
|
|
||||||
|
if getattr(sys, 'frozen', False):
|
||||||
|
calibre_web_version += " - Exe-Version"
|
||||||
|
elif constants.HOME_CONFIG:
|
||||||
|
calibre_web_version += " - pyPi"
|
||||||
|
|
||||||
|
_VERSIONS = {'Calibre Web': calibre_web_version}
|
||||||
|
_VERSIONS.update(OrderedDict(
|
||||||
|
Python=sys.version,
|
||||||
|
Platform='{0[0]} {0[2]} {0[3]} {0[4]} {0[5]}'.format(platform.uname()),
|
||||||
|
))
|
||||||
|
_VERSIONS.update(uploader.get_magick_version())
|
||||||
|
_VERSIONS['Unrar'] = converter.get_unrar_version()
|
||||||
|
_VERSIONS['Ebook converter'] = converter.get_calibre_version()
|
||||||
|
_VERSIONS['Kepubify'] = converter.get_kepubify_version()
|
||||||
|
_VERSIONS.update(sorted_modules)
|
||||||
return _VERSIONS
|
return _VERSIONS
|
||||||
|
|
||||||
|
|
||||||
@ -80,7 +78,7 @@ def collect_stats():
|
|||||||
def stats():
|
def stats():
|
||||||
counter = calibre_db.session.query(db.Books).count()
|
counter = calibre_db.session.query(db.Books).count()
|
||||||
authors = calibre_db.session.query(db.Authors).count()
|
authors = calibre_db.session.query(db.Authors).count()
|
||||||
categorys = calibre_db.session.query(db.Tags).count()
|
categories = calibre_db.session.query(db.Tags).count()
|
||||||
series = calibre_db.session.query(db.Series).count()
|
series = calibre_db.session.query(db.Series).count()
|
||||||
return render_title_template('stats.html', bookcounter=counter, authorcounter=authors, versions=collect_stats(),
|
return render_title_template('stats.html', bookcounter=counter, authorcounter=authors, versions=collect_stats(),
|
||||||
categorycounter=categorys, seriecounter=series, title=_(u"Statistics"), page="stat")
|
categorycounter=categories, seriecounter=series, title=_(u"Statistics"), page="stat")
|
||||||
|
@ -20,7 +20,8 @@ if not importlib:
|
|||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
pkgresources = False
|
pkgresources = False
|
||||||
|
|
||||||
def load_dependencys(optional=False):
|
|
||||||
|
def load_dependencies(optional=False):
|
||||||
deps = list()
|
deps = list()
|
||||||
if getattr(sys, 'frozen', False):
|
if getattr(sys, 'frozen', False):
|
||||||
pip_installed = os.path.join(BASE_DIR, ".pip_installed")
|
pip_installed = os.path.join(BASE_DIR, ".pip_installed")
|
||||||
@ -57,7 +58,7 @@ def load_dependencys(optional=False):
|
|||||||
|
|
||||||
def dependency_check(optional=False):
|
def dependency_check(optional=False):
|
||||||
d = list()
|
d = list()
|
||||||
deps = load_dependencys(optional)
|
deps = load_dependencies(optional)
|
||||||
for dep in deps:
|
for dep in deps:
|
||||||
try:
|
try:
|
||||||
dep_version_int = [int(x) for x in dep[0].split('.')]
|
dep_version_int = [int(x) for x in dep[0].split('.')]
|
||||||
@ -67,28 +68,28 @@ def dependency_check(optional=False):
|
|||||||
high_check = None
|
high_check = None
|
||||||
except ValueError:
|
except ValueError:
|
||||||
d.append({'name': dep[1],
|
d.append({'name': dep[1],
|
||||||
'target': "available",
|
'target': "available",
|
||||||
'found': "Not available"
|
'found': "Not available"
|
||||||
})
|
})
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if dep[2].strip() == "==":
|
if dep[2].strip() == "==":
|
||||||
if dep_version_int != low_check:
|
if dep_version_int != low_check:
|
||||||
d.append({'name': dep[1],
|
d.append({'name': dep[1],
|
||||||
'found': dep[0],
|
'found': dep[0],
|
||||||
"target": dep[2] + dep[3]})
|
"target": dep[2] + dep[3]})
|
||||||
continue
|
continue
|
||||||
elif dep[2].strip() == ">=":
|
elif dep[2].strip() == ">=":
|
||||||
if dep_version_int < low_check:
|
if dep_version_int < low_check:
|
||||||
d.append({'name': dep[1],
|
d.append({'name': dep[1],
|
||||||
'found': dep[0],
|
'found': dep[0],
|
||||||
"target": dep[2] + dep[3]})
|
"target": dep[2] + dep[3]})
|
||||||
continue
|
continue
|
||||||
elif dep[2].strip() == ">":
|
elif dep[2].strip() == ">":
|
||||||
if dep_version_int <= low_check:
|
if dep_version_int <= low_check:
|
||||||
d.append({'name': dep[1],
|
d.append({'name': dep[1],
|
||||||
'found': dep[0],
|
'found': dep[0],
|
||||||
"target": dep[2] + dep[3]})
|
"target": dep[2] + dep[3]})
|
||||||
continue
|
continue
|
||||||
if dep[4] and dep[5]:
|
if dep[4] and dep[5]:
|
||||||
if dep[4].strip() == "<":
|
if dep[4].strip() == "<":
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
<table id="libs" class="table">
|
<table id="libs" class="table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{{_('Program Library')}}</th>
|
<th>{{_('Program')}}</th>
|
||||||
<th>{{_('Installed Version')}}</th>
|
<th>{{_('Installed Version')}}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
@ -231,7 +231,7 @@ def pdf_preview(tmp_file_path, tmp_dir):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def get_versions():
|
def get_magick_version():
|
||||||
ret = dict()
|
ret = dict()
|
||||||
if not use_generic_pdf_cover:
|
if not use_generic_pdf_cover:
|
||||||
ret['Image Magick'] = ImageVersion.MAGICK_VERSION
|
ret['Image Magick'] = ImageVersion.MAGICK_VERSION
|
||||||
|
Loading…
Reference in New Issue
Block a user