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 = "8.0";
15 pyproject = true;
16
17 disabled = pythonOlder "3.7";
18
19 src = fetchPypi {
20 inherit pname version;
21 hash = "sha256-OvIxK8Z+X87Yh/uFsAbImGHackiBKLFVvuqB62oKmyQ=";
22 };
23
24 postPatch = ''
25 substituteInPlace pyproject.toml \
26 --replace-fail "setuptools <= 75.6.0" setuptools
27 '';
28
29 build-system = [ setuptools ];
30
31 nativeCheckInputs = [
32 pytestCheckHook
33 pytest-mock
34 ];
35
36 disabledTests = lib.optionals (pythonAtLeast "3.11") [ "test_compile__compile_restricted_exec__5" ];
37
38 pythonImportsCheck = [ "RestrictedPython" ];
39
40 meta = with lib; {
41 description = "Restricted execution environment for Python to run untrusted code";
42 homepage = "https://github.com/zopefoundation/RestrictedPython";
43 changelog = "https://github.com/zopefoundation/RestrictedPython/blob/${version}/CHANGES.rst";
44 license = licenses.zpl21;
45 maintainers = with maintainers; [ juaningan ];
46 };
47}