From 9d32e349d27ade285b468477dc8ca4f0a7244875 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Sun, 15 May 2022 03:49:31 +0000 Subject: [PATCH 1/2] python3Packages.flask-restful: only apply patch if necessary --- pkgs/development/python-modules/flask-restful/default.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/development/python-modules/flask-restful/default.nix b/pkgs/development/python-modules/flask-restful/default.nix index 25f02b87c9e7..cefedfe7fc37 100644 --- a/pkgs/development/python-modules/flask-restful/default.nix +++ b/pkgs/development/python-modules/flask-restful/default.nix @@ -10,6 +10,7 @@ , pythonOlder , pytz , six +, werkzeug }: buildPythonPackage rec { @@ -25,7 +26,7 @@ buildPythonPackage rec { hash = "sha256-zOxlC4NdSBkhOMhTKa4Dc15s7VjpstnCFG1shMBvpT4="; }; - patches = [ + patches = lib.optionals (lib.versionAtLeast werkzeug.version "2.1.0") [ ./werkzeug-2.1.0-compat.patch ]; From d2c0c7eb4cc91beb0a1adbaf13abc0a526a21708 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Sun, 15 May 2022 03:52:41 +0000 Subject: [PATCH 2/2] odoo: use packageOverrides --- pkgs/applications/finance/odoo/default.nix | 86 ++++++++++++++----- .../development/python-modules/werkzeug/1.nix | 62 ------------- 2 files changed, 66 insertions(+), 82 deletions(-) delete mode 100644 pkgs/development/python-modules/werkzeug/1.nix diff --git a/pkgs/applications/finance/odoo/default.nix b/pkgs/applications/finance/odoo/default.nix index 66b1bb0f97fe..38719de371aa 100644 --- a/pkgs/applications/finance/odoo/default.nix +++ b/pkgs/applications/finance/odoo/default.nix @@ -2,19 +2,74 @@ , lib , fetchurl , python3 -, python3Packages , nodePackages , wkhtmltopdf -, callPackage }: -with python3Packages; - let - werkzeug = python3Packages.callPackage ../../../development/python-modules/werkzeug/1.nix {}; -in - -buildPythonApplication rec { + python = python3.override { + packageOverrides = self: super: { + click = super.click.overridePythonAttrs (old: rec { + version = "7.1.2"; + src = old.src.override { + inherit version; + sha256 = "d2b5255c7c6349bc1bd1e59e08cd12acbbd63ce649f2588755783aa94dfb6b1a"; + }; + }); + flask = super.flask.overridePythonAttrs (old: rec { + version = "1.1.4"; + src = old.src.override { + inherit version; + sha256 = "0fbeb6180d383a9186d0d6ed954e0042ad9f18e0e8de088b2b419d526927d196"; + }; + }); + itsdangerous = super.itsdangerous.overridePythonAttrs (old: rec { + version = "1.1.0"; + src = old.src.override { + inherit version; + sha256 = "321b033d07f2a4136d3ec762eac9f16a10ccd60f53c0c91af90217ace7ba1f19"; + }; + }); + jinja2 = super.jinja2.overridePythonAttrs (old: rec { + version = "2.11.3"; + src = old.src.override { + inherit version; + sha256 = "a6d58433de0ae800347cab1fa3043cebbabe8baa9d29e668f1c768cb87a333c6"; + }; + }); + markupsafe = super.markupsafe.overridePythonAttrs (old: rec { + version = "2.0.1"; + src = old.src.override { + inherit version; + sha256 = "594c67807fb16238b30c44bdf74f36c02cdf22d1c8cda91ef8a0ed8dabf5620a"; + }; + }); + werkzeug = super.werkzeug.overridePythonAttrs (old: rec { + version = "1.0.1"; + src = old.src.override { + inherit version; + sha256 = "6c80b1e5ad3665290ea39320b91e1be1e0d5f60652b964a3070216de83d2e47c"; + }; + checkInputs = old.checkInputs ++ (with self; [ + requests + ]); + disabledTests = old.disabledTests ++ [ + # ResourceWarning: unclosed file + "test_basic" + "test_date_to_unix" + "test_easteregg" + "test_file_rfc2231_filename_continuations" + "test_find_terminator" + "test_save_to_pathlib_dst" + ]; + disabledTestPaths = old.disabledTestPaths ++ [ + # ResourceWarning: unclosed file + "tests/test_http.py" + ]; + }); + }; + }; +in python.pkgs.buildPythonApplication rec { pname = "odoo"; major = "15"; @@ -23,6 +78,8 @@ buildPythonApplication rec { version = "${major}.${minor}.${patch}"; + format = "setuptools"; + # latest release is at https://github.com/odoo/docker/blob/master/15.0/Dockerfile src = fetchurl { url = "https://nightly.odoo.com/${major}.${minor}/nightly/src/odoo_${version}.tar.gz"; @@ -30,23 +87,12 @@ buildPythonApplication rec { hash = "sha256-mofV0mNCdyzJecp0XegZBR/5NzHjis9kbpsUA/KJbZg="; }; - nativeBuildInputs = [ - setuptools - wheel - mock - ]; - - buildInputs = [ - wkhtmltopdf - nodePackages.rtlcss - ]; - # needs some investigation doCheck = false; makeWrapperArgs = [ "--prefix" "PATH" ":" "${lib.makeBinPath [ wkhtmltopdf nodePackages.rtlcss ]}" ]; - propagatedBuildInputs = [ + propagatedBuildInputs = with python.pkgs; [ Babel chardet decorator diff --git a/pkgs/development/python-modules/werkzeug/1.nix b/pkgs/development/python-modules/werkzeug/1.nix deleted file mode 100644 index ae7ce1f2b90a..000000000000 --- a/pkgs/development/python-modules/werkzeug/1.nix +++ /dev/null @@ -1,62 +0,0 @@ -{ lib, stdenv, buildPythonPackage, fetchPypi -, itsdangerous, hypothesis -, pytestCheckHook, requests -, pytest-timeout -, isPy3k - }: - -buildPythonPackage rec { - pname = "Werkzeug"; - version = "1.0.1"; - - src = fetchPypi { - inherit pname version; - sha256 = "6c80b1e5ad3665290ea39320b91e1be1e0d5f60652b964a3070216de83d2e47c"; - }; - - propagatedBuildInputs = [ itsdangerous ]; - checkInputs = [ pytestCheckHook requests hypothesis pytest-timeout ]; - - postPatch = '' - # ResourceWarning causes tests to fail - rm tests/test_routing.py - ''; - - disabledTests = [ - "test_save_to_pathlib_dst" - "test_cookie_maxsize" - "test_cookie_samesite_attribute" - "test_cookie_samesite_invalid" - "test_range_parsing" - "test_content_range_parsing" - "test_http_date_lt_1000" - "test_best_match_works" - "test_date_to_unix" - "test_easteregg" - - # Seems to be a problematic test-case: - # - # > warnings.warn(pytest.PytestUnraisableExceptionWarning(msg)) - # E pytest.PytestUnraisableExceptionWarning: Exception ignored in: <_io.FileIO [closed]> - # E - # E Traceback (most recent call last): - # E File "/nix/store/cwv8aj4vsqvimzljw5dxsxy663vjgibj-python3.9-Werkzeug-1.0.1/lib/python3.9/site-packages/werkzeug/formparser.py", line 318, in parse_multipart_headers - # E return Headers(result) - # E ResourceWarning: unclosed file <_io.FileIO name=11 mode='rb+' closefd=True> - "test_basic_routing" - "test_merge_slashes_match" - "test_merge_slashes_build" - "TestMultiPart" - "TestHTTPUtility" - ] ++ lib.optionals stdenv.isDarwin [ - "test_get_machine_id" - ]; - - meta = with lib; { - homepage = "https://palletsprojects.com/p/werkzeug/"; - description = "A WSGI utility library for Python"; - license = licenses.bsd3; - maintainers = [ ]; - }; -} -