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

106 lines
2.5 KiB
Nix

{
lib,
stdenv,
buildPythonPackage,
fetchPypi,
jaraco-functools,
jaraco-text,
more-itertools,
portend,
pypytools,
pytest-mock,
pytestCheckHook,
pythonOlder,
requests,
requests-toolbelt,
requests-unixsocket,
setuptools-scm,
six,
}:
buildPythonPackage rec {
pname = "cheroot";
version = "10.0.1";
format = "setuptools";
disabled = pythonOlder "3.7";
src = fetchPypi {
inherit pname version;
hash = "sha256-4LgveXZY0muGE+yOtWPDsI5r1qeSHp1Qib0Rda0bF0A=";
};
# remove setuptools-scm-git-archive dependency
# https://github.com/cherrypy/cheroot/commit/f0c51af263e20f332c6f675aa90ec6705ae4f5d1
# there is a difference between the github source and the pypi tarball source,
# and it is not easy to apply patches.
postPatch = ''
substituteInPlace pyproject.toml \
--replace '"setuptools_scm_git_archive>=1.1",' ""
substituteInPlace setup.cfg \
--replace "setuptools_scm_git_archive>=1.0" ""
'';
nativeBuildInputs = [ setuptools-scm ];
propagatedBuildInputs = [
jaraco-functools
more-itertools
six
];
nativeCheckInputs = [
jaraco-text
portend
pypytools
pytest-mock
pytestCheckHook
requests
requests-toolbelt
requests-unixsocket
];
# Disable doctest plugin because times out
# Disable xdist (-n arg) because it's incompatible with testmon
# Deselect test_bind_addr_unix on darwin because times out
# Deselect test_http_over_https_error on darwin because builtin cert fails
# Disable warnings-as-errors because of deprecation warnings from socks on python 3.7
# Disable pytest-testmon because it doesn't work
# adds many other pytest utilities which aren't necessary like linting
preCheck = ''
rm pytest.ini
'';
disabledTests =
[
"tls" # touches network
"peercreds_unix_sock" # test urls no longer allowed
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
"http_over_https_error"
"bind_addr_unix"
"test_ssl_env"
];
disabledTestPaths = [
# avoid attempting to use 3 packages not available on nixpkgs
# (jaraco.apt, jaraco.context, yg.lockfile)
"cheroot/test/test_wsgi.py"
# requires pyopenssl
"cheroot/test/test_ssl.py"
];
pythonImportsCheck = [ "cheroot" ];
# Some of the tests use localhost networking.
__darwinAllowLocalNetworking = true;
meta = with lib; {
description = "High-performance, pure-Python HTTP";
mainProgram = "cheroot";
homepage = "https://github.com/cherrypy/cheroot";
license = licenses.mit;
maintainers = [ ];
};
}