Unverified Commit 12246226 authored by Kira Bruneau's avatar Kira Bruneau Committed by GitHub
Browse files

Merge pull request #181311 from squalus/pydantic

python310Packages.pydantic: fix cross compile
parents a29db661 640b1bb3
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
{ 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
  '';