Files
nixpkgs/pkgs/development/python-modules/eventlet/default.nix
T
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

78 lines
1.6 KiB
Nix

{
lib,
stdenv,
buildPythonPackage,
fetchFromGitHub,
# build-system
hatch-vcs,
hatchling,
# dependencies
dnspython,
greenlet,
isPyPy,
six,
# tests
iana-etc,
pytestCheckHook,
libredirect,
}:
buildPythonPackage rec {
pname = "eventlet";
version = "0.35.2";
pyproject = true;
src = fetchFromGitHub {
owner = "eventlet";
repo = "eventlet";
rev = "v${version}";
hash = "sha256-jMbCxqIn9f9+16rFwpQdkBHj6NwTNkQxnSVV4qQ1fjM=";
};
nativeBuildInputs = [
hatch-vcs
hatchling
];
propagatedBuildInputs = [
dnspython
greenlet
six
];
nativeCheckInputs = [ pytestCheckHook ];
# libredirect is not available on darwin
# tests hang on pypy indefinitely
doCheck = !stdenv.hostPlatform.isDarwin && !isPyPy;
preCheck = lib.optionalString doCheck ''
echo "nameserver 127.0.0.1" > resolv.conf
export NIX_REDIRECTS=/etc/protocols=${iana-etc}/etc/protocols:/etc/resolv.conf=$(realpath resolv.conf)
export LD_PRELOAD=${libredirect}/lib/libredirect.so
export EVENTLET_IMPORT_VERSION_ONLY=0
'';
disabledTests = [
# AssertionError: Expected single line "pass" in stdout
"test_fork_after_monkey_patch"
# Tests requires network access
"test_getaddrinfo"
"test_hosts_no_network"
];
pythonImportsCheck = [ "eventlet" ];
meta = with lib; {
changelog = "https://github.com/eventlet/eventlet/blob/v${version}/NEWS";
description = "Concurrent networking library for Python";
homepage = "https://github.com/eventlet/eventlet/";
license = licenses.mit;
maintainers = with maintainers; [ SuperSandro2000 ];
};
}