indico: wip: main pkg is almost working

Signed-off-by: Jeltz <jeltz@federez.net>
This commit is contained in:
jeltz 2025-02-22 10:58:56 +01:00
parent abbafb082d
commit 0a8ae58334
Signed by: jeltz
GPG key ID: 800882B66C0C3326
2 changed files with 97 additions and 10 deletions

View file

@ -3,6 +3,17 @@
fetchFromGitHub, fetchFromGitHub,
fetchPypi, fetchPypi,
python3, python3,
nodejs,
callPackage,
fetchNpmDeps,
npmHooks,
stdenv,
substituteAll,
prefetch-npm-deps,
pkg-config,
pixman,
cairo,
pango,
}: }:
let let
@ -34,8 +45,12 @@ let
sqlalchemy = super.sqlalchemy_1_4; sqlalchemy = super.sqlalchemy_1_4;
wtforms-dateutil = self.callPackage ../wtforms-dateutil { }; wtforms-dateutil = self.callPackage ../wtforms-dateutil { };
wtforms-sqlalchemy = self.callPackage ../wtforms-sqlalchemy { }; wtforms-sqlalchemy = self.callPackage ../wtforms-sqlalchemy { };
flask-url-map-serializer = self.callPackage ../flask-url-map-serializer { };
}; };
}; };
# TODO PR
qTipUpstreamUrl = "git+https://indico@github.com/indico/qTip2.git#8951e5538a5c0833021b2d2b5d8a587a2c24faae";
qTipLocalUrl = "git+https://github.com/federez-tba/qTip2.git#8d1d579c0aac94333e390f19aa0489c57bf74cf7";
in in
python.pkgs.buildPythonApplication rec { python.pkgs.buildPythonApplication rec {
pname = "indico"; pname = "indico";
@ -51,25 +66,83 @@ python.pkgs.buildPythonApplication rec {
hash = "sha256-OX5tqeIjd7Lb5XfvFFKcYb9Dbf5Z9QLXlVTepTpeOMU="; hash = "sha256-OX5tqeIjd7Lb5XfvFFKcYb9Dbf5Z9QLXlVTepTpeOMU=";
}; };
build-system = with python.pkgs; [ INDICO_NO_GIT = "true";
hatchling INDICO_MAP_VERSION = src.outputHash;
hatch-requirements-txt
# TODO bin/maintenance/build-{wheel,assets}.py
build-system = [
python.pkgs.hatchling
python.pkgs.hatch-requirements-txt
python.pkgs.babel
python.pkgs.flask-url-map-serializer
nodejs
npmHooks.npmConfigHook
# Used by the npm dependency "canvas"
pkg-config
]; ];
buildInputs = [
# Used by the npm dependency "canvas"
pixman
cairo
pango
];
npmDeps = fetchNpmDeps {
inherit src patches postPatch;
pname = "${pname}-${version}-npm-deps";
hash = "sha256-OeeA2NyRnhlQuSryTmqsLcNNkXde0Vnk21pHddV3aco=";
};
# FIXME *why* is it required?
makeCacheWritable = true;
npmFlags = [ "--verbose" ];
patches = [ patches = [
./remove_marshmallow_enum.patch ./remove_marshmallow_enum.patch
./force_map_version.patch
]; ];
postPatch = '' postPatch = ''
# Seems fixed (the dependency is gone in master)
substituteInPlace requirements.in \
--replace-fail "hiredis<3" ""
# See JoshData/python-email-validator#90 # See JoshData/python-email-validator#90
substituteInPlace requirements.in \ substituteInPlace requirements.in \
--replace "email-validator<1.3.0" "email-validator!=1.3.0" --replace-fail "email-validator<1.3.0" "email-validator!=1.3.0"
# Botocore doesn't seem to be used anymore # Botocore doesn't seem to be used anymore
substituteInPlace requirements.in --replace "urllib3<2" "urllib3" substituteInPlace requirements.in \
--replace-fail "urllib3<2" "urllib3"
# Seems fixed # Seems fixed
substituteInPlace requirements.in --replace "pydyf<0.10" "pydyf" substituteInPlace requirements.in \
--replace-fail "pydyf<0.10" "pydyf"
# Remove transitive dependencies and unnecessary version pins # Remove transitive dependencies and unnecessary version pins
cp requirements.in requirements.txt cp requirements.in requirements.txt
cp requirements.dev.in requirements.dev.txt
# Nix's pyproject format builds a wheel, but the custom hook
# is configured only for sdists (TODO figure out why)
substituteInPlace pyproject.toml \
--replace-fail "tool.hatch.build.targets.sdist.hooks.custom" \
"tool.hatch.build.hooks.custom" \
--replace-fail "babel==2.16.0" "babel" \
--replace-fail "hatchling==1.25.0" "hatchling"
substituteInPlace package.json \
--replace-fail ${qTipUpstreamUrl} ${qTipLocalUrl}
substituteInPlace package-lock.json \
--replace-fail ${qTipUpstreamUrl} ${qTipLocalUrl}
# Make the WSGI module importable by Gunicorn
# (TODO is there a way to use Gunicorn with a path?)
mv indico/web/indico.wsgi indico/web/wsgi.py
# TODO TODO ./bin/maintenance/build-assets.py
'';
# TODO build-assets.py
# build_urls_map.py tries to import indico.web.flask.app
# which has not been installed yet at this stage
preBuild = ''
ls -lah
PYTHONPATH="$(pwd):$PYTHONPATH" ${lib.getExe python} bin/maintenance/build-assets.py indico --clean
''; '';
dependencies = dependencies =
@ -102,7 +175,6 @@ python.pkgs.buildPythonApplication rec {
flask-wtf flask-wtf
flask flask
google-auth google-auth
hiredis
html2text html2text
icalendar icalendar
indico-fonts indico-fonts
@ -161,9 +233,9 @@ python.pkgs.buildPythonApplication rec {
++ sentry-sdk_1.optional-dependencies.pure_eval ++ sentry-sdk_1.optional-dependencies.pure_eval
++ wtforms.optional-dependencies.email; ++ wtforms.optional-dependencies.email;
passthru = { # passthru = {
inherit python; # inherit python;
}; # };
meta = { meta = {
description = "Full-featured conferency lifecycle management and meeting/lecture scheduling tool"; description = "Full-featured conferency lifecycle management and meeting/lecture scheduling tool";

View file

@ -0,0 +1,15 @@
diff --git a/bin/maintenance/dump_url_map.py b/bin/maintenance/dump_url_map.py
index 050b671c46..cf56a20f72 100644
--- a/bin/maintenance/dump_url_map.py
+++ b/bin/maintenance/dump_url_map.py
@@ -19,7 +19,9 @@ def get_map_version():
# whenever something changed
h = hashlib.md5()
h.update(os.getcwd().encode())
- if not os.environ.get('INDICO_NO_GIT'):
+ if (version := os.environ.get("INDICO_MAP_VERSION")):
+ h.update(version.encode())
+ elif not os.environ.get('INDICO_NO_GIT'):
h.update(subprocess.check_output(['git', 'describe', '--always']))
h.update(subprocess.check_output(['git', 'status']))
h.update(subprocess.check_output(['git', 'diff']))