odoo16, odoo17: unbreak, python310 -> python311

Signed-off-by: phanirithvij <phanirithvij2000@gmail.com>
This commit is contained in:
phanirithvij 2025-05-06 13:26:27 +05:30
parent 979daf34c8
commit a29b5d2357
3 changed files with 41 additions and 10 deletions

View File

@ -0,0 +1,22 @@
diff --git a/odoo/http.py b/odoo/http.py
index f26dd52db235c..9689fc894b2b1 100644
--- a/odoo/http.py
+++ b/odoo/http.py
@@ -117,6 +117,7 @@
import glob
import hashlib
import hmac
+import importlib.metadata
import inspect
import json
import logging
@@ -256,7 +257,7 @@ def get_default_session():
'alias', 'host', 'methods',
}
-if parse_version(werkzeug.__version__) >= parse_version('2.0.2'):
+if parse_version(importlib.metadata.version('werkzeug')) >= parse_version('2.0.2'):
# Werkzeug 2.0.2 adds the websocket option. If a websocket request
# (ws/wss) is trying to access an HTTP route, a WebsocketMismatch
# exception is raised. On the other hand, Werkzeug 0.16 does not

View File

@ -1,7 +1,7 @@
{
lib,
fetchzip,
python310,
python311,
rtlcss,
wkhtmltopdf,
nixosTests,
@ -9,8 +9,8 @@
let
odoo_version = "16.0";
odoo_release = "20241010";
python = python310.override {
odoo_release = "20250506";
python = python311.override {
self = python;
};
in
@ -24,9 +24,11 @@ python.pkgs.buildPythonApplication rec {
src = fetchzip {
url = "https://nightly.odoo.com/${odoo_version}/nightly/src/odoo_${version}.zip";
name = "odoo-${version}";
hash = "sha256-ICe5UOy+Ga81fE66SnIhRz3+JEEbGfoz7ag53mkG4UM="; # odoo
hash = "sha256-dBqRZ3cf4/udP9hm+u9zhuUCkH176uG2NPAy5sujyNc="; # odoo
};
patches = [ ./fix-test.patch ];
makeWrapperArgs = [
"--prefix"
"PATH"
@ -90,7 +92,7 @@ python.pkgs.buildPythonApplication rec {
passthru = {
updateScript = ./update.sh;
tests = {
inherit (nixosTests) odoo;
inherit (nixosTests) odoo16;
};
};

View File

@ -2,7 +2,8 @@
lib,
fetchgit,
fetchzip,
python310,
fetchpatch2,
python311,
rtlcss,
wkhtmltopdf,
nixosTests,
@ -10,8 +11,8 @@
let
odoo_version = "17.0";
odoo_release = "20241010";
python = python310.override {
odoo_release = "20250506";
python = python311.override {
self = python;
packageOverrides = final: prev: {
# requirements.txt fixes docutils at 0.17; the default 0.21.1 tested throws exceptions
@ -37,8 +38,14 @@ python.pkgs.buildPythonApplication rec {
src = fetchzip {
url = "https://nightly.odoo.com/${odoo_version}/nightly/src/odoo_${version}.zip";
name = "odoo-${version}";
hash = "sha256-s4Fvzjwl2oM0V9G1WQdSoqo7kE7b8tJdluk9f7A06e8="; # odoo
hash = "sha256-V15Oe3AOBJ1agt5WmpFZnC7EkyoKyxTH8Iqdf2/9aec="; # odoo
};
patches = [
(fetchpatch2 {
url = "https://github.com/odoo/odoo/commit/ade3200e8138a9c28eb9b294a4efd2753a8e5591.patch?full_index=1";
hash = "sha256-EFKjrR38eg9bxlNmRNoLSXem+MjQKqPcR3/mSgs0cDs=";
})
];
makeWrapperArgs = [
"--prefix"
@ -105,7 +112,7 @@ python.pkgs.buildPythonApplication rec {
passthru = {
updateScript = ./update.sh;
tests = {
inherit (nixosTests) odoo;
inherit (nixosTests) odoo17;
};
};