Commit 2fa2e9a3 authored by Jason Yundt's avatar Jason Yundt Committed by Masum Reza
Browse files

pre-commit: fix building on i686-linux

Fixes #372126.
parent d4504906
Loading
Loading
Loading
Loading
+110 −86
Original line number Diff line number Diff line
@@ -16,6 +16,9 @@
}:

with python3Packages;
let
  i686Linux = stdenv.buildPlatform.system == "i686-linux";
in
buildPythonApplication rec {
  pname = "pre-commit";
  version = "4.0.1";
@@ -45,15 +48,13 @@ buildPythonApplication rec {
    virtualenv
  ];

  nativeCheckInputs = [
  nativeCheckInputs =
    [
      cargo
    coursier
    dotnet-sdk
      gitMinimal
      glibcLocales
      go
      libiconv # For rust tests on Darwin
    nodejs
      perl
      pytest-env
      pytest-forked
@@ -61,10 +62,21 @@ buildPythonApplication rec {
      pytestCheckHook
      re-assert
      cabal-install
  ];

    ]
    ++ lib.optionals (!i686Linux) [
      # coursier can be moved back to the main nativeCheckInputs list once we’re able to bootstrap a
      # JRE on i686-linux: <https://github.com/NixOS/nixpkgs/issues/314873>. When coursier gets
      # moved back to the main nativeCheckInputs list, don’t forget to re-enable the
      # coursier-related test that is currently disabled on i686-linux.
      coursier
      # i686-linux: dotnet-sdk not available
  doCheck = stdenv.buildPlatform.system != "i686-linux";
      dotnet-sdk
      # nodejs can be moved back to the main nativeCheckInputs list once this
      # issue is fixed: <https://github.com/NixOS/nixpkgs/issues/387658>. When nodejs gets
      # moved back to the main nativeCheckInputs list, don’t forget to re-enable the
      # Node.js-related tests that are currently disabled on i686-linux.
      nodejs
    ];

  postPatch = ''
    substituteInPlace pre_commit/resources/hook-tmpl \
@@ -90,10 +102,12 @@ buildPythonApplication rec {
      export GIT_AUTHOR_NAME=test GIT_COMMITTER_NAME=test \
             GIT_AUTHOR_EMAIL=test@example.com GIT_COMMITTER_EMAIL=test@example.com \
             VIRTUALENV_NO_DOWNLOAD=1 PRE_COMMIT_NO_CONCURRENCY=1 LANG=en_US.UTF-8

    ''
    + lib.optionalString (!i686Linux) ''
      # Resolve `.NET location: Not found` errors for dotnet tests
      export DOTNET_ROOT="${dotnet-sdk}/share/dotnet"

    ''
    + ''
      export HOME=$(mktemp -d)

      git init -b master
@@ -106,7 +120,8 @@ buildPythonApplication rec {
    deactivate
  '';

  disabledTests = [
  disabledTests =
    [
      # ERROR: The install method you used for conda--probably either `pip install conda`
      # or `easy_install conda`--is not compatible with using conda as an application.
      "test_conda_"
@@ -169,6 +184,15 @@ buildPythonApplication rec {

      # Docker required
      "test_docker_"
    ]
    ++ lib.optionals i686Linux [
      # From coursier_test.py:
      "test_error_if_no_deps_or_channel"
      # From node_test.py:
      "test_healthy_system_node"
      "test_unhealthy_if_system_node_goes_missing"
      "test_node_hook_system"
      "test_node_with_user_config_set"
    ];

  pythonImportsCheck = [