-
-
Notifications
You must be signed in to change notification settings - Fork 14k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
python312Packages.primp: init at 0.6.4
- Loading branch information
Showing
2 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
{ | ||
lib, | ||
stdenv, | ||
buildPythonPackage, | ||
fetchFromGitHub, | ||
rustPlatform, | ||
pytest, | ||
runCommand, | ||
boringssl, | ||
libiconv, | ||
SystemConfiguration, | ||
autoPatchelfHook, | ||
patchelf, | ||
gcc-unwrapped, | ||
}: | ||
|
||
let | ||
# boring-sys expects the static libraries in build/ instead of lib/ | ||
boringssl-wrapper = runCommand "boringssl-wrapper" { } '' | ||
mkdir $out | ||
cd $out | ||
ln -s ${boringssl.out}/lib build | ||
ln -s ${boringssl.dev}/include include | ||
''; | ||
in | ||
buildPythonPackage rec { | ||
pname = "primp"; | ||
version = "0.6.4"; | ||
pyproject = true; | ||
|
||
src = fetchFromGitHub { | ||
owner = "deedy5"; | ||
repo = "primp"; | ||
rev = "refs/tags/v${version}"; | ||
hash = "sha256-wCD99eEU4RW8kUJY72cXhJh5124PVd6kJt+HZjm/hFI="; | ||
}; | ||
|
||
cargoDeps = rustPlatform.fetchCargoTarball { | ||
inherit src; | ||
name = "${pname}-${version}"; | ||
hash = "sha256-iY6TSc7GU6OWVUpW6qpwH4g9/eGKhP/YZ5PQoO8NmVc="; | ||
}; | ||
|
||
nativeBuildInputs = [ | ||
rustPlatform.bindgenHook | ||
rustPlatform.cargoSetupHook | ||
rustPlatform.maturinBuildHook | ||
]; | ||
|
||
# TODO: Can we improve this? | ||
postInstall = '' | ||
${lib.getExe patchelf} --add-rpath ${lib.getLib gcc-unwrapped.lib} --add-needed libstdc++.so.6 $out/lib/python3.12/site-packages/primp/primp.abi3.so | ||
''; | ||
|
||
buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ | ||
libiconv | ||
SystemConfiguration | ||
]; | ||
|
||
env.BORING_BSSL_PATH = boringssl-wrapper; | ||
|
||
optional-dependencies = { | ||
dev = [ pytest ]; | ||
}; | ||
|
||
# Test use network | ||
doCheck = false; | ||
|
||
pythonImportsCheck = [ "primp" ]; | ||
|
||
meta = { | ||
changelog = "https://github.com/deedy5/primp/releases/tag/${version}"; | ||
description = "PRIMP (Python Requests IMPersonate). The fastest python HTTP client that can impersonate web browsers."; | ||
homepage = "https://github.com/deedy5/primp"; | ||
license = lib.licenses.mit; | ||
maintainers = with lib.maintainers; [ drupol ]; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters