Merge pull request #181311 from squalus/pydantic

python310Packages.pydantic: fix cross compile
This commit is contained in:
Kira Bruneau 2022-07-16 11:18:58 -04:00 committed by GitHub
commit 1224622646
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,5 @@
{ lib
, stdenv
, buildPythonPackage
, cython
, devtools
@ -10,6 +11,7 @@
, pythonOlder
, typing-extensions
# dependencies for building documentation.
, withDocs ? (stdenv.hostPlatform == stdenv.buildPlatform)
, ansi2html
, markdown-include
, mkdocs
@ -25,7 +27,13 @@
buildPythonPackage rec {
pname = "pydantic";
version = "1.9.0";
outputs = [ "out" "doc" ];
outputs = [
"out"
] ++ lib.optionals withDocs [
"doc"
];
disabled = pythonOlder "3.7";
src = fetchFromGitHub {
@ -41,7 +49,7 @@ buildPythonPackage rec {
nativeBuildInputs = [
cython
] ++ lib.optionals withDocs [
# dependencies for building documentation
ansi2html
markdown-include
@ -73,12 +81,12 @@ buildPythonPackage rec {
# Must include current directory into PYTHONPATH, since documentation
# building process expects "import pydantic" to work.
preBuild = ''
preBuild = lib.optionals withDocs ''
PYTHONPATH=$PWD:$PYTHONPATH make docs
'';
# Layout documentation in same way as "sphinxHook" does.
postInstall = ''
postInstall = lib.optionals withDocs ''
mkdir -p $out/share/doc/$name
mv ./site $out/share/doc/$name/html
'';