diff --git a/pkgs/development/python-modules/psycopg/default.nix b/pkgs/development/python-modules/psycopg/default.nix index 51a0bdca487a..c9825a6528e5 100644 --- a/pkgs/development/python-modules/psycopg/default.nix +++ b/pkgs/development/python-modules/psycopg/default.nix @@ -121,10 +121,13 @@ buildPythonPackage rec { disabled = pythonOlder "3.7"; - outputs = [ - "out" - "doc" - ]; + outputs = + [ + "out" + ] + ++ lib.optionals (stdenv.hostPlatform == stdenv.buildPlatform) [ + "doc" + ]; sphinxRoot = "../docs"; @@ -141,13 +144,18 @@ buildPythonPackage rec { cd psycopg ''; - nativeBuildInputs = [ - furo - setuptools - shapely - sphinx-autodoc-typehints - sphinxHook - ]; + nativeBuildInputs = + [ + furo + setuptools + shapely + ] + # building the docs fails with the following error when cross compiling + # AttributeError: module 'psycopg_c.pq' has no attribute '__impl__' + ++ lib.optionals (stdenv.hostPlatform == stdenv.buildPlatform) [ + sphinx-autodoc-typehints + sphinxHook + ]; propagatedBuildInputs = [ psycopg-c @@ -173,7 +181,7 @@ buildPythonPackage rec { pytestCheckHook postgresql ] - ++ lib.optional (stdenv.hostPlatform.isLinux) postgresqlTestHook + ++ lib.optional stdenv.hostPlatform.isLinux postgresqlTestHook ++ optional-dependencies.c ++ optional-dependencies.pool; @@ -187,7 +195,7 @@ buildPythonPackage rec { '' cd .. '' - + lib.optionalString (stdenv.hostPlatform.isLinux) '' + + lib.optionalString stdenv.hostPlatform.isLinux '' export PSYCOPG_TEST_DSN="host=/build/run/postgresql user=$PGUSER" ''; @@ -219,7 +227,7 @@ buildPythonPackage rec { ]; postCheck = '' - cd ${pname} + cd psycopg ''; passthru = {