push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
diff --git a/cps/__init__.py b/cps/__init__.py
index 1ba1f778..fd5dc2f1 100644
--- a/cps/__init__.py
+++ b/cps/__init__.py
@@ -116,6 +116,9 @@ def create_app():
db.CalibreDB.setup_db(config.config_calibre_dir, cli_param.settings_path)
calibre_db.init_db()
+ if os.environ.get('__RUN_MIGRATIONS_AND_EXIT'):
+ sys.exit(0)
+
updater_thread.init_updater(config, web_server)
# Perform dry run of updater and exit afterwards
if cli_param.dry_run:

View File

@@ -0,0 +1,17 @@
diff --git a/cps/logger.py b/cps/logger.py
index b204de31..3206e2bf 100644
--- a/cps/logger.py
+++ b/cps/logger.py
@@ -32,10 +32,10 @@ ACCESS_FORMATTER_TORNADO = Formatter("[%(asctime)s] %(message)s")
FORMATTER = Formatter("[%(asctime)s] %(levelname)5s {%(name)s:%(lineno)d} %(message)s")
DEFAULT_LOG_LEVEL = logging.INFO
-DEFAULT_LOG_FILE = os.path.join(_CONFIG_DIR, "calibre-web.log")
-DEFAULT_ACCESS_LOG = os.path.join(_CONFIG_DIR, "access.log")
LOG_TO_STDERR = '/dev/stderr'
LOG_TO_STDOUT = '/dev/stdout'
+DEFAULT_LOG_FILE = LOG_TO_STDOUT
+DEFAULT_ACCESS_LOG = LOG_TO_STDOUT
logging.addLevelName(logging.WARNING, "WARN")
logging.addLevelName(logging.CRITICAL, "CRIT")

View File

@@ -0,0 +1,157 @@
{
lib,
stdenv,
fetchFromGitHub,
nix-update-script,
nixosTests,
python3Packages,
}:
python3Packages.buildPythonApplication rec {
pname = "calibre-web";
version = "0.6.25";
pyproject = true;
src = fetchFromGitHub {
owner = "janeczku";
repo = "calibre-web";
tag = version;
hash = "sha256-tmSp6ABQ4KnNdUHYZPnXGfhhyhM6aczEUPd57APZnLA=";
};
patches = [
# default-logger.patch switches default logger to /dev/stdout. Otherwise calibre-web tries to open a file relative
# to its location, which can't be done as the store is read-only. Log file location can later be configured using UI
# if needed.
./default-logger.patch
# DB migrations adds an env var __RUN_MIGRATIONS_ANDEXIT that, when set, instructs calibre-web to run DB migrations
# and exit. This is gonna be used to configure calibre-web declaratively, as most of its configuration parameters
# are stored in the DB.
./db-migrations.patch
];
# calibre-web doesn't follow setuptools directory structure.
postPatch = ''
mkdir -p src/calibreweb
mv cps.py src/calibreweb/__init__.py
mv cps src/calibreweb
substituteInPlace pyproject.toml \
--replace-fail 'cps = "calibreweb:main"' 'calibre-web = "calibreweb:main"'
'';
build-system = [ python3Packages.setuptools ];
dependencies = with python3Packages; [
apscheduler
babel
bleach
chardet
cryptography
flask
flask-babel
flask-httpauth
flask-limiter
flask-principal
flask-wtf
iso-639
lxml
netifaces-plus
pycountry
pypdf
python-magic
pytz
regex
requests
sqlalchemy
tornado
unidecode
urllib3
wand
];
optional-dependencies = {
comics = with python3Packages; [
comicapi
natsort
];
gdrive = with python3Packages; [
gevent
google-api-python-client
greenlet
httplib2
oauth2client
pyasn1-modules
# https://github.com/NixOS/nixpkgs/commit/bf28e24140352e2e8cb952097febff0e94ea6a1e
# pydrive2
pyyaml
rsa
uritemplate
];
gmail = with python3Packages; [
google-api-python-client
google-auth-oauthlib
];
# We don't support the goodreads feature, as the `goodreads` package is
# archived and depends on other long unmaintained packages (rauth & nose)
# goodreads = [ ];
kobo = with python3Packages; [ jsonschema ];
ldap = with python3Packages; [
flask-simpleldap
python-ldap
];
metadata = with python3Packages; [
faust-cchardet
html2text
markdown2
mutagen
py7zr
pycountry
python-dateutil
rarfile
scholarly
];
oauth = with python3Packages; [
flask-dance
sqlalchemy-utils
];
};
pythonRelaxDeps = [
"apscheduler"
"bleach"
"cryptography"
"flask"
"flask-limiter"
"lxml"
"pypdf"
"regex"
"tornado"
"unidecode"
];
nativeCheckInputs = lib.flatten (lib.attrValues optional-dependencies);
pythonImportsCheck = [ "calibreweb" ];
passthru = {
tests = lib.optionalAttrs stdenv.hostPlatform.isLinux { inherit (nixosTests) calibre-web; };
updateScript = nix-update-script { };
};
meta = {
description = "Web app for browsing, reading and downloading eBooks stored in a Calibre database";
homepage = "https://github.com/janeczku/calibre-web";
changelog = "https://github.com/janeczku/calibre-web/releases/tag/${src.tag}";
license = lib.licenses.gpl3Plus;
maintainers = with lib.maintainers; [ pborzenkov ];
mainProgram = "calibre-web";
platforms = lib.platforms.all;
};
}