nixpkgs/pkgs/development/tools/pip-audit/default.nix

91 lines
1.8 KiB
Nix
Raw Normal View History

2022-03-28 11:32:04 +00:00
{ lib
, fetchFromGitHub
, fetchpatch
, python3
}:
let
py = python3.override {
packageOverrides = self: super: {
# ansible doesn't support resolvelib > 0.6.0 and can't have an override
resolvelib = super.resolvelib.overridePythonAttrs (oldAttrs: rec {
version = "0.8.1";
src = fetchFromGitHub {
owner = "sarugaku";
repo = "resolvelib";
rev = version;
sha256 = "1qpd0gg9yl0kbamlgjs9pkxd39kx511kbc92civ77v0ka5sw8ca0";
};
});
};
};
in
with py.pkgs;
buildPythonApplication rec {
pname = "pip-audit";
2022-10-04 12:22:44 +00:00
version = "2.4.4";
2022-05-20 09:17:34 +00:00
format = "pyproject";
2022-03-28 11:32:04 +00:00
src = fetchFromGitHub {
owner = "trailofbits";
repo = pname;
rev = "v${version}";
2022-10-04 12:22:44 +00:00
hash = "sha256-xOcBOk+ac1djfCLKqrCTS+WnOXFf1niRUWN5hItO0v0=";
2022-03-28 11:32:04 +00:00
};
2022-05-20 09:17:34 +00:00
nativeBuildInputs = [
flit-core
];
2022-03-28 11:32:04 +00:00
propagatedBuildInputs = [
cachecontrol
cyclonedx-python-lib
html5lib
2022-06-07 10:52:33 +00:00
lockfile
2022-03-28 11:32:04 +00:00
packaging
pip-api
2022-07-23 16:22:50 +00:00
pip-requirements-parser
2022-03-28 11:32:04 +00:00
progress
resolvelib
2022-06-15 14:20:49 +00:00
rich
2022-03-28 11:32:04 +00:00
];
checkInputs = [
pretend
pytestCheckHook
];
pythonImportsCheck = [
"pip_audit"
];
2022-05-03 06:04:50 +00:00
preCheck = ''
export HOME=$(mktemp -d);
'';
2022-03-28 11:32:04 +00:00
disabledTestPaths = [
2022-05-03 06:04:50 +00:00
# Tests require network access
2022-03-28 11:32:04 +00:00
"test/dependency_source/test_requirement.py"
2022-10-04 12:22:44 +00:00
"test/dependency_source/resolvelib/test_resolvelib.py"
2022-03-28 11:32:04 +00:00
"test/service/test_pypi.py"
"test/service/test_osv.py"
];
disabledTests = [
2022-05-03 06:04:50 +00:00
# Tests requrire network access
2022-03-28 11:32:04 +00:00
"test_get_pip_cache"
"test_virtual_env"
2022-05-03 06:04:50 +00:00
"test_pyproject_source"
"test_pyproject_source_duplicate_deps"
2022-03-28 11:32:04 +00:00
];
meta = with lib; {
description = "Tool for scanning Python environments for known vulnerabilities";
homepage = "https://github.com/trailofbits/pip-audit";
license = with licenses; [ asl20 ];
maintainers = with maintainers; [ fab ];
};
}