2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
|
|
|
pythonOlder,
|
|
|
|
fetchPypi,
|
|
|
|
pythonRelaxDepsHook,
|
|
|
|
setuptools,
|
|
|
|
click,
|
|
|
|
urllib3,
|
|
|
|
requests,
|
|
|
|
packaging,
|
|
|
|
dparse,
|
|
|
|
ruamel-yaml,
|
|
|
|
jinja2,
|
|
|
|
marshmallow,
|
|
|
|
authlib,
|
|
|
|
jwt,
|
|
|
|
rich,
|
|
|
|
typer,
|
|
|
|
pydantic,
|
|
|
|
safety-schemas,
|
|
|
|
typing-extensions,
|
|
|
|
pytestCheckHook,
|
2022-06-16 17:23:12 +00:00
|
|
|
}:
|
2020-05-15 21:57:56 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "safety";
|
2024-06-20 14:57:18 +00:00
|
|
|
version = "3.2.3";
|
2020-05-15 21:57:56 +00:00
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
disabled = pythonOlder "3.7";
|
2022-06-16 17:23:12 +00:00
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
pyproject = true;
|
2022-06-16 17:23:12 +00:00
|
|
|
|
2020-05-15 21:57:56 +00:00
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2024-06-20 14:57:18 +00:00
|
|
|
hash = "sha256-QUFUk08XJ9r4pkc0k5RP7LOAVAw/AIddwa43c4L32D8=";
|
2020-05-15 21:57:56 +00:00
|
|
|
};
|
|
|
|
|
2022-07-14 12:49:19 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace safety/safety.py \
|
2024-04-21 15:54:59 +00:00
|
|
|
--replace-fail "telemetry=True" "telemetry=False"
|
2022-11-21 17:40:18 +00:00
|
|
|
substituteInPlace safety/util.py \
|
2024-04-21 15:54:59 +00:00
|
|
|
--replace-fail "telemetry = True" "telemetry = False"
|
2022-07-14 12:49:19 +00:00
|
|
|
substituteInPlace safety/cli.py \
|
2024-04-21 15:54:59 +00:00
|
|
|
--replace-fail "disable-optional-telemetry', default=False" \
|
|
|
|
"disable-optional-telemetry', default=True"
|
|
|
|
substituteInPlace safety/scan/finder/handlers.py \
|
|
|
|
--replace-fail "telemetry=True" "telemetry=False"
|
2022-07-14 12:49:19 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2023-03-15 16:39:30 +00:00
|
|
|
pythonRelaxDepsHook
|
2022-07-14 12:49:19 +00:00
|
|
|
setuptools
|
|
|
|
];
|
|
|
|
|
2023-03-15 16:39:30 +00:00
|
|
|
pythonRelaxDeps = [
|
|
|
|
"packaging"
|
2024-04-21 15:54:59 +00:00
|
|
|
"dparse"
|
|
|
|
"authlib"
|
|
|
|
"pydantic"
|
2023-03-15 16:39:30 +00:00
|
|
|
];
|
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
setuptools
|
|
|
|
click
|
2024-04-21 15:54:59 +00:00
|
|
|
urllib3
|
2022-06-16 17:23:12 +00:00
|
|
|
requests
|
|
|
|
packaging
|
|
|
|
dparse
|
2022-07-14 12:49:19 +00:00
|
|
|
ruamel-yaml
|
2024-04-21 15:54:59 +00:00
|
|
|
jinja2
|
|
|
|
marshmallow
|
|
|
|
authlib
|
|
|
|
jwt
|
|
|
|
rich
|
|
|
|
typer
|
|
|
|
pydantic
|
|
|
|
safety-schemas
|
|
|
|
typing-extensions
|
2022-06-16 17:23:12 +00:00
|
|
|
];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
nativeCheckInputs = [ pytestCheckHook ];
|
2020-05-15 21:57:56 +00:00
|
|
|
|
|
|
|
# Disable tests depending on online services
|
|
|
|
disabledTests = [
|
2022-07-14 12:49:19 +00:00
|
|
|
"test_announcements_if_is_not_tty"
|
2020-05-15 21:57:56 +00:00
|
|
|
"test_check_live"
|
|
|
|
"test_check_live_cached"
|
2024-04-21 15:54:59 +00:00
|
|
|
"test_get_packages_licenses_without_api_key"
|
|
|
|
"test_validate_with_policy_file_using_invalid_keyword"
|
2024-05-15 15:35:15 +00:00
|
|
|
"test_validate_with_basic_policy_file"
|
2020-05-15 21:57:56 +00:00
|
|
|
];
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
# ImportError: cannot import name 'get_command_for' from partially initialized module 'safety.cli_util' (most likely due to a circular import)
|
|
|
|
disabledTestPaths = [ "tests/alerts/test_utils.py" ];
|
|
|
|
|
2020-05-15 21:57:56 +00:00
|
|
|
preCheck = ''
|
|
|
|
export HOME=$(mktemp -d)
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
2022-06-16 17:23:12 +00:00
|
|
|
description = "Checks installed dependencies for known vulnerabilities";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "safety";
|
2020-05-15 21:57:56 +00:00
|
|
|
homepage = "https://github.com/pyupio/safety";
|
2022-07-14 12:49:19 +00:00
|
|
|
changelog = "https://github.com/pyupio/safety/blob/${version}/CHANGELOG.md";
|
2020-05-15 21:57:56 +00:00
|
|
|
license = licenses.mit;
|
2024-06-05 15:53:02 +00:00
|
|
|
maintainers = with maintainers; [
|
|
|
|
thomasdesr
|
|
|
|
dotlambda
|
|
|
|
];
|
2020-05-15 21:57:56 +00:00
|
|
|
};
|
|
|
|
}
|