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

84 lines
1.4 KiB
Nix

{
stdenv,
lib,
buildPythonPackage,
pythonOlder,
fetchFromGitHub,
# build-system
cython,
setuptools,
# dependencies
decorator,
# native dependencies
GSS,
krb5-c, # C krb5 library, not PyPI krb5
# tests
parameterized,
k5test,
pytestCheckHook,
}:
buildPythonPackage rec {
pname = "gssapi";
version = "1.8.3";
pyproject = true;
disabled = pythonOlder "3.6";
src = fetchFromGitHub {
owner = "pythongssapi";
repo = "python-${pname}";
rev = "refs/tags/v${version}";
hash = "sha256-H1JfdvxJvX5dmC9aTqIOkjAqFEL44KoUXEhoYj2uRY8=";
};
postPatch = ''
substituteInPlace setup.py \
--replace 'get_output(f"{kc} gssapi --prefix")' '"${lib.getDev krb5-c}"'
'';
env = lib.optionalAttrs (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) {
GSSAPI_SUPPORT_DETECT = "false";
};
build-system = [
cython
krb5-c
setuptools
];
dependencies = [ decorator ];
buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ GSS ];
# k5test is marked as broken on darwin
doCheck = !stdenv.hostPlatform.isDarwin;
nativeCheckInputs = [
k5test
parameterized
pytestCheckHook
];
preCheck = ''
mv gssapi/tests $TMPDIR/
pushd $TMPDIR
'';
postCheck = ''
popd
'';
pythonImportsCheck = [ "gssapi" ];
meta = with lib; {
homepage = "https://pypi.python.org/pypi/gssapi";
description = "Python GSSAPI Wrapper";
license = licenses.mit;
};
}