diff --git a/pkgs/development/python-modules/pg8000/default.nix b/pkgs/development/python-modules/pg8000/default.nix index b3ac256e0bb5..4ae1daa17951 100644 --- a/pkgs/development/python-modules/pg8000/default.nix +++ b/pkgs/development/python-modules/pg8000/default.nix @@ -1,6 +1,7 @@ { lib , buildPythonPackage , fetchPypi +, importlib-metadata , passlib , pythonOlder , scramp @@ -8,21 +9,27 @@ buildPythonPackage rec { pname = "pg8000"; - version = "1.28.0"; - format = "setuptools"; + version = "1.29.1"; + format = "pyproject"; - disabled = pythonOlder "3.6"; + disabled = pythonOlder "3.7"; src = fetchPypi { inherit pname version; - sha256 = "sha256-Q1E949TjeOc6xEKpOQa6qdNWJFqmeqf2FgXFbjmn9ZE="; + hash = "sha256-gLT03ksCVIMreUhRHg3UY0LRwERszU/diStj0C5PvHs="; }; propagatedBuildInputs = [ passlib scramp + ] ++ lib.optionals (pythonOlder "3.8") [ + importlib-metadata ]; + postPatch = '' + sed '/^\[metadata\]/a version = ${version}' setup.cfg + ''; + # Tests require a running PostgreSQL instance doCheck = false; diff --git a/pkgs/development/python-modules/testing-postgresql/default.nix b/pkgs/development/python-modules/testing-postgresql/default.nix index 7ebff6ccc365..fd88ea03bf72 100644 --- a/pkgs/development/python-modules/testing-postgresql/default.nix +++ b/pkgs/development/python-modules/testing-postgresql/default.nix @@ -1,32 +1,60 @@ -{ lib, buildPythonPackage, fetchFromGitHub, postgresql, testing-common-database -, pg8000, pytestCheckHook, psycopg2, sqlalchemy }: +{ lib +, buildPythonPackage +, fetchFromGitHub +, pg8000 +, postgresql +, psycopg2 +, pytestCheckHook +, pythonOlder +, sqlalchemy +, testing-common-database +}: buildPythonPackage rec { - pname = "testing.postgresql"; + pname = "testing-postgresql"; # Version 1.3.0 isn't working so let's use the latest commit from GitHub version = "unstable-2017-10-31"; + format = "setuptools"; + + disabled = pythonOlder "3.7"; src = fetchFromGitHub { owner = "tk0miya"; - repo = pname; + repo = "testing.postgresql"; rev = "c81ded434d00ec8424de0f9e1f4063c778c6aaa8"; - sha256 = "1asqsi38di768i1sc1qm1k068dj0906ds6lnx7xcbxws0s25m2q3"; + sha256 = "sha256-A4tahAaa98X66ZYa3QxIQDZkwAwVB6ZDRObEhkbUWKs="; }; + propagatedBuildInputs = [ + testing-common-database + pg8000 + ]; + + checkInputs = [ + pytestCheckHook + psycopg2 + sqlalchemy + ]; + # Add PostgreSQL to search path prePatch = '' substituteInPlace src/testing/postgresql.py \ --replace "/usr/local/pgsql" "${postgresql}" ''; - propagatedBuildInputs = [ testing-common-database pg8000 ]; + postPatch = '' + substituteInPlace setup.py \ + --replace "pg8000 >= 1.10" "pg8000" + ''; + + pythonImportsCheck = [ + "testing.postgresql" + ]; # Fix tests for Darwin build. See: # https://github.com/NixOS/nixpkgs/pull/74716#issuecomment-598546916 __darwinAllowLocalNetworking = true; - checkInputs = [ pytestCheckHook psycopg2 sqlalchemy ]; - meta = with lib; { description = "Use temporary postgresql instance in testing"; homepage = "https://github.com/tk0miya/testing.postgresql";