pre-commit: fix building on i686-linux

Fixes #372126.
This commit is contained in:
Jason Yundt
2025-03-07 00:45:32 +05:30
committed by Masum Reza
parent d45049062c
commit 2fa2e9a3aa
+105 -81
View File
@@ -16,6 +16,9 @@
}:
with python3Packages;
let
i686Linux = stdenv.buildPlatform.system == "i686-linux";
in
buildPythonApplication rec {
pname = "pre-commit";
version = "4.0.1";
@@ -45,26 +48,35 @@ buildPythonApplication rec {
virtualenv
];
nativeCheckInputs = [
cargo
coursier
dotnet-sdk
gitMinimal
glibcLocales
go
libiconv # For rust tests on Darwin
nodejs
perl
pytest-env
pytest-forked
pytest-xdist
pytestCheckHook
re-assert
cabal-install
];
# i686-linux: dotnet-sdk not available
doCheck = stdenv.buildPlatform.system != "i686-linux";
nativeCheckInputs =
[
cargo
gitMinimal
glibcLocales
go
libiconv # For rust tests on Darwin
perl
pytest-env
pytest-forked
pytest-xdist
pytestCheckHook
re-assert
cabal-install
]
++ lib.optionals (!i686Linux) [
# coursier can be moved back to the main nativeCheckInputs list once were 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, dont forget to re-enable the
# coursier-related test that is currently disabled on i686-linux.
coursier
# i686-linux: dotnet-sdk not available
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, dont 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,70 +120,80 @@ buildPythonApplication rec {
deactivate
'';
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_"
"test_local_conda_"
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_"
"test_local_conda_"
# /build/pytest-of-nixbld/pytest-0/test_install_ruby_with_version0/rbenv-2.7.2/libexec/rbenv-init:
# /usr/bin/env: bad interpreter: No such file or directory
"test_ruby_"
# /build/pytest-of-nixbld/pytest-0/test_install_ruby_with_version0/rbenv-2.7.2/libexec/rbenv-init:
# /usr/bin/env: bad interpreter: No such file or directory
"test_ruby_"
# network
"test_additional_dependencies_roll_forward"
"test_additional_golang_dependencies_installed"
"test_additional_node_dependencies_installed"
"test_additional_rust_cli_dependencies_installed"
"test_additional_rust_lib_dependencies_installed"
"test_coursier_hook"
"test_coursier_hook_additional_dependencies"
"test_dart"
"test_dart_additional_deps"
"test_dart_additional_deps_versioned"
"test_during_commit_all"
"test_golang_default_version"
"test_golang_hook"
"test_golang_hook_still_works_when_gobin_is_set"
"test_golang_infer_go_version_default"
"test_golang_system"
"test_golang_versioned"
"test_language_version_with_rustup"
"test_installs_rust_missing_rustup"
"test_installs_without_links_outside_env"
"test_local_golang_additional_deps"
"test_lua"
"test_lua_additional_dependencies"
"test_node_additional_deps"
"test_node_hook_versions"
"test_perl_additional_dependencies"
"test_r_hook"
"test_r_inline"
"test_r_inline_hook"
"test_r_local_with_additional_dependencies_hook"
"test_r_with_additional_dependencies_hook"
"test_run_a_node_hook_default_version"
"test_run_lib_additional_dependencies"
"test_run_versioned_node_hook"
"test_rust_cli_additional_dependencies"
"test_swift_language"
"test_run_example_executable"
"test_run_dep"
# network
"test_additional_dependencies_roll_forward"
"test_additional_golang_dependencies_installed"
"test_additional_node_dependencies_installed"
"test_additional_rust_cli_dependencies_installed"
"test_additional_rust_lib_dependencies_installed"
"test_coursier_hook"
"test_coursier_hook_additional_dependencies"
"test_dart"
"test_dart_additional_deps"
"test_dart_additional_deps_versioned"
"test_during_commit_all"
"test_golang_default_version"
"test_golang_hook"
"test_golang_hook_still_works_when_gobin_is_set"
"test_golang_infer_go_version_default"
"test_golang_system"
"test_golang_versioned"
"test_language_version_with_rustup"
"test_installs_rust_missing_rustup"
"test_installs_without_links_outside_env"
"test_local_golang_additional_deps"
"test_lua"
"test_lua_additional_dependencies"
"test_node_additional_deps"
"test_node_hook_versions"
"test_perl_additional_dependencies"
"test_r_hook"
"test_r_inline"
"test_r_inline_hook"
"test_r_local_with_additional_dependencies_hook"
"test_r_with_additional_dependencies_hook"
"test_run_a_node_hook_default_version"
"test_run_lib_additional_dependencies"
"test_run_versioned_node_hook"
"test_rust_cli_additional_dependencies"
"test_swift_language"
"test_run_example_executable"
"test_run_dep"
# i don't know why these fail
"test_install_existing_hooks_no_overwrite"
"test_installed_from_venv"
"test_uninstall_restores_legacy_hooks"
"test_dotnet_"
"test_health_check_"
# i don't know why these fail
"test_install_existing_hooks_no_overwrite"
"test_installed_from_venv"
"test_uninstall_restores_legacy_hooks"
"test_dotnet_"
"test_health_check_"
# Expects `git commit` to fail when `pre-commit` is not in the `$PATH`,
# but we use an absolute path so it's not an issue.
"test_environment_not_sourced"
# Expects `git commit` to fail when `pre-commit` is not in the `$PATH`,
# but we use an absolute path so it's not an issue.
"test_environment_not_sourced"
# Docker required
"test_docker_"
];
# 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 = [
"pre_commit"