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" ```
68 lines
1.3 KiB
Nix
68 lines
1.3 KiB
Nix
{
|
|
buildPythonPackage,
|
|
cffi,
|
|
fetchFromGitHub,
|
|
lib,
|
|
postgresql,
|
|
postgresqlTestHook,
|
|
pytestCheckHook,
|
|
setuptools,
|
|
six,
|
|
stdenv,
|
|
}:
|
|
|
|
buildPythonPackage rec {
|
|
pname = "psycopg2cffi";
|
|
version = "2.9.0";
|
|
pyproject = true;
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "chtd";
|
|
repo = "psycopg2cffi";
|
|
rev = "refs/tags/${version}";
|
|
hash = "sha256-9r5MYxw9cvdbLVj8StmMmn0AKQepOpCc7TIBGXZGWe4=";
|
|
};
|
|
|
|
postPatch = ''
|
|
substituteInPlace psycopg2cffi/_impl/_build_libpq.py \
|
|
--replace-fail "from distutils import sysconfig" "import sysconfig" \
|
|
--replace-fail "sysconfig.get_python_inc()" "sysconfig.get_path('include')"
|
|
'';
|
|
|
|
build-system = [
|
|
postgresql
|
|
setuptools
|
|
];
|
|
|
|
dependencies = [
|
|
cffi
|
|
six
|
|
];
|
|
|
|
# FATAL: could not create shared memory segment: Operation not permitted
|
|
doCheck = !stdenv.hostPlatform.isDarwin;
|
|
|
|
nativeCheckInputs = [
|
|
postgresqlTestHook
|
|
pytestCheckHook
|
|
];
|
|
|
|
disabledTests = [
|
|
# AssertionError: '{}' != []
|
|
"testEmptyArray"
|
|
];
|
|
|
|
env = {
|
|
PGDATABASE = "psycopg2_test";
|
|
};
|
|
|
|
pythonImportsCheck = [ "psycopg2cffi" ];
|
|
|
|
meta = with lib; {
|
|
description = "Implementation of the psycopg2 module using cffi";
|
|
homepage = "https://pypi.org/project/psycopg2cffi/";
|
|
license = with licenses; [ lgpl3Plus ];
|
|
maintainers = with maintainers; [ lovesegfault ];
|
|
};
|
|
}
|