nixpkgs/pkgs/development/python-modules/graphene-django/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

85 lines
1.8 KiB
Nix

{
stdenv,
lib,
buildPythonPackage,
pythonOlder,
fetchFromGitHub,
graphene,
graphql-core,
django,
djangorestframework,
promise,
text-unidecode,
django-filter,
mock,
py,
pytest-django,
pytest-random-order,
pytest7CheckHook,
}:
buildPythonPackage rec {
pname = "graphene-django";
version = "3.2.2";
format = "setuptools";
disabled = pythonOlder "3.6";
src = fetchFromGitHub {
owner = "graphql-python";
repo = pname;
rev = "refs/tags/v${version}";
hash = "sha256-12ue7Pq7TFMSBAfaj8Si6KrpuKYp5T2EEesJpc8wRho=";
};
postPatch = ''
substituteInPlace setup.py \
--replace '"pytest-runner"' ""
'';
propagatedBuildInputs = [
djangorestframework
graphene
graphql-core
django
promise
text-unidecode
];
preCheck = ''
export DJANGO_SETTINGS_MODULE=examples.django_test_settings
'';
nativeCheckInputs = [
django-filter
mock
py
pytest-django
pytest-random-order
pytest7CheckHook
];
disabledTests =
[
# https://github.com/graphql-python/graphene-django/issues/1510
"test_should_filepath_convert_string"
"test_should_choice_convert_enum"
"test_should_multiplechoicefield_convert_to_list_of_enum"
"test_perform_mutate_success_with_enum_choice_field"
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
# this test touches files in the "/" directory and fails in darwin sandbox
"test_should_filepath_convert_string"
];
meta = with lib; {
description = "Integrate GraphQL into your Django project";
homepage = "https://github.com/graphql-python/graphene-django";
changelog = "https://github.com/graphql-python/graphene-django/releases/tag/v${version}";
license = licenses.mit;
maintainers = with maintainers; [ hexa ];
};
}