nixpkgs/pkgs/development/python-modules/rstcheck/default.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

68 lines
1.4 KiB
Nix

{
lib,
stdenv,
buildPythonPackage,
docutils,
fetchFromGitHub,
setuptools,
setuptools-scm,
pydantic,
pytestCheckHook,
pythonOlder,
rstcheck-core,
typer,
types-docutils,
}:
buildPythonPackage rec {
pname = "rstcheck";
version = "6.2.4";
pyproject = true;
disabled = pythonOlder "3.8";
src = fetchFromGitHub {
owner = "rstcheck";
repo = "rstcheck";
rev = "refs/tags/v${version}";
hash = "sha256-CB8UtYAJpPrUOGgHOIp9Ts0GaID6GdtKHWD/ihxRoNg=";
};
build-system = [
setuptools
setuptools-scm
];
dependencies = [
docutils
rstcheck-core
types-docutils
pydantic
typer
];
nativeCheckInputs = [ pytestCheckHook ];
disabledTests = lib.optionals stdenv.hostPlatform.isDarwin [
# Disabled until https://github.com/rstcheck/rstcheck-core/issues/19 is resolved.
"test_error_without_config_file_macos"
"test_file_1_is_bad_without_config_macos"
];
pythonImportsCheck = [ "rstcheck" ];
preCheck = ''
# The tests need to find and call the rstcheck executable
export PATH="$PATH:$out/bin";
'';
meta = with lib; {
description = "Checks syntax of reStructuredText and code blocks nested within it";
homepage = "https://github.com/myint/rstcheck";
changelog = "https://github.com/rstcheck/rstcheck/blob/v${version}/CHANGELOG.md";
license = licenses.mit;
maintainers = with maintainers; [ staccato ];
mainProgram = "rstcheck";
};
}