Add support for building bcrypt 4 (rust)

This commit is contained in:
Alex Chalk 2022-09-29 15:20:50 -04:00
parent 420107e7e7
commit fa52f5bd4b
5 changed files with 85 additions and 7 deletions

View file

@ -194,13 +194,37 @@ lib.composeManyExtensions [
dontUseCmakeConfigure = true; dontUseCmakeConfigure = true;
} }
); );
bcrypt =
bcrypt = super.bcrypt.overridePythonAttrs ( let
old: { getCargoHash = version: {
buildInputs = (old.buildInputs or [ ]) ++ [ pkgs.libffi ]; "4.0.0" = "sha256-HvfRLyUhlXVuvxWrtSDKx3rMKJbjvuiMcDY6g+pYFS0=";
} }.${version} or (
); lib.warn "Unknown bcrypt version: '${version}'. Please update getCargoHash." lib.fakeHash
);
sha256 = getCargoHash super.bcrypt.version;
in
super.bcrypt.overridePythonAttrs (
old: {
buildInputs = (old.buildInputs or [ ])
++ [ pkgs.libffi ]
++ lib.optionals (lib.versionAtLeast old.version "4" && stdenv.isDarwin)
[ pkgs.darwin.apple_sdk.frameworks.Security pkgs.libiconv ];
nativeBuildInputs = with pkgs;
(old.nativeBuildInputs or [ ])
++ lib.optionals (lib.versionAtLeast old.version "4")
(with pkgs.rustPlatform; [ rust.rustc rust.cargo cargoSetupHook self.setuptools-rust ]);
} // lib.optionalAttrs (lib.versionAtLeast old.version "4") rec {
cargoDeps =
pkgs.rustPlatform.fetchCargoTarball
{
src = old.src;
sourceRoot = "${old.pname}-${old.version}/src/_bcrypt";
name = "${old.pname}-${old.version}";
sha256 = getCargoHash old.version;
};
cargoRoot = "src/_bcrypt";
}
);
bjoern = super.bjoern.overridePythonAttrs ( bjoern = super.bjoern.overridePythonAttrs (
old: { old: {
buildInputs = (old.nativeBuildInputs or [ ]) ++ [ pkgs.libev ]; buildInputs = (old.nativeBuildInputs or [ ]) ++ [ pkgs.libev ];

6
tests/bcrypt/default.nix Normal file
View file

@ -0,0 +1,6 @@
{ lib, poetry2nix, runCommand }:
poetry2nix.mkPoetryApplication {
pyproject = ./pyproject.toml;
poetrylock = ./poetry.lock;
src = lib.cleanSource ./.;
}

32
tests/bcrypt/poetry.lock generated Normal file
View file

@ -0,0 +1,32 @@
[[package]]
name = "bcrypt"
version = "4.0.0"
description = "Modern password hashing for your software and your servers"
category = "main"
optional = false
python-versions = ">=3.6"
[package.extras]
tests = ["pytest (>=3.2.1,!=3.3.0)"]
typecheck = ["mypy"]
[metadata]
lock-version = "1.1"
python-versions = "^3.8"
content-hash = "b775516313a0ee51e973c6e8bfbb07650bd437a9261289defb8015738864b749"
[metadata.files]
bcrypt = [
{file = "bcrypt-4.0.0-cp36-abi3-macosx_10_10_universal2.whl", hash = "sha256:845b1daf4df2dd94d2fdbc9454953ca9dd0e12970a0bfc9f3dcc6faea3fa96e4"},
{file = "bcrypt-4.0.0-cp36-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl", hash = "sha256:8780e69f9deec9d60f947b169507d2c9816e4f11548f1f7ebee2af38b9b22ae4"},
{file = "bcrypt-4.0.0-cp36-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1c3334446fac200499e8bc04a530ce3cf0b3d7151e0e4ac5c0dddd3d95e97843"},
{file = "bcrypt-4.0.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bfb67f6a6c72dfb0a02f3df51550aa1862708e55128b22543e2b42c74f3620d7"},
{file = "bcrypt-4.0.0-cp36-abi3-manylinux_2_24_x86_64.whl", hash = "sha256:7c7dd6c1f05bf89e65261d97ac3a6520f34c2acb369afb57e3ea4449be6ff8fd"},
{file = "bcrypt-4.0.0-cp36-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:594780b364fb45f2634c46ec8d3e61c1c0f1811c4f2da60e8eb15594ecbf93ed"},
{file = "bcrypt-4.0.0-cp36-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:2d0dd19aad87e4ab882ef1d12df505f4c52b28b69666ce83c528f42c07379227"},
{file = "bcrypt-4.0.0-cp36-abi3-musllinux_1_1_aarch64.whl", hash = "sha256:bf413f2a9b0a2950fc750998899013f2e718d20fa4a58b85ca50b6df5ed1bbf9"},
{file = "bcrypt-4.0.0-cp36-abi3-musllinux_1_1_x86_64.whl", hash = "sha256:ede0f506554571c8eda80db22b83c139303ec6b595b8f60c4c8157bdd0bdee36"},
{file = "bcrypt-4.0.0-cp36-abi3-win32.whl", hash = "sha256:dc6ec3dc19b1c193b2f7cf279d3e32e7caf447532fbcb7af0906fe4398900c33"},
{file = "bcrypt-4.0.0-cp36-abi3-win_amd64.whl", hash = "sha256:0b0f0c7141622a31e9734b7f649451147c04ebb5122327ac0bd23744df84be90"},
{file = "bcrypt-4.0.0.tar.gz", hash = "sha256:c59c170fc9225faad04dde1ba61d85b413946e8ce2e5f5f5ff30dfd67283f319"},
]

View file

@ -0,0 +1,15 @@
[tool.poetry]
name = "test_bcrypt"
version = "0.1.0"
description = ""
authors = []
[tool.poetry.dependencies]
python = "^3.8"
bcrypt = "*"
[tool.poetry.dev-dependencies]
[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"

View file

@ -76,6 +76,7 @@ builtins.removeAttrs
editable-egg = skipOSX (callTest ./editable-egg { }); editable-egg = skipOSX (callTest ./editable-egg { });
ansible-molecule = callTest ./ansible-molecule { }; ansible-molecule = callTest ./ansible-molecule { };
bcrypt = callTest ./bcrypt { };
mk-poetry-packages = callTest ./mk-poetry-packages { }; mk-poetry-packages = callTest ./mk-poetry-packages { };
markupsafe2 = callTest ./markupsafe2 { }; markupsafe2 = callTest ./markupsafe2 { };
pendulum = callTest ./pendulum { }; pendulum = callTest ./pendulum { };