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

96 lines
2.1 KiB
Nix

{
lib,
stdenv,
brotlicffi,
buildPythonPackage,
certifi,
chardet,
charset-normalizer,
fetchPypi,
idna,
pysocks,
pytest-mock,
pytest-xdist,
pytestCheckHook,
pythonOlder,
urllib3,
}:
buildPythonPackage rec {
pname = "requests";
version = "2.32.3";
format = "setuptools";
disabled = pythonOlder "3.7";
__darwinAllowLocalNetworking = true;
src = fetchPypi {
inherit pname version;
hash = "sha256-VTZUF3NOsYJVWQqf+euX6eHaho1MzWQCOZ6vaK8gp2A=";
};
patches = [
# https://github.com/psf/requests/issues/6730
# https://github.com/psf/requests/pull/6731
./ca-load-regression.patch
];
dependencies = [
brotlicffi
certifi
charset-normalizer
idna
urllib3
];
optional-dependencies = {
security = [ ];
socks = [ pysocks ];
use_chardet_on_py3 = [ chardet ];
};
nativeCheckInputs = [
pytest-mock
pytest-xdist
pytestCheckHook
] ++ optional-dependencies.socks;
disabledTests =
[
# Disable tests that require network access and use httpbin
"requests.api.request"
"requests.models.PreparedRequest"
"requests.sessions.Session"
"requests"
"test_redirecting_to_bad_url"
"test_requests_are_updated_each_time"
"test_should_bypass_proxies_pass_only_hostname"
"test_urllib3_pool_connection_closed"
"test_urllib3_retries"
"test_use_proxy_from_environment"
"TestRequests"
"TestTimeout"
]
++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [
# Fatal Python error: Aborted
"test_basic_response"
"test_text_response"
];
disabledTestPaths = lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [
# Fatal Python error: Aborted
"tests/test_lowlevel.py"
];
pythonImportsCheck = [ "requests" ];
meta = with lib; {
description = "HTTP library for Python";
homepage = "http://docs.python-requests.org/";
changelog = "https://github.com/psf/requests/blob/v${version}/HISTORY.md";
license = licenses.asl20;
maintainers = with maintainers; [ fab ];
};
}