e0464e4788
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" ```
79 lines
1.6 KiB
Nix
79 lines
1.6 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
buildPythonPackage,
|
|
cryptography,
|
|
fetchFromGitHub,
|
|
mock,
|
|
pyparsing,
|
|
pytest-forked,
|
|
pytest-randomly,
|
|
pytest-timeout,
|
|
pytestCheckHook,
|
|
pythonAtLeast,
|
|
six,
|
|
}:
|
|
|
|
buildPythonPackage rec {
|
|
pname = "httplib2";
|
|
version = "0.22.0";
|
|
format = "setuptools";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = pname;
|
|
repo = pname;
|
|
rev = "v${version}";
|
|
hash = "sha256-76gdiRbF535CEaNXwNqsVeVc0dKglovMPQpGsOkbd/4=";
|
|
};
|
|
|
|
postPatch = ''
|
|
sed -i "/--cov/d" setup.cfg
|
|
'';
|
|
|
|
propagatedBuildInputs = [ pyparsing ];
|
|
|
|
nativeCheckInputs = [
|
|
cryptography
|
|
mock
|
|
pytest-forked
|
|
pytest-randomly
|
|
pytest-timeout
|
|
six
|
|
pytestCheckHook
|
|
];
|
|
|
|
__darwinAllowLocalNetworking = true;
|
|
|
|
# Don't run tests for older Pythons
|
|
doCheck = pythonAtLeast "3.9";
|
|
|
|
disabledTests =
|
|
[
|
|
# ValueError: Unable to load PEM file.
|
|
# https://github.com/httplib2/httplib2/issues/192#issuecomment-993165140
|
|
"test_client_cert_password_verified"
|
|
|
|
# improper pytest marking
|
|
"test_head_301"
|
|
"test_303"
|
|
]
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [
|
|
# fails with "ConnectionResetError: [Errno 54] Connection reset by peer"
|
|
"test_connection_close"
|
|
# fails with HTTP 408 Request Timeout, instead of expected 200 OK
|
|
"test_timeout_subsequent"
|
|
"test_connection_close"
|
|
];
|
|
|
|
pytestFlagsArray = [ "--ignore python2" ];
|
|
|
|
pythonImportsCheck = [ "httplib2" ];
|
|
|
|
meta = with lib; {
|
|
description = "Comprehensive HTTP client library";
|
|
homepage = "https://github.com/httplib2/httplib2";
|
|
license = licenses.mit;
|
|
maintainers = with maintainers; [ fab ];
|
|
};
|
|
}
|