1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5 pytest-mock,
6 pytestCheckHook,
7 pythonAtLeast,
8 pythonOlder,
9 setuptools,
10}:
11
12buildPythonPackage rec {
13 pname = "restrictedpython";
14 version = "7.1";
15 pyproject = true;
16
17 disabled = pythonOlder "3.7";
18
19 src = fetchPypi {
20 pname = "RestrictedPython";
21 inherit version;
22 hash = "sha256-h1rrUcE51440zvhgXcZTCbRJFoBg3QhVGh/p7bR8uaU=";
23 };
24
25 nativeBuildInputs = [ setuptools ];
26
27 nativeCheckInputs = [
28 pytestCheckHook
29 pytest-mock
30 ];
31
32 disabledTests = lib.optionals (pythonAtLeast "3.11") [ "test_compile__compile_restricted_exec__5" ];
33
34 pythonImportsCheck = [ "RestrictedPython" ];
35
36 meta = with lib; {
37 description = "Restricted execution environment for Python to run untrusted code";
38 homepage = "https://github.com/zopefoundation/RestrictedPython";
39 changelog = "https://github.com/zopefoundation/RestrictedPython/blob/${version}/CHANGES.rst";
40 license = licenses.zpl21;
41 maintainers = with maintainers; [ juaningan ];
42 };
43}