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