From 0888858ec16bf75555e815fd85e0f719a73b1b38 Mon Sep 17 00:00:00 2001 From: natsukium Date: Mon, 13 Jan 2025 13:41:29 +0900 Subject: [PATCH 1/2] python312Packages.sqlalchemy-i18n: refactor --- .../sqlalchemy-i18n/default.nix | 31 +++++++++++++++---- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/pkgs/development/python-modules/sqlalchemy-i18n/default.nix b/pkgs/development/python-modules/sqlalchemy-i18n/default.nix index b3540712d926..65a9d6ef1410 100644 --- a/pkgs/development/python-modules/sqlalchemy-i18n/default.nix +++ b/pkgs/development/python-modules/sqlalchemy-i18n/default.nix @@ -2,33 +2,52 @@ lib, fetchPypi, buildPythonPackage, + setuptools, sqlalchemy, sqlalchemy-utils, six, + postgresql, + postgresqlTestHook, + psycopg2, + pytestCheckHook, }: buildPythonPackage rec { pname = "sqlalchemy-i18n"; version = "1.1.0"; + pyproject = true; src = fetchPypi { pname = "SQLAlchemy-i18n"; inherit version; - sha256 = "de33376483a581ca14218d8f57a114466c5f72b674a95839b6c4564a6e67796f"; + hash = "sha256-3jM3ZIOlgcoUIY2PV6EURmxfcrZ0qVg5tsRWSm5neW8="; }; - propagatedBuildInputs = [ + build-system = [ setuptools ]; + + dependencies = [ sqlalchemy sqlalchemy-utils six ]; - # tests require running a postgresql server - doCheck = false; + pythonImportsCheck = [ "sqlalchemy_i18n" ]; - meta = with lib; { + nativeCheckInputs = [ + postgresql + postgresqlTestHook + psycopg2 + pytestCheckHook + ]; + + env = { + PGDATABASE = "sqlalchemy_i18n_test"; + postgresqlEnableTCP = 1; + }; + + meta = { homepage = "https://github.com/kvesteri/sqlalchemy-i18n"; description = "Internationalization extension for SQLAlchemy models"; - license = licenses.bsd3; + license = lib.licenses.bsd3; }; } From aee6355d786fd430bf6493b3e4b24ee9eb2c9615 Mon Sep 17 00:00:00 2001 From: natsukium Date: Mon, 13 Jan 2025 13:44:11 +0900 Subject: [PATCH 2/2] python312Packages.sqlalchemy-i18n: mark as broken --- .../sqlalchemy-continuum/default.nix | 19 ++++++++++++++----- .../sqlalchemy-i18n/default.nix | 2 ++ 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/pkgs/development/python-modules/sqlalchemy-continuum/default.nix b/pkgs/development/python-modules/sqlalchemy-continuum/default.nix index 77452fbccde6..501486e5059b 100644 --- a/pkgs/development/python-modules/sqlalchemy-continuum/default.nix +++ b/pkgs/development/python-modules/sqlalchemy-continuum/default.nix @@ -42,11 +42,20 @@ buildPythonPackage rec { i18n = [ sqlalchemy-i18n ]; }; - nativeCheckInputs = [ - psycopg2 - pymysql - pytestCheckHook - ] ++ lib.flatten (lib.attrValues optional-dependencies); + nativeCheckInputs = + [ + psycopg2 + pymysql + pytestCheckHook + ] + ++ optional-dependencies.flask + ++ optional-dependencies.flask-login + ++ optional-dependencies.flask-sqlalchemy; + + disabledTestPaths = [ + # requires sqlalchemy-i18n, which is incompatible with sqlalchemy>=2 + "tests/test_i18n.py" + ]; preCheck = '' # Indicate tests that we don't have a database server at hand diff --git a/pkgs/development/python-modules/sqlalchemy-i18n/default.nix b/pkgs/development/python-modules/sqlalchemy-i18n/default.nix index 65a9d6ef1410..172e1f352658 100644 --- a/pkgs/development/python-modules/sqlalchemy-i18n/default.nix +++ b/pkgs/development/python-modules/sqlalchemy-i18n/default.nix @@ -49,5 +49,7 @@ buildPythonPackage rec { homepage = "https://github.com/kvesteri/sqlalchemy-i18n"; description = "Internationalization extension for SQLAlchemy models"; license = lib.licenses.bsd3; + # sqlalchemy.exc.InvalidRequestError: The 'sqlalchemy.orm.mapper()' function is removed as of SQLAlchemy 2.0. + broken = lib.versionAtLeast sqlalchemy.version "2"; }; }