Skip to content

Commit 4c58799

Browse files
python313Packages.psycopg: disable docs when cross compiling (#385349)
2 parents 73f3c9b + 5296085 commit 4c58799

File tree

1 file changed

+22
-14
lines changed

1 file changed

+22
-14
lines changed

pkgs/development/python-modules/psycopg/default.nix

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,13 @@ buildPythonPackage rec {
121121

122122
disabled = pythonOlder "3.7";
123123

124-
outputs = [
125-
"out"
126-
"doc"
127-
];
124+
outputs =
125+
[
126+
"out"
127+
]
128+
++ lib.optionals (stdenv.hostPlatform == stdenv.buildPlatform) [
129+
"doc"
130+
];
128131

129132
sphinxRoot = "../docs";
130133

@@ -141,13 +144,18 @@ buildPythonPackage rec {
141144
cd psycopg
142145
'';
143146

144-
nativeBuildInputs = [
145-
furo
146-
setuptools
147-
shapely
148-
sphinx-autodoc-typehints
149-
sphinxHook
150-
];
147+
nativeBuildInputs =
148+
[
149+
furo
150+
setuptools
151+
shapely
152+
]
153+
# building the docs fails with the following error when cross compiling
154+
# AttributeError: module 'psycopg_c.pq' has no attribute '__impl__'
155+
++ lib.optionals (stdenv.hostPlatform == stdenv.buildPlatform) [
156+
sphinx-autodoc-typehints
157+
sphinxHook
158+
];
151159

152160
propagatedBuildInputs = [
153161
psycopg-c
@@ -173,7 +181,7 @@ buildPythonPackage rec {
173181
pytestCheckHook
174182
postgresql
175183
]
176-
++ lib.optional (stdenv.hostPlatform.isLinux) postgresqlTestHook
184+
++ lib.optional stdenv.hostPlatform.isLinux postgresqlTestHook
177185
++ optional-dependencies.c
178186
++ optional-dependencies.pool;
179187

@@ -187,7 +195,7 @@ buildPythonPackage rec {
187195
''
188196
cd ..
189197
''
190-
+ lib.optionalString (stdenv.hostPlatform.isLinux) ''
198+
+ lib.optionalString stdenv.hostPlatform.isLinux ''
191199
export PSYCOPG_TEST_DSN="host=/build/run/postgresql user=$PGUSER"
192200
'';
193201

@@ -219,7 +227,7 @@ buildPythonPackage rec {
219227
];
220228

221229
postCheck = ''
222-
cd ${pname}
230+
cd psycopg
223231
'';
224232

225233
passthru = {

0 commit comments

Comments
 (0)